Jump to content

Rev v2.1.934-107-ga045c0f - stats fixes


Nabeel

Recommended Posts

  • Administrators

Changed Files:

m core/classes/Util.class.php

m core/common/PIREPData.class.php

m core/common/PilotData.class.php

m core/common/StatsData.class.php

m core/lib/mysqldiff/MySQLDiff.class.php

m core/version

m install/hashlist

m install/sql/structure.xml

m unittest/Tests/StatsTest.php

m unittest/utils/time.php

stats fixes

View complete changes

Download from here

Link to comment
Share on other sites

  • Moderators

just update to this version problems i still see are

Total Hours on public index and admin not updating (wrong) "Total Hours Flown: 838:59:59"

News not exporting to VA Central

While running maintenance.php Reset pireps count all showing 0 for every pilot.

total hours in the pilot center and total pay look like this

total pay: 1.11474e+06

total hours: 1.72574e+06

same as mark menntiont in an early update

Link to comment
Share on other sites

Guest lorathon

PilotData class around line 578. Replace with this and it will repair some of the issues.

public static function updatePilotStats($pilotid) {

       $total = DB::get_row(
           'SELECT 
             COUNT(*) as `totalpireps`,
             SUM(TIME_TO_SEC(`flighttime_stamp`)) as `totaltime`
           FROM `'.TABLE_PREFIX.'pireps`
           WHERE `pilotid`='.$pilotid.' AND `accepted`='.PIREP_ACCEPTED
       );

       if($total->totalpireps == 0) {
           $totaltime = 0;
       } else {            
           $totaltime = explode(':', Util::secondsToTime($total->totaltime));
           $totaltime = $totaltime[0].'.'.$totaltime[1];            
       }

       return self::updateProfile($pilotid, array(
           'totalhours' => $totaltime, 
           'totalflights' => $total->totalpireps, 
       ));
   }

Link to comment
Share on other sites

Guest lorathon

Also PilotData around line 528

public static function getPilotHours($pilotid) {

       $sql= 'SELECT 
                SUM(TIME_TO_SEC(`flighttime_stamp`)) AS `total`
              FROM `'.TABLE_PREFIX.'pireps`
              WHERE `accepted`=' . PIREP_ACCEPTED.' AND `pilotid`='.$pilotid;         

       $totaltime = DB::get_row($sql);
       if(!$totaltime) {
           $totaltime = '0';
       } else {
       	$totaltime = explode(':', Util::secondsToTime($totaltime->total));
       	$totaltime = $totaltime[0].'.'.$totaltime[1];
       }

       return $totaltime;
   }

Link to comment
Share on other sites

  • Administrators

Woops... thanks Jeff.

I shouldn't code late at night...

Jeff, here's the pay query:

$sql = "SELECT 
           	(SUM((TIME_TO_SEC(`flighttime_stamp`)/60) * (`pilotpay`/60))) AS `totalpay`
			FROM `".TABLE_PREFIX."pireps`
			WHERE `paytype`=".PILOT_PAY_HOURLY." 
               	AND `pilotid`={$pilotid} 
               	AND `accepted`=".PIREP_ACCEPTED;

That's correct for the pay summation? I believe that's the query you sent.

Link to comment
Share on other sites

  • Moderators

just update to this version problems i still see are

Total Hours on public index and admin not updating (wrong) "Total Hours Flown: 838:59:59"

News not exporting to VA Central

While running maintenance.php Reset pireps count all showing 0 for every pilot.

total hours in the pilot center and total pay look like this

total pay: 1.11474e+06

total hours: 1.72574e+06

same as mark menntiont in an early update

thanks jeff

folowing is off the tabel

total hours in pilotcenter are now correct allt the others are still there

gr joeri

Link to comment
Share on other sites

  • Moderators

sorry jeffrey

current errors

-when doing a maintanace calcualtion off the pireps its shows all as 0 but in my pilotcenter its showing them correct.

-pilot pay is still screwed

-total flights is incorrect

-no news updating to va central thats about it i think for now

Link to comment
Share on other sites

  • Moderators

Im on the previous release to this and my news is now showing up on VAC just started working by its self :)

The only thing i can see for me is the Pireps when running the maintenance.php but all is showing OK on the site and the VA total hours.

But i have not updated to this version.

Link to comment
Share on other sites

  • Moderators

Nabeel, This came to my mind........ I'm not sure but I wanted to tell...

What would if you could put a feature like a Account History for per pilots.

Like for Example, you change the pilot's hub from KLGA to KLAS, the log data will be logged to the pilot's profile and it will display like this....

12.21.10

Hub Changed From KLGA to KLAS

VA0001 Kyle S.

And it will show who changed the pilot's hub from the staff and what date. Just like DeltaVA.

I'm kinda feeling it would be little hard but it's a great feature to have though. I'm interested to have that. It helps to keep track to what changes were made to the pilot's account

Link to comment
Share on other sites

  • Administrators

There is an admin log, so doing something similar for that may not be out of the question.

Add a bug for it in the tracker.

As for pilot pay, I've coded about half of a more comprehensive solution - a ledger table. This way it can be more easily tracked (incl subtractions), and expenses can also tie this data in. It might take the weekend to complete, and tie into financials.

I made some fixes on the API side which receives the news and other vacentral data... hopefully that's all sorted out now.

Link to comment
Share on other sites

×
×
  • Create New...