Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@sugarlabs.org>2012-01-18 16:03:12 (GMT)
committer Aleksey Lim <alsroot@sugarlabs.org>2012-01-18 16:03:12 (GMT)
commit50c5c8d15b0c373c043b148c017d3a15a53428b0 (patch)
tree2f9a55a5e5a0ae152fd7a706523ba3a6a0608478
parent7eb98d60baf6992bbb385e0b9685837e9e1dff4e (diff)
Return to ORDER BY instruction for previous commit
-rw-r--r--site/app/models/file.php3
-rw-r--r--site/app/models/version.php6
2 files changed, 3 insertions, 6 deletions
diff --git a/site/app/models/file.php b/site/app/models/file.php
index bb5ceed..ba79e42 100644
--- a/site/app/models/file.php
+++ b/site/app/models/file.php
@@ -102,10 +102,9 @@ class File extends AppModel
appversions as C ON C.id = A.max
WHERE
File.status = ".STATUS_PUBLIC."
- {$sp} >= CAST(B.version AS DECIMAL(3,3)) AND {$sp} <= CAST(C.version AS DECIMAL(3,3))
{$platform}
ORDER BY
- Version.version DESC
+ Version.version + IF({$sp} >= CAST(B.version AS DECIMAL(3,3)) AND {$sp} <= CAST(C.version AS DECIMAL(3,3)), 1000000, 0) DESC
LIMIT 1
";
diff --git a/site/app/models/version.php b/site/app/models/version.php
index 2138b93..c3acbfe 100644
--- a/site/app/models/version.php
+++ b/site/app/models/version.php
@@ -155,9 +155,8 @@ class Version extends AppModel
appversions as C ON C.id = A.max
WHERE
Version.addon_id = {$id}
- AND {$app_ver} >= CAST(B.version AS DECIMAL(3,3)) AND {$app_ver} <= CAST(C.version AS DECIMAL(3,3))
ORDER BY
- Version.id DESC
+ Version.id + IF({$app_ver} >= CAST(B.version AS DECIMAL(3,3)) AND {$app_ver} <= CAST(C.version AS DECIMAL(3,3)), 1000000, 0) DESC
LIMIT 1
";
@@ -194,9 +193,8 @@ class Version extends AppModel
appversions as C ON C.id = A.max
WHERE
Version.addon_id = {$id} AND ({$version} = 0 OR Version.version = {$version})
- AND {$app_ver} >= CAST(B.version AS DECIMAL(3,3)) AND {$app_ver} <= CAST(C.version AS DECIMAL(3,3))
ORDER BY
- Version.id DESC
+ Version.id + IF({$app_ver} >= CAST(B.version AS DECIMAL(3,3)) AND {$app_ver} <= CAST(C.version AS DECIMAL(3,3)), 1000000, 0) DESC
LIMIT 1
";