tnick74 Posted July 12, 2010 Report Share Posted July 12, 2010 Hello, i try to work out a scoring system using fspax pireps and this is what i have done so far: 1. created 2 fields in the db table "_pireps", named "bonus" and "penalty" 2. added the following code to the /acars/fspax.php: $data = array( 'pilotid'=>$pilotid, 'code'=>$code, 'flightnum'=>$flightnum, 'leg'=>$leg, 'depicao'=>$depicao, 'arricao'=>$arricao, 'aircraft'=>$aircraft, 'route' => '', 'flighttime'=>$flighttime, 'landingrate'=>$_POST['TouchDownVertSpeedFt'], 'submitdate'=>'NOW()', 'load'=>$_POST['NbrPassengers'], 'fuelused'=>$fuelused, 'bonus'=>$_POST['BonusPoints'], 'penalty'=>$_POST['PenaltyPoints'], 'score'=>$score, 'source'=>'fspax', 'comment'=>$comment, 'log'=> $log); So, i suppose in every fspax pirep, the bonus and penalty values should be added. But no...when exporting a pirep, these values are not inserted in the pirep db. Any help please? Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted July 12, 2010 Report Share Posted July 12, 2010 Try adding the following after the FilePIREP portion $last = PIREPData::getLastReports($pilotid, 1); // this will get the last pirep (meaning the one just filed above) $fields = array( 'bonus' => $_POST['BonusPoints'], 'penalty' => $_POST['PenaltyPoints'] ); PIREPData::updatePIREPfields($last->pirepid, $fields); Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted July 12, 2010 Administrators Report Share Posted July 12, 2010 Jeff is correct, right now it doesn't look at the fields passed. Unless you're using beta Quote Link to comment Share on other sites More sharing options...
tnick74 Posted July 12, 2010 Author Report Share Posted July 12, 2010 Thank you both guys!! now i am really comfused......this is the fspax.php i use. Where to put the code that Jeff posted? fspax(2).php Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted July 12, 2010 Report Share Posted July 12, 2010 Right after the following $ret = ACARSData::FilePIREP($pilotid, $data); if(!$ret) { echo "#Answer# Error - ".PIREPData::$lasterror; exit; } and before echo "#Answer# Ok - Saved;"; It is at the bottom of the file. Quote Link to comment Share on other sites More sharing options...
tnick74 Posted July 12, 2010 Author Report Share Posted July 12, 2010 Thank you again Jeff! Now it works, but only for the bonus. Penalty is not inserted. Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted July 12, 2010 Report Share Posted July 12, 2010 Then check the DB field name and the post name. Make sure they are both correct. Quote Link to comment Share on other sites More sharing options...
tnick74 Posted July 12, 2010 Author Report Share Posted July 12, 2010 Both db field name and post name are correct. The only thing i noticed is that a comma is missing after ".......POST['PenaltyPoints']". Could it be the cause? Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted July 12, 2010 Administrators Report Share Posted July 12, 2010 No that's fine because its defining a dictionary array and thats the last element. Make sure PenaltyPoints is the correct name Quote Link to comment Share on other sites More sharing options...
tnick74 Posted July 12, 2010 Author Report Share Posted July 12, 2010 Yup i think i found the error. Fspax export PenalityPoints, not PenaltyPoints....i hope it will work now Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted July 13, 2010 Administrators Report Share Posted July 13, 2010 Gotta love it when they mispell in the app 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.