-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add tracking logs #1
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
base: open-release/maple.master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -5,6 +5,7 @@ | |||||||
|
|
||||||||
| from __future__ import absolute_import, division, print_function, unicode_literals | ||||||||
|
|
||||||||
| from eventtracking import tracker | ||||||||
| from opaque_keys.edx.django.models import CourseKeyField, UsageKeyField | ||||||||
| from opaque_keys.edx.keys import CourseKey, UsageKey | ||||||||
|
|
||||||||
|
|
@@ -171,8 +172,44 @@ def submit_completion(self, user, course_key, block_key, aggregation_name, earne | |||||||
| 'last_modified': last_modified, | ||||||||
| }, | ||||||||
| ) | ||||||||
| self.emit_completion_aggregator_logs([obj]) | ||||||||
|
|
||||||||
| return obj, is_new | ||||||||
|
|
||||||||
| @staticmethod | ||||||||
| def emit_completion_aggregator_logs(updated_aggregators): | ||||||||
| """ | ||||||||
| Emit a tracking log for each element of the list parameter. | ||||||||
|
|
||||||||
| Parameters | ||||||||
| ---------- | ||||||||
| updated_aggregators: List of Aggregator intances | ||||||||
|
|
||||||||
| """ | ||||||||
| for obj in updated_aggregators: | ||||||||
|
||||||||
| for aggregator in updated_aggregators: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand your concern and IMO it's much better aggregator however your argument is not valid since in other places is obj
| obj, is_new = self.update_or_create( |
| aggregation_data = [obj.get_values() for obj in updated_aggregators] |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesnt need anything change.
I mean this serializer is ok?
| percent = models.FloatField(validators=[validate_percent]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beetween [0,1]?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That method just validates the kind of event (progress or completion) the data that is sent must be as accurate as possible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea of this static method is to reuse the function class in whatever place?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method doesn't need the self(instance) or cls(class reference) therefore by definition it's a static method, so when I implemented that I didn't intend to create a function to be used in multiple places it's just a static method that could be used in other context