Skip to content
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

Merged
merged 6 commits into from
Feb 12, 2015

Conversation

anuragkanungo
Copy link
Contributor

Fixes #2947

@@ -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.

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.

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.

@anuragkanungo
Copy link
Contributor Author

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.

@jamalex
Copy link
Member

jamalex commented Feb 12, 2015

This should work for the majority of needed cases, so let's get it merged for now, and we can refine later.

jamalex added a commit that referenced this pull request Feb 12, 2015
Added Unit Variable to ExerciseLog Export
@jamalex jamalex merged commit 61fb56b into learningequality:nalanda-rct3 Feb 12, 2015
@jamalex jamalex removed the has PR label Feb 12, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants