Skip to content

Commit

Permalink
add getSurveyMetric endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
jiji14 committed May 5, 2024
1 parent bc2d7b6 commit 675011d
Showing 1 changed file with 83 additions and 0 deletions.
83 changes: 83 additions & 0 deletions emission/net/api/cfc_webapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,89 @@ def getUserProfile():
user = User.fromUUID(user_uuid)
return user.getProfile()

@post('/get/metrics/survey')
def getSurveyMetric():
logging.debug("Called getServeyMetric")
# todo : calculate survey metric
dummy_survey_metric = {
'me': {
'overview': {
'answered': 5,
'unanswered': 5,
'mismatched': 0,
},
'rank' : 5, # 0-index
# for survey by trip cagetory
'details': {
'ev_roaming_trip': {
'answered': 10,
'unanswered': 5,
'mismatched': 0,
},
'ev_return_trip': {
'answered': 10,
'unanswered': 10,
'mismatched': 0,
},
'gas_car_trip': {
'answered': 5,
'unanswered': 10,
'mismatched': 0,
},
}
},
'others': {
'overview': {
'answered': 30,
'unanswered': 60,
'mismatched': 0,
},
'leaderboard': [
{
'answered': 10,
'unanswered': 0,
'mismatched': 0,
},
{
'answered': 9,
'unanswered': 1,
'mismatched': 0,
},
{
'answered': 8,
'unanswered': 2,
'mismatched': 0,
},
{
'answered': 7,
'unanswered': 3,
'mismatched': 0,
},
{
'answered': 6,
'unanswered': 4,
'mismatched': 0,
},
{
'answered': 4,
'unanswered': 6,
'mismatched': 0,
},
{
'answered': 2,
'unanswered': 8,
'mismatched': 0,
},
{
'answered': 1,
'unanswered': 9,
'mismatched': 0,
},
]
}
}
return dummy_survey_metric

@post('/result/metrics/<time_type>')
def summarize_metrics(time_type):
_fill_aggregate_backward_compat(request)
Expand Down

0 comments on commit 675011d

Please sign in to comment.