From 22f0a0a857bc6ba3fedb543f580af5bc7a45ab42 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Thu, 21 Aug 2008 16:54:05 +0200 Subject: [PATCH] Order educations by graduation year in the database and in the display (Ooops, sorry). --- modules/profile/general.inc.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/profile/general.inc.php b/modules/profile/general.inc.php index 794f746..59ed455 100644 --- a/modules/profile/general.inc.php +++ b/modules/profile/general.inc.php @@ -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) -- 2.1.4