Administrators simpilot Posted August 31, 2015 Author Administrators Report Posted August 31, 2015 Looks like you have a server using php 5.4 or newer. You will have to change public function get_stats_by_cur_month() to public static function get_stats_by_cur_month() Quote
spal Posted December 6, 2015 Report Posted December 6, 2015 I need your help guys!! I use the below code for the landing statistics, in order to show only landing below 200ft/min, but I want to exclude landings with rate lower than -100ft/min. How can I do that? ----------------- class TouchdownStatsData extends CodonData { public static function get_all_stats() { $query = "SELECT pilotid, code, flightnum, depicao, arricao, aircraft, landingrate, submitdate FROM `".TABLE_PREFIX."pireps` WHERE landingrate > '-200' ORDER BY landingrate DESC"; return DB::get_results($query); } --------------------- Quote
ARV187 Posted December 6, 2015 Report Posted December 6, 2015 There are a command, is Between if I dont remember bad. WHERE landingrate BETWEEN -200 AND -100; Quote
spal Posted December 6, 2015 Report Posted December 6, 2015 On 12/6/2015 at 3:36 PM, ARV187 said: There are a command, is Between if I dont remember bad. WHERE landingrate BETWEEN -200 AND -100; Thank you ARV187, it works like a charm..!! Quote
flyalaska Posted January 8, 2016 Report Posted January 8, 2016 How can I display pilots Best landing and pilots worst landing for public and private profile? Quote
Administrators simpilot Posted January 9, 2016 Author Administrators Report Posted January 9, 2016 You would have to write something for that specifically, there are a couple of pilot specific functions available already -> https://github.com/D...a.class.php#L58 Quote
DanishFlipper Posted July 22, 2016 Report Posted July 22, 2016 Hello Guys, I need help about this module here .. On the attatced link, you can see that i was able to get the text blue, but what i want is to have the background where there are written Pilot, Aircraft an that stuff to be blue an the text a bite larger, can anyone tell me how to do that? http://prntscr.com/bw735y Quote
ncd200 Posted December 11, 2016 Report Posted December 11, 2016 On 1/5/2011 at 12:17 PM, MrAmsterdam said: Hey Simpilot, I was wondering if it's possible to show the average landingrate for the year 2010 and for this year, 2011 ? All the best wishes by the way!! Regards Lucas When I want to show the airline average landing rate it only shows the text NaN. I use phpvms 5.5. Aoed anyobe know how to fix this? Rick Quote
TAV1702 Posted December 12, 2016 Report Posted December 12, 2016 (edited) On 12/11/2016 at 3:54 PM, ncd200 said: When I want to show the airline average landing rate it only shows the text NaN. I use phpvms 5.5. Does anyone know how to fix this? Rick <?php echo ''.round(TouchdownStatsData::airline_average('airline'), 0); ?> Edited December 12, 2016 by TAV1702 Quote
LH154 Posted June 4, 2017 Report Posted June 4, 2017 Hello together, unfortunately I get see link: http://stuttgart-airlines-va.com/index.php/TouchdownStats This error. can someone help me? THX Quote
Moderators ProSkyDesign Posted June 5, 2017 Moderators Report Posted June 5, 2017 On 6/4/2017 at 8:26 AM, LH154 said: Hello together, unfortunately I get see link: http://stuttgart-airlines-va.com/index.php/TouchdownStats This error. can someone help me? THX Expand Hi, which error did you have? Quote
thefiercepilot Posted December 3, 2017 Report Posted December 3, 2017 Guys I have totally lost it! I cannot find the exact code for average landing rate using this addon. Can someone provide me with the exact code or give me a link to the exact page? Thanks Quote
Moderators servetas Posted December 3, 2017 Moderators Report Posted December 3, 2017 Which average value do you want? Airline average? Pilot Average? What is the period of the calculation? Alltime airline average for example? Quote
thefiercepilot Posted December 3, 2017 Report Posted December 3, 2017 Yes Pilot average for alltime landing rate Quote
thefiercepilot Posted December 3, 2017 Report Posted December 3, 2017 (edited) I tried some code but got this : Fatal error: Cannot redeclare TouchdownStatsData::pilot_stats() in /storage/ssd5/341/1107341/public_html/core/common/TouchdownStatsData.class.php on line 99 I had used: public function pilot_stats($pilotid) { $query = "SELECT pilotid, code, flightnum, depicao, arricao, aircraft, landingrate, submitdate FROM `".TABLE_PREFIX."pireps` WHERE landingrate < '0' AND pilotid = '$pilotid' ORDER BY landingrate DESC"; return DB::get_results($query); } public function pilot_average($pilotid) { $stats = self::pilot_stats($pilotid); $total = 0; $count = 0; foreach ($stats as $stat) { $total = $total + $stat->landingrate; $count++; } $average = $total / $count; return $average; } public function airline_average() { $stats = self::get_all_stats(); $total = 0; $count = 0; foreach ($stats as $stat) { $total = $total + $stat->landingrate; $count++; } $average = $total / $count; return $average; } I'm sure I'm not redeclaring @servetas Edited December 3, 2017 by thefiercepilot Quote
Guest lorathon Posted December 3, 2017 Report Posted December 3, 2017 public static function get_landing_average($pilotid) { $sql = 'SELECT (SUM(landingrate) / COUNT(pirepid)) as avg FROM `' . TABLE_PREFIX . 'pireps` WHERE landingrate < 0 AND pilotid = ' . $pilotid . ' ORDER BY landingrate DESC'; $res = DB::get_row($sql); return $res->avg; } Use the above and let MySql do the work. No need to pull all the extra data not loop through the results.. The error you are getting is coming from redeclaring the same method twice Quote Cannot redeclare TouchdownStatsData::pilot_stats() Expand Quote
thefiercepilot Posted December 4, 2017 Report Posted December 4, 2017 On 12/3/2017 at 5:40 PM, lorathon said: public static function get_landing_average($pilotid) { $sql = 'SELECT (SUM(landingrate) / COUNT(pirepid)) as avg FROM `' . TABLE_PREFIX . 'pireps` WHERE landingrate < 0 AND pilotid = ' . $pilotid . ' ORDER BY landingrate DESC'; $res = DB::get_row($sql); return $res->avg; } Expand @lorathon 2 things- Where do I put this code Which variable contains the pilot's individual landing rate? I'm guessing it's $res->avg? Quote
Guest lorathon Posted December 4, 2017 Report Posted December 4, 2017 You should but this into a class file under common. Doesn't matter where but it should be logical. Perhaps make your own class file. And the method returns the average as a double/float. No need to add a parameter. $avg = self::get_landing_avgerage($pilotid); echo $avg; Change the "self" to the name of the class file. Quote
Thomasha Posted February 23, 2018 Report Posted February 23, 2018 (edited) Hello Guys, I want to show the top 10 average of our VA... Any idea? Edited February 23, 2018 by Thomasha Quote
GKT001 Posted January 14, 2020 Report Posted January 14, 2020 In the average landing calculation, I want the pilot to have at least 50 flights and enter the account list. With 1 flight going into the list. How can I do that ? Quote
md82 Posted September 5, 2021 Report Posted September 5, 2021 (edited) Hello, I would like to display the smoothest landing ever in a field on my stats page. Does anyone know how? This one is working to show the VAs average landing rate: <?php echo ''.round(TouchdownStatsData::airline_average('airline'), 0); ?> How can I modify it to show the best landing rate? Thanks Edited September 5, 2021 by md82 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.