Jump to content

Recommended Posts

Posted

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?

Guest lorathon
Posted

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);

Guest lorathon
Posted

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.

Guest lorathon
Posted

Then check the DB field name and the post name. Make sure they are both correct.

  • Administrators
Posted

No that's fine because its defining a dictionary array and thats the last element. Make sure PenaltyPoints is the correct name

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...