Order educations by graduation year in the database and in the display (Ooops, sorry).
authorStéphane Jacob <jacou@melix.net>
Thu, 21 Aug 2008 14:54:05 +0000 (16:54 +0200)
committerStéphane Jacob <jacou@melix.net>
Thu, 21 Aug 2008 14:56:56 +0000 (16:56 +0200)
modules/profile/general.inc.php

index 794f746..59ed455 100644 (file)
@@ -87,10 +87,12 @@ class ProfileEdu implements ProfileSetting
     }
 
     static function sortByGradYear($line1, $line2) {
-        if ($line1['grad_year'] == $line2['grad_year']) {
+        $a = (int) $line1['grad_year'];
+        $b = (int) $line2['grad_year'];
+        if ($a == $b) {
             return 0;
         }
-        return ($line1['grad_year'] < $line2['grad_year']) ? -1 : 1;
+        return ($a < $b) ? -1 : 1;
     }
 
     public function value(ProfilePage &$page, $field, $value, &$success)