-
Notifications
You must be signed in to change notification settings - Fork 14
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: [AXM-297] Add progress to assignments in BlocksInfoInCourseView API #2546
feat: [AXM-297] Add progress to assignments in BlocksInfoInCourseView API #2546
Conversation
from openedx.core.djangoapps.content.block_structure.api import get_block_structure_manager | ||
|
||
|
||
def calculate_progress(user, course_id, cache_timeout): |
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.
Could you add typing here?
""" | ||
Extends sequential xblock info with assignment's name and progress. | ||
""" | ||
subsection_grades = calculate_progress(requested_user, course_id, BLOCK_STRUCTURE_CACHE_TIMEOUT) |
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.
Probably it could be wrapped in the try except with potential log to debug 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.
Yes, I wrapped into try except calculate_progress
function's logic in utils file
if grade: | ||
points_earned = ( | ||
grade.graded_total.earned | ||
if grades_with_locations[block_id].graded | ||
else 0 | ||
) | ||
points_possible = ( | ||
grade.graded_total.possible | ||
if grades_with_locations[block_id].graded | ||
else 0 | ||
) | ||
assignment_type = grade.format | ||
else: | ||
points_earned, points_possible = 0, 0 | ||
assignment_type = None |
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.
if grade: | |
points_earned = ( | |
grade.graded_total.earned | |
if grades_with_locations[block_id].graded | |
else 0 | |
) | |
points_possible = ( | |
grade.graded_total.possible | |
if grades_with_locations[block_id].graded | |
else 0 | |
) | |
assignment_type = grade.format | |
else: | |
points_earned, points_possible = 0, 0 | |
assignment_type = None | |
if grade: | |
graded_total = grade.graded_total if grade.graded else None | |
points_earned = graded_total.earned if graded_total else 0 | |
points_possible = graded_total.possible if graded_total else 0 | |
assignment_type = grade.format | |
else: | |
points_earned, points_possible, assignment_type = 0, 0, None |
Please, check if this fits to improve readability
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.
Yes, it's more readable and works correctly. I took these changes
8afbc54
into
glugovgrglib/add_course_access_to_mobile_info_api
… API (#2546) * feat: [AXM-297, AXM-310] Add progress to assignments and total course progress * feat: [AXM-297] Add progress to assignments * style: [AXM-297] Try to fix linters (add docstrings) * refactor: [AXM-297] Add typing, refactor methods
… API (#2546) * feat: [AXM-297, AXM-310] Add progress to assignments and total course progress * feat: [AXM-297] Add progress to assignments * style: [AXM-297] Try to fix linters (add docstrings) * refactor: [AXM-297] Add typing, refactor methods
… API (#2546) * feat: [AXM-297, AXM-310] Add progress to assignments and total course progress * feat: [AXM-297] Add progress to assignments * style: [AXM-297] Try to fix linters (add docstrings) * refactor: [AXM-297] Add typing, refactor methods
… API (#2546) * feat: [AXM-297, AXM-310] Add progress to assignments and total course progress * feat: [AXM-297] Add progress to assignments * style: [AXM-297] Try to fix linters (add docstrings) * refactor: [AXM-297] Add typing, refactor methods
… API (#2546) * feat: [AXM-297, AXM-310] Add progress to assignments and total course progress * feat: [AXM-297] Add progress to assignments * style: [AXM-297] Try to fix linters (add docstrings) * refactor: [AXM-297] Add typing, refactor methods
… API (#2546) * feat: [AXM-297, AXM-310] Add progress to assignments and total course progress * feat: [AXM-297] Add progress to assignments * style: [AXM-297] Try to fix linters (add docstrings) * refactor: [AXM-297] Add typing, refactor methods
… API (#2546) * feat: [AXM-297, AXM-310] Add progress to assignments and total course progress * feat: [AXM-297] Add progress to assignments * style: [AXM-297] Try to fix linters (add docstrings) * refactor: [AXM-297] Add typing, refactor methods
… API (#2546) * feat: [AXM-297, AXM-310] Add progress to assignments and total course progress * feat: [AXM-297] Add progress to assignments * style: [AXM-297] Try to fix linters (add docstrings) * refactor: [AXM-297] Add typing, refactor methods
… API (#2546) * feat: [AXM-297, AXM-310] Add progress to assignments and total course progress * feat: [AXM-297] Add progress to assignments * style: [AXM-297] Try to fix linters (add docstrings) * refactor: [AXM-297] Add typing, refactor methods
… API (#2546) * feat: [AXM-297, AXM-310] Add progress to assignments and total course progress * feat: [AXM-297] Add progress to assignments * style: [AXM-297] Try to fix linters (add docstrings) * refactor: [AXM-297] Add typing, refactor methods
…urses on dashboard view (openedx#34848) * feat: [AXM-24] Update structure for course enrollments API (#2515) --------- Co-authored-by: Glib Glugovskiy <[email protected]> * feat: [AXM-53] add assertions for primary course (#2522) --------- Co-authored-by: monteri <[email protected]> * feat: [AXM-297] Add progress to assignments in BlocksInfoInCourseView API (#2546) --------- Co-authored-by: NiedielnitsevIvan <[email protected]> Co-authored-by: Glib Glugovskiy <[email protected]> Co-authored-by: monteri <[email protected]>
Description
Add
assignments_progress
field to sequential info in BlocksInfoInCourseView API.YouTrack
https://youtrack.raccoongang.com/issue/AXM-297