-
Notifications
You must be signed in to change notification settings - Fork 303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Unit Variable to ExerciseLog Export #2958
Added Unit Variable to ExerciseLog Export #2958
Conversation
@@ -245,6 +245,31 @@ def alter_list_data_to_serialize(self, request, to_be_serialized): | |||
attempt_logs = AttemptLog.objects.filter(user=user, exercise_id=bundle.data["exercise_id"], context_type__in=["playlist", "exercise"]) | |||
bundle.data["timestamp_first"] = attempt_logs.count() and attempt_logs.aggregate(Min('timestamp'))['timestamp__min'] or None | |||
bundle.data["timestamp_last"] = attempt_logs.count() and attempt_logs.aggregate(Max('timestamp'))['timestamp__max'] or None | |||
bundle.data["unit"] = 0 | |||
current_unit = get_current_unit_settings_value(user.facility.id) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
1ed2c61
to
30758b4
Compare
bundle.data["unit"] = 0 | ||
|
||
if bundle.data["timestamp_first"]: | ||
for i in xrange(101,104): |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
else: | ||
bundle.data["unit"] = i + 1 | ||
|
||
if bundle.data["unit"] == 0 and bundle.data["timestamp_first"].date() > date(2014, 11, 15): |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Atleast for the entries we are sure about unit, let assign them the unit variable and keep others as 0. If the unit variable is 101-104 then its displaying the correct unit as per our prediction. But if the unit variable is 0 then we are not sure about the unit, 99% chances are that the unit is the current_unit. As we can't predict the current unit on the central server, its better to have the value as 0 and let the coaches know that it is most probably the current unit number. |
This should work for the majority of needed cases, so let's get it merged for now, and we can refine later. |
Added Unit Variable to ExerciseLog Export
Fixes #2947