Skip to content

Commit

Permalink
Reverted back dates filters and added the order by date.
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslanbaidan committed Mar 26, 2024
1 parent 11adbf6 commit b91ce72
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions admin/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ def results_stats(request):
start_date = dates_limit_form.fields["start_date"].initial
end_date = dates_limit_form.fields["end_date"].initial
# overwrite values coming from the POST:
start_date = datetime.datetime.fromtimestamp(0)
end_date = datetime.datetime.now()
# start_date = datetime.datetime.fromtimestamp(0)
# end_date = datetime.datetime.now()
result = get_finished_surveys_list(start_date, end_date)
context = {
"dates_limit_form": dates_limit_form,
Expand Down
4 changes: 2 additions & 2 deletions stats/stats_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def get_finished_surveys_list(start_date, end_date):
status=SURVEY_STATUS_FINISHED,
updated_at__gte=start_date.strftime(DEFAULT_DATE_FORMAT),
updated_at__lte=end_date.strftime(DEFAULT_DATE_FORMAT),
)
).order_by("updated_at")

total_questions_score = 1
max_evaluations_per_section = {}
Expand Down Expand Up @@ -127,7 +127,7 @@ def get_finished_surveys_list(start_date, end_date):
answer_score * 100 / user_answer.answer.question.maxPoints
)
surveys_users_results["survey_users"][user_id]["sections"][section_id][
"score"
"score"
] += round(answer_score * 100 / max_evaluations_per_section[section_id])

surveys_users_results["survey_users"][user_id]["details"][
Expand Down

0 comments on commit b91ce72

Please sign in to comment.