summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBlueRaja <BlueRaja.admin@gmail.com>2013-01-24 20:52:29 -0600
committerBlueRaja <BlueRaja.admin@gmail.com>2013-01-24 20:52:29 -0600
commit8c531ad1777beadd6933605e7630ca2681001fb3 (patch)
treeffad2ff44bb70ac4d476516122b277f3949f27c6
parent4ef5930b62bc0d20657278f2e6e227905d70bc44 (diff)
downloadpathery-8c531ad1777beadd6933605e7630ca2681001fb3.tar.xz
Challenges are now displayed in the correct order again. Ay' carumba.
-rw-r--r--css/challenge.css4
-rw-r--r--db updates.sql11
-rw-r--r--includes/datas.php3
-rw-r--r--pages/challengelist.php18
4 files changed, 24 insertions, 12 deletions
diff --git a/css/challenge.css b/css/challenge.css
index 15a94ab..16c7357 100644
--- a/css/challenge.css
+++ b/css/challenge.css
@@ -69,13 +69,13 @@
width: 32px;
height: 32px;
background-image: url("../images/challenge_complete.png");
- float: right;
+ float: left;
}
.challengelist_incomplete {
width: 32px;
height: 32px;
background-image: url("../images/challenge_incomplete.png");
- float: right;
+ float: left;
}
.challengelist_map {
float:left;
diff --git a/db updates.sql b/db updates.sql
index efc21ce..bb3bcb3 100644
--- a/db updates.sql
+++ b/db updates.sql
@@ -31,4 +31,13 @@ WHERE mapType = 5;
ALTER TABLE `mapOfTheDay` CHANGE `mapExpireTime` `mapExpireTime` DATETIME NOT NULL;
-ALTER TABLE `mapOfTheDay` ADD INDEX ( `mapExpireTime` , `mapType` ); \ No newline at end of file
+ALTER TABLE `mapOfTheDay` ADD INDEX ( `mapExpireTime` , `mapType` );
+
+-- The new code relies on these being unique, so we'll enforce that through indices. Make sure you
+-- verify these ARE unique in the DB before adding these indices (they weren't in my test DB)
+-- Should probably run these two commands by themselves, one at a time
+ALTER TABLE `maps` ADD UNIQUE ( `challengeTier` , `challengeSuborder`);
+
+ALTER TABLE `challenges`
+DROP INDEX `mapID` ,
+ADD UNIQUE `mapID` ( `mapID` , `ordering` ); \ No newline at end of file
diff --git a/includes/datas.php b/includes/datas.php
index 41456a1..62f664e 100644
--- a/includes/datas.php
+++ b/includes/datas.php
@@ -1076,7 +1076,8 @@ function loadChallengeListing($userIdUnsanitized)
$userID = mysql_escape_string($userIdUnsanitized);
$sql = " SELECT maps.ID AS mapID, maps.challengeTier, maps.name AS name,
- challengeSolutions.dateSolved, challengeSolutions.challengeID AS challengeID
+ challengeSolutions.dateSolved, challengeSolutions.challengeID AS challengeID,
+ maps.challengeSuborder, challenges.ordering
FROM challenges
LEFT JOIN maps ON challenges.mapID = maps.ID
LEFT JOIN challengeSolutions ON challenges.ID = challengeSolutions.challengeID AND challengeSolutions.userID = '$userID'
diff --git a/pages/challengelist.php b/pages/challengelist.php
index fcc384b..db20081 100644
--- a/pages/challengelist.php
+++ b/pages/challengelist.php
@@ -60,16 +60,18 @@ function ChallengeList($challengeListResultset) {
$r = '';
while($data = mysql_fetch_array($challengeListResultset)) {
$tier = $data['challengeTier'];
- $mapid = $data['mapID'];
- $challengeID = $data['challengeID'];
- $challenges[$tier][$mapid][$challengeID] = $data;
+ $challengeSuborder = $data['challengeSuborder'];
+ $ordering = $data['ordering'];
+ $challenges[$tier][$challengeSuborder][$ordering] = $data;
}
- foreach ($challenges as $tier => $map) {
+ foreach ($challenges as $tier => $challengeMap) {
$r .= "<b>Section $tier</b> levels:<div class='challengelist_tier' style='border: 1px solid yellow; overflow: auto;'>";
- foreach ($map as $mapid => $challenge) {
- // $r .= "MAP $mapid";
-
+ foreach ($challengeMap as $challengeSuborder => $challenge) {
+ //Hack to get the first element of the array:
+ $firstChallenge = $challenge[key($challenge)];
+ $mapid = $firstChallenge['mapID'];
+
$mapCode = getMapCode($mapid);
$map = new map($mapCode);
$thumbnail = DisplayMapThumbnail($map);
@@ -78,7 +80,7 @@ function ChallengeList($challengeListResultset) {
$r .= "$map->name";
$r .= $thumbnail;
- foreach ($challenge as $challengeID => $content) {
+ foreach ($challenge as $ordering => $content) {
//Each challenge gets its own star
if($content["dateSolved"] !== NULL)
$cssClass = "challengelist_complete";