-
Notifications
You must be signed in to change notification settings - Fork 0
Dev #196
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
Merged
Dev #196
Changes from all commits
Commits
Show all changes
164 commits
Select commit
Hold shift + click to select a range
6c3bc55
feat: I add User avatar picture.
noyapoyo 158eb96
feat:api authentic方式改全域
chewinggum-master a527318
feat: add custom checker settings to Problems model and serializers
happylittle7 71d53b0
feat: update custom checker settings in Problems model and serializers
happylittle7 78c0ac5
feat: update checker_name logic to use custom checker conditionally
happylittle7 f028c26
Update problems/models.py help_text
happylittle7 d3d6509
Merge branch 'feat/problem-checker-field' of https://github.com/Spagh…
happylittle7 643d891
feat: add custom checker settings to ProblemStudentSerializer and API…
happylittle7 4f676db
feat: 移除 permission
ktyns71 bf9980f
Merge pull request #145 from Spaghetti-OJ/feat/problem-checker-field
RokuSennyou ffd1b8e
Merge pull request #146 from Spaghetti-OJ/problem_API_Permission
RokuSennyou 567bc58
feat: add management commands and seed data script for database initi…
happylittle7 bef3afe
feat: simplify user creation in seed_minimal and seed_full methods
happylittle7 2c2574d
Merge pull request #148 from Spaghetti-OJ/feat/add-mock-data
happylittle7 e114162
feat: add submission results creation and output/error message genera…
happylittle7 4d49a69
Update user/management/commands/seed_data.py
happylittle7 6dd776f
Merge pull request #149 from Spaghetti-OJ/feat/add-mock-data
happylittle7 3ce0e42
feat: update submission result probabilities and error handling in te…
happylittle7 5af0677
Merge branch 'feat/add-mock-data' of https://github.com/Spaghetti-OJ/…
happylittle7 b6672bc
fix: remove per-view IsAuthenticated to enforce email verification
Yi-Ting-Wang 4a719a3
feat: add email field to ForgotPasswordSerializer and update ForgotPa…
RokuSennyou db45949
docs: update forgot password API READKE to require both username and …
RokuSennyou 00f7e2f
Merge pull request #147 from Spaghetti-OJ/feat/api_permmision
RokuSennyou ca2e459
Update auths/serializers/password.py
RokuSennyou 1717c05
Merge pull request #152 from Spaghetti-OJ/feat/add-username-to-email
RokuSennyou 67f0ade
Merge pull request #151 from Spaghetti-OJ/fix/email-verified-permissi…
RokuSennyou a3ef0b7
feat: Add some limit in POST submission API but haven't implement IP …
noyapoyo acb1763
fix: remove all permission_classes = [IsAuthenticated] and @permissio…
noyapoyo 0b45cb0
feat:學生只能看到有加入的課程的problem或publec的problem
chewinggum-master ff326eb
Add test files to gitignore
chewinggum-master 00ddbe4
Ignore test.api.py
chewinggum-master 8acd516
feat: add submission testing script for Problem 1 diagnostics
happylittle7 4bf0a43
feat: enhance environment variable display in submission testing script
happylittle7 8b3f1ff
Update submissions/views.py
RokuSennyou 731363c
Update submissions/views.py
RokuSennyou 88372c2
Update submissions/views.py
RokuSennyou cc8d3eb
Merge pull request #153 from Spaghetti-OJ/feat/submission_API_feat_add
RokuSennyou c438468
Update problems/views/api.py
RokuSennyou 8c52602
Update problems/views/api.py
RokuSennyou e2d9be7
Merge pull request #154 from Spaghetti-OJ/problem_API_Permission
RokuSennyou 7f9fb6c
feat: enhance Copycat permissions and authentication checks for cours…
happylittle7 9889fd9
Merge pull request #150 from Spaghetti-OJ/feat/add-mock-data
happylittle7 81d1836
feat: add MOSS connection tests and setup for local execution
happylittle7 accfa9d
fix: improve permission checks and error handling in CopycatView
happylittle7 5c7c5be
Fix typo
happylittle7 3aa315c
Merge pull request #156 from Spaghetti-OJ/fix/copycat
happylittle7 df0433f
fix: I remove Editorial's title, difficulty, and official.
noyapoyo 8a54b41
docs: I update editorials.MD.
noyapoyo fe9b187
fix: fix the bug of admin and makemigrations again.
noyapoyo 06e2940
docs: Update editorials.MD.
noyapoyo 2eb64a4
docs: Update editorials.MD.
noyapoyo fb3c438
Merge pull request #158 from Spaghetti-OJ/fix/editorials_bug_fix
happylittle7 2f98140
feat: Add many filter in GET /submission/ API.
noyapoyo d2ba90c
docs: I update document about GET /submission/ API.
noyapoyo 7a8e79c
fix: I fix some problem that copilot mentioned before.
noyapoyo d1fce41
Merge pull request #159 from Spaghetti-OJ/feat/finish_all_submission_…
happylittle7 397209e
Merge pull request #155 from Spaghetti-OJ/test/submission-to-sandbox-…
happylittle7 eb04d69
feat: Add access_course field to MeSerializer for retrieving course m…
RokuSennyou 56313c8
feat: Enhance course access retrieval in MeSerializer and add course …
RokuSennyou c0d67b5
docs: Add access_course field to GET /auth/me/ response at README
RokuSennyou fa7bb7d
Merge pull request #162 from Spaghetti-OJ/feat/access-course-at-auth-me
RokuSennyou 48d2dfc
feat: Add static analysis rules and validation to Problems model
happylittle7 b309dec
feat: Add static analysis settings to ProblemManageSerializer and Pro…
happylittle7 86699fc
feat: Add static analysis fields and configuration to problem respons…
happylittle7 64857b7
feat;新增user name在stat
chewinggum-master f7175d8
Merge pull request #163 from Spaghetti-OJ/problem_API_Permission
RokuSennyou acfff8d
feat:get/problem新增submit_count、get/problem/{id}新增subtaskDescription
chewinggum-master b0e2703
Merge pull request #165 from Spaghetti-OJ/problem_API_Permission
RokuSennyou 9c1ae6d
Initial plan
Copilot e1c866b
refactor: Address review comments - fix docs, remove dead code, impro…
Copilot 7d23b08
feat: I add IP whitelist in GET /submission/ API and modify test code…
noyapoyo d24f9e1
docs: I update GET /submission/ API document.
noyapoyo 913e635
test: Add comprehensive test coverage for static analysis functionality
Copilot 12a8d46
refactor: Address code review feedback - improve validation and consi…
Copilot cb94e8c
Merge pull request #166 from Spaghetti-OJ/copilot/sub-pr-164
happylittle7 b1f9ff9
Merge branch 'dev' into feat/static-analysis
happylittle7 24d5e8f
Merge pull request #164 from Spaghetti-OJ/feat/static-analysis
happylittle7 683d152
feat: Update meta structure to include detailed testcases information
happylittle7 070229a
Initial plan
Copilot c478280
Refactor: Extract testcase building logic and enhance test coverage
Copilot 6904a3e
Fix: Address code review comments and test isolation issue
Copilot bfc8f53
Merge pull request #172 from Spaghetti-OJ/copilot/sub-pr-171
happylittle7 36d73c5
fix: I try to fix the problem about student cannot submit.
noyapoyo 4054e0a
Merge pull request #171 from Spaghetti-OJ/fix/adjust-meta-json
happylittle7 e31733c
docs: add PUT /homework/<id> update API doc
Yi-Ting-Wang 341a333
fix: Correct callback URL in submit_to_sandbox function
happylittle7 b024efa
Merge branch 'dev' of https://github.com/Spaghetti-OJ/back_end into dev
happylittle7 48f3914
fix: Update callback URL to remove trailing slash
happylittle7 f3ce171
Merge pull request #174 from Spaghetti-OJ/fix/callback-path
happylittle7 e46730a
feat: add testcase hash to Problems model and change problem hash fro…
happylittle7 0755ef0
fix: I modify callback_url from {settings.BACKEND_BASE_URL}/submissio…
noyapoyo b34ef12
fix: update checksum endpoint and documentation to use SHA256 instead…
happylittle7 9a14295
fix: I fix the problem mentioned by copilot. It about IP filter check.
noyapoyo a0e2011
Merge branch 'dev' into feat/finish_all_submission_function
happylittle7 2b714ae
Merge pull request #170 from Spaghetti-OJ/feat/finish_all_submission_…
happylittle7 e998410
feat: add testcase_hash field to problems model for storing SHA256 ha…
happylittle7 240e310
Initial plan
Copilot 60d021a
Address PR review comments: use stored hash, add migration, fix tests
Copilot 832cb4b
fix: I add use_static_analysis.
noyapoyo 1503912
Merge pull request #177 from Spaghetti-OJ/copilot/sub-pr-176
happylittle7 263f1e2
Merge pull request #176 from Spaghetti-OJ/fix/add-problem-hash
happylittle7 56d2009
Initial plan
Copilot 690e83b
fix: address review comments for homework update API
Copilot a14206c
Merge pull request #178 from Spaghetti-OJ/copilot/sub-pr-173
happylittle7 e002bd1
fix: Fix subtask problem and CE problem.
noyapoyo f9f5b40
Update deploy setting
happylittle7 579f76d
Update branch name for deployment workflow
happylittle7 63572bc
fix: subtask again.
noyapoyo 28dbfe2
Merge pull request #173 from Spaghetti-OJ/feat/homework-put-doc
happylittle7 d72c0a8
fix: Fix subtask again.
noyapoyo 63dd778
fix: I add error messenge detail.
noyapoyo 391ec53
fix: Fix subtask again.
noyapoyo 88128d3
fix: I add more error messages.
noyapoyo c95644b
fix: I modify SubmissionResult PK.
noyapoyo c6ea49c
fix: I fix seed_data.
noyapoyo f4d7102
fix: Add more Error message.
noyapoyo b11bd78
fix: I fix AC or orther status cannot work problem.
noyapoyo a5416bd
fix: adjust homework stats api state structure
Yi-Ting-Wang de607d7
fix: Fix subtask problem.
noyapoyo 7d35c33
Initial plan
Copilot 6cc3389
fix: I add some log to debug.
noyapoyo 7181c38
fix: apply review comments - use specific exceptions and remove redun…
Copilot 9207e53
Merge pull request #180 from Spaghetti-OJ/copilot/sub-pr-179
happylittle7 ebb45dc
Merge pull request #179 from Spaghetti-OJ/fix/homework-state
happylittle7 c8860b9
fix: I try to fix some problem.
noyapoyo eae7e6e
Merge branch 'dev' into feat/finish_all_submission_function
happylittle7 1565709
Merge pull request #181 from Spaghetti-OJ/feat/finish_all_submission_…
happylittle7 957226a
fix: update quota check logic for user submissions
happylittle7 6d4190a
feat(assignments): add ip_whitelist field
Yi-Ting-Wang 8adf521
Initial plan
Copilot 4d2f9fc
Fix transaction safety, race conditions, add docs and comprehensive q…
Copilot d220474
feat(assignments): add ip_whitelist field
Yi-Ting-Wang 69bd922
Fix test URL and remove duplicate migrations
Copilot bc7c91c
Address code review feedback: use IntegrityError and consistent query…
Copilot 3d4c1c8
Use __isnull=True for get() queries and remove unused imports
Copilot faaab37
Use consistent assignment_id=None and simplify test assertions
Copilot 17a1df4
Update assignments/models.py
RokuSennyou f1c8326
Merge pull request #183 from Spaghetti-OJ/feature/assignments-models-…
RokuSennyou e540ebe
Merge pull request #184 from Spaghetti-OJ/copilot/sub-pr-182
happylittle7 c31e5c4
Merge pull request #182 from Spaghetti-OJ/fix/quota
happylittle7 334dd73
feat:alloewdNetwork的欄位
chewinggum-master 2122141
Merge branch 'dev' into problem_API_Permission
chewinggum-master f649b23
Merge pull request #185 from Spaghetti-OJ/problem_API_Permission
RokuSennyou 4c51426
feat: I add some data for sending data to SandBox.
noyapoyo d52f512
feat:支援localhost
chewinggum-master 7bfdfbc
Merge branch 'dev' into problem_API_Permission
chewinggum-master 39eb00d
Merge pull request #188 from Spaghetti-OJ/problem_API_Permission
RokuSennyou 0a370b2
feat: Add some test code.
noyapoyo 7d0047a
Initial plan
Copilot 6d209bf
feat:like會回傳course_name
chewinggum-master 41bdde4
refactor: Extract duplicated static analysis and network config logic…
Copilot 55a1139
Merge pull request #190 from Spaghetti-OJ/copilot/sub-pr-189
happylittle7 7de42dc
Merge pull request #189 from Spaghetti-OJ/feat/Add_some_data_for_submit
happylittle7 735f5ae
Merge branch 'dev' into problem_API_Permission
chewinggum-master 2ee2d87
Merge pull request #191 from Spaghetti-OJ/problem_API_Permission
RokuSennyou bebe131
fix: align homework scoreboard response keys with frontend
Yi-Ting-Wang 9223e23
Merge pull request #192 from Spaghetti-OJ/fix/assignments-scoreboard
RokuSennyou 89895df
feat:權限bug
chewinggum-master f7d8d4b
fix(rbac): 修復 RBAC 測試 authentication 問題並實現管理員特權\n\n修改內容:\n1. 註解掉覆蓋全域配…
BlankTsai 1ecb33e
fix: 修正 assignments serializer 類型和其他 bug\n\n- 修正 course_id 類型從 UUIDFi…
BlankTsai dbcab7e
test: 添加各應用程式的 API 測試文件
BlankTsai cb55c31
Merge pull request #193 from Spaghetti-OJ/problem_API_Permission
RokuSennyou 1cb3a82
Merge branch 'dev' into fix/rbac-authentication-issues
RokuSennyou 0b909df
Merge pull request #194 from Spaghetti-OJ/fix/rbac-authentication-issues
RokuSennyou 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
Binary file not shown.
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 |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
|
|
||
| from django.test import TestCase | ||
| from django.contrib.auth import get_user_model | ||
| from django.urls import reverse | ||
| from rest_framework.test import APIClient | ||
| from rest_framework import status | ||
| from courses.models import Courses, Announcements, Course_members | ||
| from user.models import UserProfile | ||
|
|
||
| User = get_user_model() | ||
|
|
||
| class AnnouncementApiTest(TestCase): | ||
| def setUp(self): | ||
| self.client = APIClient() | ||
| self.teacher = User.objects.create_user(username='teacher', email='teacher@example.com', password='password', identity=User.Identity.TEACHER) | ||
| UserProfile.objects.update_or_create(user=self.teacher, defaults={'email_verified': True}) | ||
|
|
||
| self.student = User.objects.create_user(username='student', email='student@example.com', password='password', identity=User.Identity.STUDENT) | ||
| UserProfile.objects.update_or_create(user=self.student, defaults={'email_verified': True}) | ||
|
|
||
| self.course = Courses.objects.create(name="Test Course", teacher_id=self.teacher) | ||
|
|
||
| # Add student | ||
| Course_members.objects.create(course_id=self.course, user_id=self.student, role=Course_members.Role.STUDENT) | ||
|
|
||
| self.announcement = Announcements.objects.create( | ||
| course_id=self.course, | ||
| title="Welcome", | ||
| content="Hello everyone", | ||
| creator_id=self.teacher | ||
| ) | ||
|
|
||
| def test_list_announcements(self): | ||
| self.client.force_authenticate(user=self.student) | ||
| url = reverse('announcements:course', kwargs={'course_id': self.course.id}) | ||
| response = self.client.get(url) | ||
| self.assertEqual(response.status_code, status.HTTP_200_OK) | ||
| self.assertTrue(len(response.data['data']) >= 1) | ||
|
|
||
| def test_retrieve_announcement(self): | ||
| self.client.force_authenticate(user=self.student) | ||
| url = reverse('announcements:announcement', kwargs={'course_id': self.course.id, 'ann_id': self.announcement.id}) | ||
| response = self.client.get(url) | ||
| self.assertEqual(response.status_code, status.HTTP_200_OK) | ||
| self.assertEqual(response.data['data'][0]['title'], "Welcome") | ||
|
|
||
| def test_create_announcement_teacher(self): | ||
| self.client.force_authenticate(user=self.teacher) | ||
| url = reverse('announcements:create') | ||
| data = { | ||
| 'course_id': self.course.id, | ||
| 'title': 'New Announcement', | ||
| 'content': 'Content here', | ||
| 'is_pinned': False | ||
| } | ||
| response = self.client.post(url, data) | ||
| self.assertEqual(response.status_code, status.HTTP_201_CREATED) | ||
|
|
||
| def test_create_announcement_student_forbidden(self): | ||
| self.client.force_authenticate(user=self.student) | ||
| url = reverse('announcements:create') | ||
| data = { | ||
| 'course_id': self.course.id, | ||
| 'title': 'Hacker Announcement', | ||
| 'content': 'Content here' | ||
| } | ||
| response = self.client.post(url, data) | ||
| self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) | ||
|
|
||
| def test_update_announcement(self): | ||
| self.client.force_authenticate(user=self.teacher) | ||
| url = reverse('announcements:create') # PUT uses same endpoint name logic? No, let's check view. | ||
| # View class AnnouncementCreateView handles POST, PUT, DELETE at /ann/ (name='create') | ||
|
|
||
| data = { | ||
| 'annId': self.announcement.id, | ||
| 'title': 'Updated Title', | ||
| 'content': 'Updated Content', | ||
| 'is_pinned': True | ||
| } | ||
| response = self.client.put(url, data) | ||
| self.assertEqual(response.status_code, status.HTTP_200_OK) | ||
| self.announcement.refresh_from_db() | ||
| self.assertEqual(self.announcement.title, 'Updated Title') | ||
|
|
||
| def test_delete_announcement(self): | ||
| self.client.force_authenticate(user=self.teacher) | ||
| url = reverse('announcements:create') # DELETE uses same endpoint | ||
|
|
||
| data = {'annId': self.announcement.id} | ||
| response = self.client.delete(url, data) | ||
| self.assertEqual(response.status_code, status.HTTP_200_OK) | ||
| self.assertFalse(Announcements.objects.filter(id=self.announcement.id).exists()) | ||
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
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 |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Generated by Django 5.2.7 on 2025-12-28 17:21 | ||
|
|
||
| import assignments.models | ||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ('assignments', '0003_initial'), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AddField( | ||
| model_name='assignments', | ||
| name='ip_whitelist', | ||
| field=models.TextField(blank=True, validators=[assignments.models.validate_cidr_whitelist]), | ||
| ), | ||
| ] |
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
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 | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,74 @@ | ||||||
|
|
||||||
| from django.test import TestCase | ||||||
| from django.contrib.auth import get_user_model | ||||||
| from django.urls import reverse | ||||||
| from rest_framework.test import APIClient | ||||||
| from rest_framework import status | ||||||
| from django.utils import timezone | ||||||
| from datetime import timedelta | ||||||
| from courses.models import Courses, Course_members | ||||||
|
||||||
| from courses.models import Courses, Course_members | |
| from courses.models import Courses |
Oops, something went wrong.
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.
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.
assertTrue(a >= b) cannot provide an informative message. Using assertGreaterEqual(a, b) instead will give more informative messages.