I1224 point score decimal format#1226
Conversation
i_1187 Fix wrong argument when setting institution information
PR Change request: Use Double.valueOf() instead of new Double().
i_1195 Handle escapes in institution names
Fix EventFeedUtilities.java to ignore zip file names that are empty or are directories (end in a /). CI: Somewhat related, but do not create a zip file for an API submission source file request with entries that have empty filenames.
Fix errant comment. Change overrideSubmissionID to default of 0 since a submissions can not have an ID of 0. A negative submission ID is special and will get converted to a positive number, so -1 is really submission 1.
… i1006_point_scoring
Added formatScore method to Utilities to format a double according to the configured format [scoring].format. Change related classes that need to format a score to use the new method. The default format is set to: 0.0##
clevengr
left a comment
There was a problem hiding this comment.
I have reviewed src/edu/csus/ecs/pc2/clics/API202306/SubmissionService.java. I don't understand what the changes in this file have to do with the PR to which they are attached. (The changes don't seem unreasonable -- they just appear to be related to a different issue...)
clevengr
left a comment
There was a problem hiding this comment.
I have reviewed src/edu/csus/ecs/pc2/convert/EventFeedUtilities.java. As with my previous comment, I don't see what the changes in this file have to do with this PR...
clevengr
left a comment
There was a problem hiding this comment.
I reviewed the changes to src/edu/csus/ecs/pc2/core/scoring/DefaultScoringAlgorithm.java. I made a couple of notes: not so much "Request for changes" as "I'm not completely sure about doing this..."
clevengr
left a comment
There was a problem hiding this comment.
I've reviewed src/edu/csus/ecs/pc2/core/Utilities.java. I think there is important error-handling missing (see my comments).
|
I've reviewed all the file changes, made comments, and in one case requested change. Moving on now to a runtime test. Noting that the "Steps to test" don't give much detail... |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
I thought the testing procedure was terse, but adequate. You don't have to load a new contest, or make submissions or anything. Just load up a completed contest and look at the scoreboard, reports, event feed, WTI, whatever you want. It's a visual thing. BTW, we did use this at NAC for the WTI scoreboard (recall the "on-the-fly" If you would like me to supply step-by-step instructions on how to download the zip, unzip it, start the contest, test each app that uses the format stuff, make changes to the |
I personally don't need step-by-step details at the level of "how to down the zip, unzip it, start the contest, and so forth" (although it may be that some of our less-experienced testers might find that useful). What I was commenting on was more about |
|
I have made a run-time test of the PR. It works as expected for changing the in the WTI's |
Since formatting is now done in the DSA, it is no longer necessary for the angular code to hard-code formats for the score.
This took A WHILE to track down, and, just to be a blame-shifter, it's the fault of the Angular code writer... ;-) For example, this from That is not very configurable then, is it? Evidently, the scoreboard-page component overrides the format (with a lovely comment to that effect). You may have noticed that while the WTI scoreboard had not obeyed the format in the This is why we didn't notice this at NAC since all the clients used a "3 after the decimal" format, which matched what the Angular HTML had. sigh. As @lane55 was fond of saying, "this is why we test". So, to blame-shift back to the PR author, ahem. I should have checked formats other than "3 after the decimal" in my testing, and I would have seen the issue on the HTML and dealt with it. I made the change in the HTML angular files (and there were a bunch of those "number:'1.3-3'" formats scattered across several files, and now it works - for the most part: The issue is, since the value is a double NUMBER (not a String), when angular (javascript) goes to display it, it chops off any trailing zeroes as shown above. I'm not sure how "bad" this is? or good perhaps? Hm. I'm not sure how to address this since I don't know anything about how angular does stuff. Maybe the app config file has to change and contain the format string: number:'1.3-3' ? Oh boy. Can of worms. Suggestions welcome from Angular experts. (BTW I pushed a commit to remove the formatting from the HTML. When you test it, be sure to flush your cache or use incognito mode since, "main.js" is not refreshed by default and it will not load a new one unless explicitly told to do so). |
clevengr
left a comment
There was a problem hiding this comment.
Request change in the default score pattern, from 0.0## to 0.000, so all scores align.
Utilities.java - change default scoring format to be 0.000 instead of 0.0## (PR request) InternalController.java - Add check at startup to test any scoring formats supplied in the INI file so we don't get surprises later. CI: Fix spelling error of saveConfigurationToDisk in the module. ContestController.java - Add methods to support "fixing" the scores after the XML is converted to JSON. The XML class was converting a formatted string (the score) to s double, thereby losing the formatting. The changeScoresToStrings() method navigates the JSON and changes all double score values to strings and reformats them. TeamsController.java and RunModel.java - Change the score field to String and format the score using Utilities.formatScore().
|
This comment may be thought of as an addendum to the description of the PR. It was determined that the WTI did not correctly format scores for scoring contests. This was because during the conversion of XML to JSON in In addition, the "Runs" table on the WTI web page improperly showed the score for problems as well. They used to be hardcode formatted as 1.3-3 (three after the decimal), and that was not configurable. When the fixed formatting was removed, default Java formatting of the The changes described above appear to fix the issues related to formatting scores in the WTI. |
clevengr
left a comment
There was a problem hiding this comment.
I reviewed the changes to projects/WTI-API/src/main/controllers/ContestController.java. I noted two areas where I think extra error-catching code is warranted/needed.
There was a problem hiding this comment.
I reviewed all the changed files and don't have any further issues with them. I ran a pretty comprehensive runtime test. I verified that formatting changes are properly handled in the PC2 Admin Scoreboards, the PC2 Board client and the HTML scoreboards it generates, and the WTI. I was not able to figure out exactly how to verify that formatting changes are properly reflected in the Event Feed (there's no Scoreboard data in the Admin's Event Feed JSON report or the EF Client View Event Feed operation, and for some reason I couldn't connect to/login to the contest using a browser to hit the /event-feed endpoint myself.
My failure is undoubtedly my own fault, but I'd like to finish that EF verification - if I can get some help understanding how to do it. Once I've done that I'm ready to approve the PR.
(Note: since I like to create "Test Procedure" documents to help myself keep track of how I'm testing, I took the liberty of going ahead and adding my own steps to the "How to Test the PR" section... Hopefully it might help someone else approve the PR more quickly...)
Remember, when testing the event feed, keep in mind the CLICS spec says that the "score" values are numbers, meaning, they are not strings. The formatting is not preserved, of course. However, the rounding is observed since it works kind of the same was as the WTI did. XML standings are created and the scores are formatted according to the
|
Thanks. I'm not quite sure why the URL contains |
clevengr
left a comment
There was a problem hiding this comment.
I've now verified that the Event Feed contains scores in the expected format, so as far as I can see everying in the PR works as intended. I approve the PR.
Ugh... Yeah, when I first created the "nac25chall24practice" it was in January (21) 2026. I guess my mind was still on "2025" so when I created the contest.yaml with the contest id, I put in nac25chall24practice. It's one of those "historical" mistakes that never got corrected. |


Description of what the PR does
Allows configuring of the display format (
DecimalFormat) used to format scores from a point scoring contest.Issue which the PR addresses
Fixes #1224
Environment in which the PR was developed (OS,IDE, Java version, etc.)
Windows 11
Ubuntu 24.04.3
Precise steps for testing the PR (i.e., how to demonstrate that it works correctly)
Load up any point scoring contest that is complete, eg. NAC2026 challenge2024_test, for example. Details of obtaining the completed contest results can be directed to @johnbrvc . Suffice to say, I have tested it with three different apps (pc2admin, pc2board, pc2feeder) all using different
pc2v9.inifiles with different formats for the point scores, and it appears to work as described in the issue.The following additional details may also be helpful in testing the PR
profilesfolder and theprofiles.propertiesfile into the PC2 folder where your PC2 distribution (what you are going to test) resides. Be sure you have NOT started the PC2 Server before copying the profiles into PC2.0.000(at least one whole digit and exactly 3 decimal digits), as follows:Run Contest>Scoreboardtab; ensure that the scores all have exactly three decimal places (this is the default).Configure Contest>Settingstab and make sure theOutput HTML dir for JudgesandOutput Public HTML dirpaths point to a valid location on your machine (typically you'd want them pointing to locations under the PC2 distribution you are testing).index_ps.htmlin the "Judge's HTML" ("secret") folder.projectsfolder, unzip the WebTeamInterface.zip file../bin/pc2wti).team1with passworddecoy-sled-dwarf-idly).Runspage, verify that every "Accepted" run has a score containing exactly 3 decimal digits.Scoreboardpage, verify that:Scorecolumn has exactly 3 decimal digits.formatcauses a client to fail to start, as follows:pc2v9.inifile in the root PC2 distribution folder by adding the following lines at the end:pc2v9.inifile in the root PC2 distribution folder by adding the following lines at the end:pc2v9.inifile under theprojects/WebTeamInterfacefolder in a similar manner, except use format0.0000(only four decimal digits).RunsandScoreboardpages now show scores containing exactly four decimal digits.pc2v9.inifile containing a differentformat=x.xxxvalue, and verify that each client displays its scores according to its own format specification. Most people would consider this "overkill-testing"...