-
Notifications
You must be signed in to change notification settings - Fork 29
first draft of adding graduates data endpoint #80
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
Merged
alexeygrigorev
merged 10 commits into
DataTalksClub:main
from
nilarte:add-graduates-datapoint
Aug 12, 2025
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9c4c0c5
first draft of adding graduates data endpoint
nilarte 9e3bfb7
worked on first batch of review comments
nilarte f852cdb
minor fixes
nilarte 44fdad2
fixed coureses variable fetching logic and minor fixes
nilarte 6facedc
removed unused import
nilarte cc41bb1
WIP: First draft of graduates data testcase
nilarte 2a984ee
fixed typo
nilarte a4dbab5
Add graduate data view test
nilarte 199363f
written test-cases for test_graduate_data_view
nilarte e55a813
merge
alexeygrigorev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -377,4 +377,79 @@ def test_project_submission_with_404_url(self): | |
commit_id="abcd1234", | ||
) | ||
with self.assertRaises(ValidationError): | ||
self.project_submission.full_clean() | ||
self.project_submission.full_clean() | ||
|
||
def test_graduate_data_view(self): | ||
"""Test that only students who passed enough projects are returned.""" | ||
|
||
self.course.min_projects_to_pass = 2 | ||
self.course.save() | ||
|
||
self.user.email = "[email protected]" | ||
self.user.save() | ||
self.enrollment.certificate_name = "Student One" | ||
self.enrollment.save() | ||
|
||
other_user = CustomUser.objects.create( | ||
username="student2", email="[email protected]", password="pass" | ||
) | ||
other_enrollment = Enrollment.objects.create( | ||
student=other_user, | ||
course=self.course, | ||
certificate_name="Student Two", | ||
) | ||
|
||
project1 = Project.objects.create( | ||
course=self.course, | ||
slug="project1", | ||
title="Project 1", | ||
description="Description", | ||
submission_due_date=timezone.now() + timezone.timedelta(days=7), | ||
peer_review_due_date=timezone.now() + timezone.timedelta(days=14), | ||
) | ||
project2 = Project.objects.create( | ||
course=self.course, | ||
slug="project2", | ||
title="Project 2", | ||
description="Description", | ||
submission_due_date=timezone.now() + timezone.timedelta(days=7), | ||
peer_review_due_date=timezone.now() + timezone.timedelta(days=14), | ||
) | ||
|
||
ProjectSubmission.objects.create( | ||
project=project1, | ||
student=self.user, | ||
enrollment=self.enrollment, | ||
github_link="https://httpbin.org/status/200", | ||
commit_id="1111", | ||
passed=True, | ||
) | ||
ProjectSubmission.objects.create( | ||
project=project2, | ||
student=self.user, | ||
enrollment=self.enrollment, | ||
github_link="https://httpbin.org/status/200", | ||
commit_id="2222", | ||
passed=True, | ||
) | ||
ProjectSubmission.objects.create( | ||
project=project1, | ||
student=other_user, | ||
enrollment=other_enrollment, | ||
github_link="https://httpbin.org/status/200", | ||
commit_id="3333", | ||
passed=True, | ||
) | ||
|
||
url = reverse( | ||
"data_graduates", | ||
kwargs={"course_slug": self.course.slug}, | ||
) | ||
response = self.client.get(url) | ||
|
||
self.assertEqual(response.status_code, 200) | ||
actual_result = response.json() | ||
|
||
self.assertEqual(len(actual_result), 1) | ||
self.assertEqual(actual_result[0]["email"], self.user.email) | ||
self.assertEqual(actual_result[0]["name"], self.enrollment.certificate_name) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.