PIAS2011 Posted October 12, 2011 Report Posted October 12, 2011 Did you try to populate the database again after changing the table prefix? If so, is there anything in the new top_pilots table? If there is, do a print_r or var_dump in the template for the variable and see what comes out. That will show if there is any data available and guide you on where to look for the problem. Nothing there it's empty Quote
Administrators simpilot Posted October 12, 2011 Author Administrators Report Posted October 12, 2011 Nothing there it's empty Whats empty.... The new table, the var_dump, the print_r, your pireps table? Quote
PIAS2011 Posted October 13, 2011 Report Posted October 13, 2011 . The new table, the var_dump, the print_r Quote
druptown Posted February 7, 2012 Report Posted February 7, 2012 Not exactly sure what you are asking but I think you are asking if the counts are made before or after the PIREP is accepted. The module currently counts all PIREPS that are pending or approved, the instructions and consequences are in the initial post of this thread. I'm having some doubts about what to change so it does only count accepted pireps $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++;} } } My guess is that it has something to do with "/* && $pirep->accepted == 1 */". You said to change something on line 52 but that is an empty line in my toppilot.php Quote
Administrators simpilot Posted February 8, 2012 Author Administrators Report Posted February 8, 2012 Remove the /* and the */ comment marks from that line and it will not add the PIREP when it is submitted by the pilot. I am rewriting this module now anyway as it has started to create issues for sites that have a large amount (10k +) and timeouts. Quote
druptown Posted February 11, 2012 Report Posted February 11, 2012 Dave, Found it. I have changed line 60 of toppilot.php into regards, Cor I've added this piece of code and the problem is almost fixed, but the times are still off. It works for calculating the hours and minutes correctly, but it forgets the seconds in the pireps flight time. They are not added.... which results in 5 min difference on 10 flights allready. Quote
druptown Posted February 12, 2012 Report Posted February 12, 2012 I've also noticed that when I uncomment the line to make the script look at accepted pireps only, the script doesn't work automatic anymore. Quote
Administrators simpilot Posted February 12, 2012 Author Administrators Report Posted February 12, 2012 I've also noticed that when I uncomment the line to make the script look at accepted pireps only, the script doesn't work automatic anymore. Are looking prior to anopther PIREP being accepted? Excluding PIREPS that are not accepted yet. TopPilot.php line 52. Uncomment the trailing section and the module will not include unapproved PIREPS. Doing this will cause the module not to display any newly accepted PIREPS in the TopPilot data listings until after another PIREP is filed although you can refresh the stats at anytime using yoursite/index.php/TopPilot/refresh_pilot_stats Using this method the PIREP will not be included in the stats until another one is accepted. Quote
druptown Posted February 12, 2012 Report Posted February 12, 2012 so the stats are always 1 pirep late that way? Quote
Administrators simpilot Posted February 14, 2012 Author Administrators Report Posted February 14, 2012 so the stats are always 1 pirep late that way? Simple answer, yes. There is currently no admin side controller for this module so there is no way to catch the PIREP Approved event from that side. You could write an admin side module to read that event and then do the necesarry calculations. Quote
druptown Posted February 14, 2012 Report Posted February 14, 2012 I've added this piece of code and the problem is almost fixed, but the times are still off. It works for calculating the hours and minutes correctly, but it forgets the seconds in the pireps flight time. They are not added.... which results in 5 min difference on 10 flights allready. Any updates on the monthly stats not showing correcly? It seems that Util::date can't handle the seconds. We 've got an difference of 7 minutes allready with 45h flown. It shows very hard now since it's our first month and the alltimesstats are shown above, that will get better next month. But still, I'm a perfectionist and like things to be correct. Quote
mt007 Posted April 21, 2012 Report Posted April 21, 2012 Hi guys, i have this problem: When i click in Airline Stats-Top Pilots, we see php file. See my VA website here Any idea why this happen? Thx very much. King regards. Miguel Quote
mt007 Posted April 28, 2012 Report Posted April 28, 2012 Hi, anyone can help? My last message. Thx Quote
Administrators simpilot Posted May 2, 2012 Author Administrators Report Posted May 2, 2012 Thats odd, have you downloaded the files and installed them into your system? It almost looks like you have put a link to the GitHub account in the page. Quote
mt007 Posted May 2, 2012 Report Posted May 2, 2012 Hi, i have make all what explain inside toppilot package. But i dont know why we see that. Any idea? Thx Regards Quote
Administrators simpilot Posted May 7, 2012 Author Administrators Report Posted May 7, 2012 Try deleteing the module and downloading a fresh copy and reinstalling. I am not sure what you have going on. Quote
mt007 Posted May 7, 2012 Report Posted May 7, 2012 Hi, i have done that and work. I have put sopy files out of original folders. But noe i have this problem: In this month, May, i have done 2 flights but dot apear in list. Only this info: No Pireps Filed For May 2012 Is not possible. Because i have done 2 flights. Any idea? Thx very much. King regards. Quote
Administrators simpilot Posted May 8, 2012 Author Administrators Report Posted May 8, 2012 Did you run the script to populate the database to start? Have you filed any PIREPS since installing the module to automatically run the script to populate the table? Quote
mt007 Posted May 8, 2012 Report Posted May 8, 2012 Yes, i have run script. Filed pirep? I have used kAcars to make my flights. I have make 2 flights after install script but May i dont see nothing. Thx Regards Quote
Administrators simpilot Posted May 8, 2012 Author Administrators Report Posted May 8, 2012 Did you install the database file? If so, is there any data in it? Quote
mt007 Posted May 8, 2012 Report Posted May 8, 2012 Hi, yes i do. Yes there was some data. id pilot_id flights hours miles month year 1 104 1 1 491 4 2012 2 105 2 1 402 4 2012 3 106 4 5 1316 4 2012 4 117 4 1 44 4 2012 5 106 1 1 257 5 2012 6 117 2 1 22 5 2012 Any idea? Thx Quote
Administrators simpilot Posted May 8, 2012 Author Administrators Report Posted May 8, 2012 Have you changed your database tables prefix from the default "phpvms_"? I am thinking Yes. In /core/common/TopPilotData.class.php file change line 15 from query = "SELECT * FROM phpvms_pireps WHERE MONTH(submitdate) = '$month' AND YEAR(submitdate) = '$year'"; to query = "SELECT * FROM ".TABLE_PREFIX."pireps WHERE MONTH(submitdate) = '$month' AND YEAR(submitdate) = '$year'"; I have updated the code on github. Quote
mt007 Posted May 8, 2012 Report Posted May 8, 2012 Hi, you have an erro in code: query = "SELECT * FROM ".TABLE_PREFIX.'pireps WHERE MONTH(submitdate) = '$month' AND YEAR(submitdate) = '$year'"; The right code is: $query = "SELECT * FROM .TABLE_PREFIX.'pireps WHERE MONTH(submitdate) = '$month' AND YEAR(submitdate) = '$year'"; Now work wonderful. Thx very much for you help. One doubt please: I have this in airline stats: Total Fuel Burned: 31782.3054199219 How i can see less numbers? Regards. Quote
Administrators simpilot Posted May 9, 2012 Author Administrators Report Posted May 9, 2012 One doubt please: I have this in airline stats: Total Fuel Burned: 31782.3054199219 How i can see less numbers? http://php.net/manual/en/function.round.php Quote
mt007 Posted May 9, 2012 Report Posted May 9, 2012 Sorry Dave, but i dont understand nothing what do you have show me. Can you explain please? Thx. Regards Quote
Administrators simpilot Posted May 11, 2012 Author Administrators Report Posted May 11, 2012 Use the php round function to reduce the number of decimal places. echo round($my_variable); will give you no decimal places echo round($my_variable, 2); will give you 2 decimal places, and so on. You can also use the number format function if you want to add thousands seperators and such. http://php.net/manual/en/function.number-format.php Quote
mt007 Posted May 11, 2012 Report Posted May 11, 2012 Hy Dave, where i find that code? Thx. Regards Quote
XANDERER Posted May 27, 2012 Report Posted May 27, 2012 "Download the attached package" ok nice, where is it ? Quote
Administrators simpilot Posted May 28, 2012 Author Administrators Report Posted May 28, 2012 Code hosted on Github - Link In Signature. Quote
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.