Vidofnir Posted May 22, 2012 Report Posted May 22, 2012 The latest pilots to join thing on the index is nice and dandy if you keep consecutive Pilot IDs. If you change the Pilot IDs on registration (say, for hub purposes) there is an unfortunate problem where it only shows the highest Pilot ID, which may not necessarily be the newest pilot. I whipped up a work-around that should benefit airlines that do this. This simple change can be condensed even more, but I figured I would create a new Method just to keep things clean (and give me something to fall back on later). Open core/common/PilotData.class.php Add this snippet somewhere (perhaps after the getLatestPilots method, Line ~227) public static function getLatestPilotsByJoinDate($count=10) { $sql = 'SELECT * FROM '.TABLE_PREFIX.'pilots ORDER BY `joindate` DESC LIMIT '.$count; return DB::get_results($sql); } Save, Now open core/modules/Pilots/Pilots.php Change: $this->set('pilots', PilotData::GetLatestPilots($count)); To: $this->set('pilots', PilotData::GetLatestPilotsByJoinDate($count)); Save, upload, be happy. Alternatively, you can just change the existing SQL query under getLatestPilots to order by 'joindate' and leave it at that, but I preferred to make my own method just to not break things. Or something. Quote
freshJet Posted May 22, 2012 Report Posted May 22, 2012 What difference would this make though? Quote
freshJet Posted May 23, 2012 Report Posted May 23, 2012 Yes thanks Jon I got that bit. But the pilot codes are done in order of join date anyway so it would make no difference :S Quote
Vidofnir Posted May 26, 2012 Author Report Posted May 26, 2012 Our airline changes your pilot code once you join, so the big pilot codes (I.E 1300+) are not used. Each hub has a specific set of numbers associated with it. If no one has a pending application, then the person with the highest code is always the "newest pilot" regardless of his actual join date. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.