Jump to content

Deleted Flights Showing in Top Pilot MOD


flyalaska

Recommended Posts

We recently had a PIREP that was rejected. Was recorded with a 45 hour flight. With it being rejected the hours are still being recorded in the Top Pilot MOD/ Still showing after being deleted as-well. Does not show in the database or the pilots recent flights. Anyone else had this happen to them or have an idea how to remove that info?

Top Mod by SimPilot

 

january.png

Link to comment
Share on other sites

 On line 53 of the toppilot module

 

foreach ($pilots as $pilot) {
                $totaltime=0;
                $totalflights=0;
                $totalmiles=0;
                if(isset($month_stats)) {
                    foreach ($month_stats as $pirep) {
                        if ($pilot->pilotid == $pirep->pilotid /* && $pirep->accepted == 1 */ ) {
                            $totaltime = $totaltime + $pirep->flighttime;
                            $totalflights++;
                            $totalmiles = $totalmiles + $pirep->distance;
                        }
                    }
                }

Link to comment
Share on other sites

8 minutes ago, RuiMiguel said:

 On line 53 of the toppilot module

 

foreach ($pilots as $pilot) {
                $totaltime=0;
                $totalflights=0;
                $totalmiles=0;
                if(isset($month_stats)) {
                    foreach ($month_stats as $pirep) {
                        if ($pilot->pilotid == $pirep->pilotid /* && $pirep->accepted == 1 */ ) {
                            $totaltime = $totaltime + $pirep->flighttime;
                            $totalflights++;
                            $totalmiles = $totalmiles + $pirep->distance;
                        }
                    }
                }

Still shows

Link to comment
Share on other sites

my modulo 

It works on my va

<?php
//simpilotgroup addon module for phpVMS virtual airline system
//
//simpilotgroup addon modules are licenced under the following license:
//Creative Commons Attribution Non-commercial Share Alike (by-nc-sa)
//To view full icense text visit http://creativecommons.org/licenses/by-nc-sa/3.0/
//
//@author David Clark (simpilot)
//@copyright Copyright (c) 2009-2010, David Clark
//@license http://creativecommons.org/licenses/by-nc-sa/3.0/

class TopPilot extends CodonModule {

    public $title = 'Top Pilots';

    public function __construct() {
        
        CodonEvent::addListener('TopPilot', array('pirep_filed'));
    }
    public function EventListener($eventinfo) {
        if($eventinfo[0] == 'pirep_filed') {
            self::refresh_pilot_stats();
        }
    }

    public function index() {
        
         if(!Auth::LoggedIn()) {
            $this->set('message', 'Você precisa estar logado para acessar esta função!');
            $this->render('core_error.tpl');
            return;
        }
        

        if($this->post->action == 'get_old_stats') {
            $this->get_old_stats();
        }
        else    {
        $start = StatsData::GetStartDate();
        $this->set('startmonth', date('m', strtotime($start->submitdate)));
        $this->set('startyear', date('Y', strtotime($start->submitdate)));
        $this->set('today', getdate());
        $this->render('toppilot/tp_index');
        }
    }

    public function refresh_pilot_stats() {

        TopPilotData::clear_table();

        $start = StatsData::GetStartDate();
        $startmonth = date('m', strtotime($start->submitdate));
        $startyear = date('Y', strtotime($start->submitdate));
        $today = getdate();

        while ($startyear <= $today[year] ) {

            $pilots = PilotData::getAllPilots();
            $month_stats = TopPilotData::get_monthly_stats($startmonth, $startyear);

            foreach ($pilots as $pilot) {
                $totaltime=0;
                $totalflights=0;
                $totalmiles=0;
                if(isset($month_stats)) {
                    foreach ($month_stats as $pirep) {
                        if ($pilot->pilotid == $pirep->pilotid /* && $pirep->accepted == 1 */ ) {
                            $totaltime = $totaltime + $pirep->flighttime;
                            $totalflights++;
                            $totalmiles = $totalmiles + $pirep->distance;
                        }
                    }
                }
                if($totalflights > 0) {
                    TopPilotData::record_stats($pilot->pilotid, $totalflights, $totaltime, $totalmiles, $startmonth, $startyear);
                }
            }
            if ($startmonth == 12) {$startyear++; $startmonth = 1;}
            else {$startmonth++;}
        }
    }

    public function get_old_stats() {
        
         if(!Auth::LoggedIn()) {
            $this->set('message', 'Você precisa estar logado para acessar esta função!');
            $this->render('core_error.tpl');
            return;
        }
        $month = $_GET['month'];
        $year = $_GET['year'];

        $this->set('month', $month);
        $this->set('year', $year);
        $this->set('topflights', TopPilotData::top_pilot_flights($month, $year, 10));
        $this->set('tophours',  TopPilotData::top_pilot_hours($month, $year, 10));
        $this->set('topmiles',  TopPilotData::top_pilot_miles($month, $year, 10));
        $this->render('toppilot/tp_previous');
    }
}

Link to comment
Share on other sites

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...