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

feat: add fields parent_content_key and is_assigned_course_run for assignments #549

Merged
merged 2 commits into from
Sep 4, 2024

Conversation

adamstankiewicz
Copy link
Member

@adamstankiewicz adamstankiewicz commented Aug 30, 2024

Description:

  • Adds 2 model fields to LearnerContentAssignment:
    • parent_content_key. This will represent a top-level course key when the assignment's content_key is a course run. Otherwise, None.
    • is_assigned_course_run. This will indicate whether the assignment is course run-based or course-based.
  • Serializes the 2 new fields parent_content_key and is_assigned_course_run in API responses.
  • Displays is_assigned_course_run as a read-only field in Django Admin.
  • Implements helper method _get_parent_content_key to return either a course run's parent course's content_key or None if the provided content_key is already a course run.
  • Updates assignment allocation to pass parent_content_key and is_assigned_course_run during assignment object creation.

Jira:
ENT-8876

Merge checklist:

  • ./manage.py makemigrations has been run
    • Note: This must be run if you modified any models.
      • It may or may not make a migration depending on exactly what you modified, but it should still be run.

Post merge:

  • Ensure that your changes went out to the stage instance
  • Deploy to prod instance

@adamstankiewicz adamstankiewicz marked this pull request as draft August 30, 2024 20:14
@adamstankiewicz adamstankiewicz force-pushed the ags/ent-8876 branch 2 times, most recently from c04bfd5 to 467ff12 Compare September 3, 2024 16:48
Comment on lines +34 to +38
migrations.AlterField(
model_name='historicallearnercontentassignment',
name='allocated_at',
field=models.DateTimeField(blank=True, default=django.utils.timezone.now, help_text='The last time the assignment was allocated. Cannot be null.'),
),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[inform] This migration is unrelated to changes I made in this PR; seems like it's a migration that was missing (i.e., auto-generated during makemigrations).

preferred_course_run_key = _get_preferred_course_run_key(assignment_configuration, content_key)
is_assigned_course_run = bool(parent_content_key)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[inform] Uses a non-null parent_content_key to determine whether the assignment is run-based.

@adamstankiewicz adamstankiewicz marked this pull request as ready for review September 3, 2024 16:56
Copy link
Contributor

@brobro10000 brobro10000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍🏽

Copy link
Contributor

@iloveagent57 iloveagent57 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, couple tiny suggestions!

enterprise_access/apps/content_assignments/api.py Outdated Show resolved Hide resolved
@adamstankiewicz adamstankiewicz merged commit aec0b74 into main Sep 4, 2024
3 checks passed
@adamstankiewicz adamstankiewicz deleted the ags/ent-8876 branch September 4, 2024 16:39
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