[TestcaseGroup problems] Extend testcases UI page & exporting of problems - #3623
[TestcaseGroup problems] Extend testcases UI page & exporting of problems#3623vmcj wants to merge 20 commits into
Conversation
When a new testcase was added we would also update the description with the empty string as it was `null` before.
Since the additions of the testcase groups we would switch for every tr, not for only the testcase rows. This changes the selector to do the right thing again.
…rectory This can be checked with the addone problem where we would put the sample testcases not in it's own group in the interface but only the secret data. Verified that this works by checking both addone (where sample should now be under the root) and hello where we don't want to display anything.
This can be tested with having 1.desc, the description for testcase 1. We all use unix line endings, but the http spec wants \r\n endings. So when you save the testcases we would update testcase 1 but nothing (really) changed.
Alternative is to always fill the description with the empty string and make it non-nullable.
There are some issues with floats/integer conversions but these seem to work on a quick glance.
This reverts commit 161fafd.
This reverts commit 1611a47.
b95f9bf to
5bb28b3
Compare
meisterT
left a comment
There was a problem hiding this comment.
there are some phpcs nits as well
| $testdataConfig['output_validator_flags'] = $testcaseGroup->getOutputValidatorFlags(); | ||
| } | ||
| if ($testcaseGroup->getRangeLowerBound()) { | ||
| $testdataConfig['range'] = sprintf("range: %d %d", $testcaseGroup->getRangeLowerBound(), $testcaseGroup->getRangeUpperBound()); |
There was a problem hiding this comment.
does this need the extra 'range: ? Isn't that already given by the key? I think it currently serializes as range: range: 0 100 (or similar)
| // TODO: This is slow but prevents us from doing a transaction | ||
| $this->em->flush(); | ||
| } | ||
| $newTestcase->setRank($last->getRank() + 1); |
There was a problem hiding this comment.
$last can be null here, or am I missing something?
| $testdataConfig['accept_score'] = $testcaseGroup->getAcceptScore(); | ||
| } | ||
| if ($testcaseGroup->getAggregationType() !== TestcaseAggregationType::SUM) { | ||
| $testdataConfig['grader_flags'] = $testcaseGroup->getAggregationType()->name; |
| if ($testcaseGroup->isOnRejectContinue()) { | ||
| $testdataConfig['on_reject'] = 'continue'; | ||
| } | ||
| $zip->addFromString($testcaseDirectory . '/testdata.yaml', Yaml::dump($testdataConfig)); |
There was a problem hiding this comment.
Let's only add it if $testdataConfig is non-empty?
|
|
||
| $formatString = sprintf('data/%%s/%%0%dd', ceil(log10(count($testcases) + 1))); | ||
| $formatString = sprintf('%%s/%%0%dd', ceil(log10(count($testcases) + 1))); | ||
| $rankInGroup = 0; |
There was a problem hiding this comment.
This was already the case before your change, but it looks like $rankInGroup is actually calculating a global rank not a per group rank?
| <label class="col-sm-2 col-form-label" for="add_testgroup">Testgroup</label> | ||
| <div class="col-sm-4"> | ||
| <select class="form-select" name="add_testgroup" id="add_testgroup"> | ||
| {% for testgroup in testcaseGroups %} |
There was a problem hiding this comment.
Do we need to add some default for no group here as well?
| } | ||
| } | ||
| if ($testCaseGroups !== []) { | ||
| foreach (['data/sample', 'data/secret'] as $default_dir) { |
There was a problem hiding this comment.
I don't think this is correct, see https://icpc.io/problem-package-format/spec/2025-09.html#samples-and-full-feedback
There was a problem hiding this comment.
Ok, that was the missing spec piece I missed.
Code might not be great/performant but it fixes a couple of (real) issues, so I propose to be lenient and fix performance issues when they show up.
Will squash after approval & take the commit named testing out.
@meisterT I had to change the scores, I think it makes sense as the samples should be a testgroup but maybe you did this by design and I interpret the spec wrong?