Skip to content

Commit

Permalink
Level Deletion Confirmation and Bug Fixes (facebookarchive#512)
Browse files Browse the repository at this point in the history
* Level Deletion Confirmation and Bug Fixes

* Added deletion confirmation dialog when deleting levels.

* Level data is now deleted from HintLog, ScoresLog, and FailuresLog, when a level is deleted.

* Cache invalidation performed on level deletion for records containing levels.

* Moved all awaitable queries into a vector which are now executed via AsyncMysqlConnection::multiQuery().
  • Loading branch information
iliushin-a committed May 16, 2018
1 parent dec70c0 commit 7e4c3a8
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/models/ScoreLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,24 @@ private static function scorelogFromRow(Map<string, string> $row): ScoreLog {
return $scores;
}

// Get all scores by level.
public static async function genAllScoresByLevel(
int $level_id,
): Awaitable<array<ScoreLog>> {
$db = await self::genDb();
$result = await $db->queryf(
'SELECT * FROM scores_log WHERE level_id = %d',
$level_id,
);

$scores = array();
foreach ($result->mapRows() as $row) {
$scores[] = self::scorelogFromRow($row);
}

return $scores;
}

// Log successful score.
public static async function genLogValidScore(
int $level_id,
Expand Down

0 comments on commit 7e4c3a8

Please sign in to comment.