Author Topic: [VAM2.6.2] Pilot rank is not calculated correctly  (Read 1819 times)

Timothee

  • Jr. Member
  • **
  • Posts: 94
    • View Profile
[VAM2.6.2] Pilot rank is not calculated correctly
« on: December 12, 2016, 09:17:56 AM »
Hey

In review_pilot_rank.php you refer to the view v_top_hours for calculating the new rank. Unfortunately the view only contains the top 5 pilots. Any pilot not listed there will not get a new rank even if he has enough hours.
I replaced the SQL statements as followed. But maybe you see a better solution or like to solve it differentely:
Code: [Select]
if ($no_count_rejected==1)
{
  $sql = "select pilot, rank_id, round(sum(time),2) + g.transfered_hours as total_time from v_total_data_flight v inner join gvausers g on g.gvauser_id = v.pilot where id_flight is not null and status<>2 group by pilot order by total_time desc";
}
else
{
  $sql = "select pilot, rank_id, round(sum(time),2) + g.transfered_hours as total_time from v_total_data_flight v inner join gvausers g on g.gvauser_id = v.pilot where id_flight is not null group by pilot order by total_time desc";
}

VAM

  • Administrator
  • Hero Member
  • *****
  • Posts: 1328
    • View Profile
    • virtual Airlines Manager
Re: [VAM2.6.2] Pilot rank is not calculated correctly
« Reply #1 on: December 12, 2016, 09:06:48 PM »
Hey

In review_pilot_rank.php you refer to the view v_top_hours for calculating the new rank. Unfortunately the view only contains the top 5 pilots. Any pilot not listed there will not get a new rank even if he has enough hours.
I replaced the SQL statements as followed. But maybe you see a better solution or like to solve it differentely:
Code: [Select]
if ($no_count_rejected==1)
{
  $sql = "select pilot, rank_id, round(sum(time),2) + g.transfered_hours as total_time from v_total_data_flight v inner join gvausers g on g.gvauser_id = v.pilot where id_flight is not null and status<>2 group by pilot order by total_time desc";
}
else
{
  $sql = "select pilot, rank_id, round(sum(time),2) + g.transfered_hours as total_time from v_total_data_flight v inner join gvausers g on g.gvauser_id = v.pilot where id_flight is not null group by pilot order by total_time desc";
}

Thanks for that, I will include your fix in HF 03
VAM Creator and programmer.

OAV001

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
    • Open Air Virtual
Re: [VAM2.6.2] Pilot rank is not calculated correctly
« Reply #2 on: December 13, 2016, 08:45:28 AM »
Don't forget to change line 33 as well:

it reads:

Code: [Select]
while ($row = $result->fetch_assoc()) {
$pilot = $row['gvauser_id'];

Change to:

while ($row = $result->fetch_assoc()) {
$pilot = $row['pilot'];

Just my 2 cents :-)

Cheers,

Peter
Cheers,

Peter Faase
CEO / Webmaster Open Air Virtual
http://www.openairvirtual.eu

Timothee

  • Jr. Member
  • **
  • Posts: 94
    • View Profile
Re: [VAM2.6.2] Pilot rank is not calculated correctly
« Reply #3 on: December 13, 2016, 05:27:27 PM »
Don't forget to change line 33 as well:

it reads:

Code: [Select]
while ($row = $result->fetch_assoc()) {
$pilot = $row['gvauser_id'];

Change to:

while ($row = $result->fetch_assoc()) {
$pilot = $row['pilot'];

Just my 2 cents :-)

Cheers,

Peter

Oh right of course, I did change it but somehow overlooked it when I posted it here. Thanks.

VAM

  • Administrator
  • Hero Member
  • *****
  • Posts: 1328
    • View Profile
    • virtual Airlines Manager
Re: [VAM2.6.2] Pilot rank is not calculated correctly
« Reply #4 on: December 15, 2016, 11:06:26 PM »
Thanks guys! I will integarte those changes in Hot Fix 03 + a couple more things. This week end will be released.
VAM Creator and programmer.

CYB4

  • Newbie
  • *
  • Posts: 14
    • View Profile
    • Cyber Air VA
Re: [VAM2.6.2] Pilot rank is not calculated correctly
« Reply #5 on: July 08, 2017, 09:05:50 AM »
Sorry, is this Hot Fix03 releases yet? I can't find it on the webpage.
Chris Schnaedelbach
CEO Cyber Air VA
www.cyber-air.com