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: support course run based assignments in credits_available, expiration, emails, etc. #561

Merged
merged 9 commits into from
Sep 12, 2024

Conversation

adamstankiewicz
Copy link
Member

@adamstankiewicz adamstankiewicz commented Sep 10, 2024

Description:

Relying on the update to enterprise-catalog's get_content_metadata REST API to return the top-level course object when passing course run key(s) to the ?content_keys query parameter and the addition of normalized_metadata_by_run, this PR updates the get_content_metadata_for_assignments method and where it's consumed to support credits_available, expiration management commands, and email notifications related to assignments.

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 force-pushed the ags/ent-8876-pt2 branch 3 times, most recently from bd10ac0 to 628233f Compare September 10, 2024 21:44
Comment on lines 30 to 34
if is_assigned_course_run:
metadata_by_key[assignment_content_key] = course_metadata
else:
# if not is_assigned_course_run, we can assume it's a (legacy) course-based assignment
metadata_by_key[course_key] = course_metadata
Copy link
Contributor

Choose a reason for hiding this comment

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

Aren't these still the same logic in each block? If the assignment is a legacy assignment, then course_key is equivalent to assignment_content_key, is it not?

Suggested change
if is_assigned_course_run:
metadata_by_key[assignment_content_key] = course_metadata
else:
# if not is_assigned_course_run, we can assume it's a (legacy) course-based assignment
metadata_by_key[course_key] = course_metadata
metadata_by_key[assignment_content_key] = course_metadata

Copy link
Member Author

Choose a reason for hiding this comment

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

@pwnage101 Ahhh, I understand now; you're absolutely correct. I pushed another commit 91ac3ab with a refactor. Let me know what you think!

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] @pwnage101 I updated once more in cb9d27b.

Copy link
Contributor

@pwnage101 pwnage101 left a comment

Choose a reason for hiding this comment

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

Just nits for the rest!

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.

Looks great overall! Couple small things we could simplify.

enterprise_access/utils.py Show resolved Hide resolved
@adamstankiewicz adamstankiewicz merged commit 16e2f11 into main Sep 12, 2024
3 checks passed
@adamstankiewicz adamstankiewicz deleted the ags/ent-8876-pt2 branch September 12, 2024 14:29
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