Remove redundant "total" from totals
This commit is contained in:
parent
cbd6e2beb5
commit
b7610e9b6f
@ -47,16 +47,16 @@ async def retrieve_totals(user: str, start_date: datetime = None, end_date: date
|
|||||||
{"$match": match},
|
{"$match": match},
|
||||||
{"$group": {
|
{"$group": {
|
||||||
"_id": None,
|
"_id": None,
|
||||||
"total_time": {"$sum": "$time_total"},
|
"time_total": {"$sum": "$time_total"},
|
||||||
"total_solo": {"$sum": "$time_solo"},
|
"time_solo": {"$sum": "$time_solo"},
|
||||||
"total_night": {"$sum": "$time_night"},
|
"time_night": {"$sum": "$time_night"},
|
||||||
"total_pic": {"$sum": "$time_pic"},
|
"time_pic": {"$sum": "$time_pic"},
|
||||||
"total_sic": {"$sum": "$time_sic"},
|
"time_sic": {"$sum": "$time_sic"},
|
||||||
"total_instrument": {"$sum": "$time_instrument"},
|
"time_instrument": {"$sum": "$time_instrument"},
|
||||||
"total_sim": {"$sum": "$time_sim"},
|
"time_sim": {"$sum": "$time_sim"},
|
||||||
"time_xc": {"$sum": "$time_xc"},
|
"time_xc": {"$sum": "$time_xc"},
|
||||||
"landings_day": {"$sum": "$takoffs_day"},
|
"landings_day": {"$sum": "$landings_day"},
|
||||||
"landings_night": {"$sum": "$takeoffs_nights"},
|
"landings_night": {"$sum": "$landings_night"},
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -71,12 +71,12 @@ async def retrieve_totals(user: str, start_date: datetime = None, end_date: date
|
|||||||
totals = result[0]
|
totals = result[0]
|
||||||
async for log in flight_collection.find({"user": ObjectId(user)}):
|
async for log in flight_collection.find({"user": ObjectId(user)}):
|
||||||
flight = FlightDisplaySchema(**flight_display_helper(log))
|
flight = FlightDisplaySchema(**flight_display_helper(log))
|
||||||
totals["total_xc_instr"] = totals.get("total_xc_instr", 0) + min(flight.time_xc, flight.dual_recvd)
|
totals["xc_dual_recvd"] = totals.get("xc_dual_recvd", 0) + min(flight.time_xc, flight.dual_recvd)
|
||||||
totals["total_xc_solo"] = totals.get("total_xc_solo", 0) + min(flight.time_xc, flight.time_solo)
|
totals["xc_solo"] = totals.get("xc_solo", 0) + min(flight.time_xc, flight.time_solo)
|
||||||
totals["total_xc_pic"] = totals.get("total_xc_pic", 0) + min(flight.time_xc, flight.time_pic)
|
totals["xc_pic"] = totals.get("xc_pic", 0) + min(flight.time_xc, flight.time_pic)
|
||||||
totals["total_night_dual_recvd"] = totals.get("total_night_dual_recvd", 0) + min(flight.time_night,
|
totals["night_dual_recvd"] = totals.get("night_dual_recvd", 0) + min(flight.time_night,
|
||||||
flight.dual_recvd)
|
flight.dual_recvd)
|
||||||
totals["total_night_pic"] = totals.get("total_night_pic", 0) + min(flight.time_night, flight.time_pic)
|
totals["night_pic"] = totals.get("night_pic", 0) + min(flight.time_night, flight.time_pic)
|
||||||
|
|
||||||
return totals
|
return totals
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user