Previous code always returned 0 as we should check the state column instead of the status one.
Use the SQL AVG function to simplify the code. Also limit the request to the latest 100 pireps to prevent overloading the database for pilots with too many pireps.
Previous code always returned 0 as we should check the
state
column instead of thestatus
one.Use the SQL
AVG
function to simplify the code. Also limit the request to the latest 100 pireps to prevent overloading the database for pilots with too many pireps.