-
Notifications
You must be signed in to change notification settings - Fork 3
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: GET allowances #288
feat: GET allowances #288
Conversation
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
3de7387
to
f45a61d
Compare
@@ -109,6 +109,7 @@ class CourseStaffRoleAdmin(admin.ModelAdmin): | |||
@admin.register(StudentAllowance) | |||
class StudentAllowanceAdmin(admin.ModelAdmin): | |||
""" Admin configuration for the Student Allowance model """ | |||
raw_id_fields = ('user', 'exam') |
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.
updated since the default (a dropdown) is unusable for this on prod/stage
course_id=self.course_id, | ||
) | ||
|
||
def request_api(self, method, user, course_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.
overbuilt in anticipation of post+delete endpoints
response = self.request_api('get', course_staff_user, self.course_id) | ||
self.assertEqual(response.status_code, 200) | ||
|
||
def test_get_allowances(self): |
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.
Should we have a DB query count check? I want to ensure this API only call DB once or twice, for even 1000 returned records.
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.
IMO we only need to check query counts if is there's something more interesting happening in the business logic or model that might hide DB issues. In this case it's a pretty straightforward use of .filter()
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.
👍
JIRA: COSMO-368
Description: Adds API to retrieve a list of allowances by course id
The story suggested using generic DRF views for this since there's no business logic. I tried that out but found would introduce a new pattern without making it much simpler really. It would also mess with our class for exception logging