TAV1702 Posted April 12, 2013 Report Share Posted April 12, 2013 Hello everyone. I have the cron job setup to run once a week on my site to do all the maintenance and when it runs, it resets the flights count on pilot roster and public profiles and in pilot center to 0. I found this in the maintenance.php file : MainController::Run('Maintenance', 'resetpirepcount'); MainController::Run('Maintenance', 'resethours'); Is it safe to say that I can get rid of the resetpirepcount part to stop this from happening? I get LOADS of inquirys every week as to why their flight count is 0 again. I tell them it is the cron job but in their eyes we do not know what we are doing and a few have left over this already. Personally, I see no reason why to ever reset the pirep count on a weekly basis. Quote Link to comment Share on other sites More sharing options...
lorlandi Posted April 12, 2013 Report Share Posted April 12, 2013 I had many times the same problem with maintenace module, pireps and hours in "0" really don't know whats is wrong in my codes but i made some code to populate the data again. Try with the code below and insert it at the end of your PilotData.class located at core/common. public static function actualizarPagoPiloto($pilotid) { $sql = 'SELECT p.pirepid, p.submitdate, p.modifieddate FROM ' . TABLE_PREFIX . 'pireps p WHERE p.pilotid='.$pilotid.' AND `accepted`='.PIREP_ACCEPTED; $pireps = DB::get_results($sql); foreach ($pireps as $pirep) { $sqlupdate = 'UPDATE ' . TABLE_PREFIX . 'ledger l SET l.submitdate="' . $pirep->submitdate . '", l.modifieddate="' . $pirep->modifieddate . '" WHERE l.pirepid=' . $pirep->pirepid; DB::query($sqlupdate); } $total = DB::get_row('SELECT SUM(`amount`) AS `total` FROM `'.TABLE_PREFIX.'ledger` WHERE `pilotid`='.$pilotid); return $total->total; } public static function actualizarConteoVuelos($pilotid) { $sql = 'SELECT COUNT(*) as total FROM ' . TABLE_PREFIX . 'pireps p WHERE p.pilotid='.$pilotid.' AND `accepted`='.PIREP_ACCEPTED; $vuelos = DB::get_row($sql); $sqlupdate = 'UPDATE ' . TABLE_PREFIX . 'pilots l SET l.totalflights=' . $vuelos->total . ' WHERE l.pilotid=' . $pilotid; DB::query($sqlupdate); return $vuelos->total; } } Regards Quote Link to comment Share on other sites More sharing options...
TAV1702 Posted April 13, 2013 Author Report Share Posted April 13, 2013 Thanks Lor, I'll give that a try and see what happens. Quote Link to comment Share on other sites More sharing options...
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.