-
Notifications
You must be signed in to change notification settings - Fork 12
feat: add new field for Content-/UserDate models to support assignments #324
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
feat: add new field for Content-/UserDate models to support assignments #324
Conversation
|
Thanks for the pull request, @andrii-hantkovskyi! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
6857b51 to
582089c
Compare
e0d
left a comment
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'd like to discuss my questions before moving forward with this PR.
| name='first_component_block_id', | ||
| field=opaque_keys.edx.django.models.UsageKeyField(blank=True, db_index=True, max_length=255, null=True), | ||
| ), | ||
| migrations.AddField( |
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.
Why is it necessary to add this new field?
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 user_date_value field is currently unnecessary, removed.
| name='subsection_name', | ||
| field=models.CharField(blank=True, db_index=True, default='', max_length=255), | ||
| ), | ||
| migrations.AddField( |
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 believe this is the first instance of content data in the userdate model. Why do we need to introduce it here?
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 first_component_block_id field will be included in the response of the "all-course-dates" api endpoint.
Calculating this value in runtime is not trivial, and having it here on UserDate makes it much easier.
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.
Is this specific to the user or would it be the same for each ContentDate? How does it different or related to the location field in ContentDate.
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 field should not have a User-related context (unless I miss some business requirements) and must be placed in the ContentDate. I believe @e0d is totally right.
I want to perf-test the course info API w/ and w/o this field to check on the clear necessity to add it here.
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 location attribute on ContentDate is the key of the assignment block itself, and it is not user-specific.
The first_component_block_id attribute on UserDate is the key of the first unit of the block available to the user, which means it is user-specific.
Here is a possible scenario that may help explain it:
- We have a subsection with Unit 1 followed by Unit 2 followed by Unit 3.
- Two users - User A and User B - have access to this subsection as an assignment.
- However, User A belongs to a cohort that does not have access to Unit 1.
- In this case,
ContentDate.locationwill be the same for the two users (the subsection), butUserDate.first_component_block_idwill differ: Unit 1 for User B, but Unit 2 for User A.
That's the logic behind putting first_component_block_id on the UserDate model.
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.
Thanks. Should/can we rename the field name then (the current naming is really misleading)? To something like first_available_block_id.
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 don't think we should: this naming was not introduced by this PR - it is already used extensively throughout the codebase.
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.
@cmltaWt0 @e0d The following code should help clarify the meaning of first_component_block_id and why it is considered user-specific in the existing codebase. In the get_course_assignments() function we have these lines (abbreviated):
block_data = get_course_blocks(user, course_usage_key, allow_start_dates_in_future=True, include_completion=True)
...
for section_key in block_data.get_children(course_usage_key):
for subsection_key in block_data.get_children(section_key):
...
first_component_block_id = get_first_component_of_block(subsection_key, block_data)As we can see, the value of first_component_block_id is based on the course structure (block_data) - which is collected for a specfic user and only includes what they have access to.
| operations = [ | ||
| migrations.AddField( | ||
| model_name='contentdate', | ||
| name='assignment_title', |
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.
Assignment feels like a pretty robust concept, perhaps it should eventually be a new model entirely. How do we expect the assignment_title to be calculated?
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.
Hi, I'm stepping in for @andrii-hantkovskyi.
assignment_title is computed in the get_course_assignments() function, in a loop over course blocks:
title = block_data.get_xblock_field(subsection_key, 'display_name', _('Assignment'))
|
Checking in with a large site using edx_when, they have over 3M rows in edx_when_contentdate and around 43K in edx_when_userdate. We should consider this vis-a-via the migrations and approach to applying indices. |
@e0d Thank you for sharing this, we'll definitely take this into account. |
|
@e0d Hi! This PR has been updated and is now ready for another round of review. |
| name='subsection_name', | ||
| field=models.CharField(blank=True, db_index=True, default='', max_length=255), | ||
| ), | ||
| migrations.AddField( |
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 field should not have a User-related context (unless I miss some business requirements) and must be placed in the ContentDate. I believe @e0d is totally right.
I want to perf-test the course info API w/ and w/o this field to check on the clear necessity to add it here.
|
@e0d @cmltaWt0 |
|
Closing this as it's been replaced by #343 |
Description
Extends the
ContentDateandUserDatemodels inedx-whento support enhanced assignment metadata and future scheduling use cases.ContentDate model changes:
assignment_title,course_name, andsubsection_namefields to improve tracking and display of assignment metadata.UserDate model changes:
first_component_block_idfor referencing the starting block of a user’s assignment attempt.user_date_valueto explicitly store user-specific dates.