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

TypeError in site when judge sends None case points #659

Closed
Xyene opened this issue May 3, 2020 · 2 comments · Fixed by #665
Closed

TypeError in site when judge sends None case points #659

Xyene opened this issue May 3, 2020 · 2 comments · Fixed by #665

Comments

@Xyene
Copy link
Member

Xyene commented May 3, 2020

Traceback:
File "/code/dmoj-virtenv/lib/python3.7/site-packages/django/core/handlers/exception.py" in inner
 34.             response = get_response(request)
File "/code/dmoj-virtenv/lib/python3.7/site-packages/django/core/handlers/base.py" in _get_response
 115.                 response = self.process_exception_by_middleware(e, request)
File "/code/dmoj-virtenv/lib/python3.7/site-packages/django/core/handlers/base.py" in _get_response
 113.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/code/dmoj-virtenv/lib/python3.7/site-packages/django/views/generic/base.py" in view
 71.             return self.dispatch(request, *args, **kwargs)
File "/code/dmoj-virtenv/lib/python3.7/site-packages/django/contrib/auth/mixins.py" in dispatch
 52.         return super().dispatch(request, *args, **kwargs)
File "/code/dmoj-virtenv/lib/python3.7/site-packages/django/views/generic/base.py" in dispatch
 97.         return handler(request, *args, **kwargs)
File "/code/dmoj-virtenv/lib/python3.7/site-packages/django/views/generic/detail.py" in get
 107.         context = self.get_context_data(object=self.object)
File "/code/site/judge/views/submission.py" in get_context_data
 146.         context['batches'], statuses = group_test_cases(submission.test_cases.all())
File "/code/site/judge/views/submission.py" in group_test_cases
 127.             result.append(make_batch(last, buf))
File "/code/site/judge/views/submission.py" in make_batch
 87.         result['total'] = max(map(attrgetter('total'), cases))

Triggering init.yml:

test_cases:
- batched:
  - {in: 0.1.in, out: 0.1.out}
  - {in: 0.2.in, out: 0.2.out}
- batched:
  - {in: 1.1.in, out: 1.1.out}
  points: 100

Logs look like:

INFO 2020-05-03 16:18:03,810 55 packet Accept submission: 2067836: executor: CPP17, code: ...
INFO 2020-05-03 16:18:04,889 55 packet Compile message: 2067836
INFO 2020-05-03 16:18:04,889 55 packet Begin grading: 2067836
INFO 2020-05-03 16:18:04,890 55 packet Enter batch number 1: 2067836
Arguments: (2067836, 1, 'WA', 0.008266977, 1.609375, 0, None)
Arguments: (2067836, 2, 'SC', 0, 0.0, 0, None)
INFO 2020-05-03 16:18:04,952 55 packet Exit batch number 1: 2067836
INFO 2020-05-03 16:18:04,953 55 packet Enter batch number 2: 2067836
INFO 2020-05-03 16:18:04,953 55 packet Test case on 2067836: #3, SC [0.000s | 0.00 MB], 0.0/100

(Note: I'm not sure where the "Arguments" output is coming from.)

The issue is that the first batch doesn't have points defined, and ConfigNode defaults to None. It should default to something else instead, or otherwise raise an error during testcase construction.

@kiritofeng
Copy link
Member

case_points defaults to 1, so would that be fine for this case too?

@Xyene
Copy link
Member Author

Xyene commented May 3, 2020

Yes 👍

Xyene added a commit to Xyene/judge that referenced this issue May 9, 2020
Default points to 1, since we do this for test automatching anyway.

Fixes DMOJ#659.
Xyene added a commit that referenced this issue May 10, 2020
Default points to 1, since we do this for test automatching anyway.

Fixes #659.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants