Added collection cost statistic
This commit is contained in:
parent
eafb2b386f
commit
1579666db4
1 changed files with 18 additions and 0 deletions
18
src/main.py
18
src/main.py
|
|
@ -139,6 +139,24 @@ def get_amount_of_games(query: BoardgameFilterParams = Depends(), session: Sessi
|
|||
|
||||
return statistic_to_return
|
||||
|
||||
@app.get('/statistics/total_collection_cost', response_model=statistic_classes.NumberStatistic)
|
||||
def get_total_collection_cost(query: BoardgameFilterParams = Depends(), session: Session = Depends(get_session)):
|
||||
|
||||
owned_collection = data_connection.get_user_owned_collection(session)
|
||||
|
||||
owned_collection = query.do_filtering(owned_collection)
|
||||
|
||||
total_cost = sum([boardgame.price_paid for boardgame in owned_collection])
|
||||
|
||||
statistic_dict = {
|
||||
"name":"Total cost of the owned collection",
|
||||
"result":total_cost
|
||||
}
|
||||
|
||||
statistic_to_return = statistic_classes.NumberStatistic(**statistic_dict)
|
||||
|
||||
return statistic_to_return
|
||||
|
||||
@app.get('/statistics/amount_of_games_over_time', response_model=statistic_classes.TimeLineStatistic)
|
||||
def get_amount_of_games_over_time(query: BoardgameFilterParams = Depends(), day_step: int = 1, filter_expansions_out: bool = False, only_expansions: bool = False, session: Session = Depends(get_session)):
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue