-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add functions to Import/Clear/Export the WCIF #52
Conversation
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.
Thanks!
174f601
to
e934773
Compare
e934773
to
3cf94e1
Compare
Thanks for the quick review! I just pushed some changes, hopefully I did not overlook any of your comments, feel free to close/re-open threads to make sure I did not miss something :) |
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.
Thank you!
I wanted to create a pull request on top of #46, but it wouldn't let me open it in this repository because the base branch would have been in my fork too.
Therefore this PR contains all the code from #46; the diff will shrink when #46 is merged, but at the moment I would recommend reviewing this by taking a look at the last 3 commits individually, or going to the diff between
fixes
andimport-export-wcif
!I started by implementing the
ExportWCIF
function, and ran into an expected behavior fromnodemon
I did not see coming, where emitting a json in a subfolder would trigger a rebuild of the application and reset the connection in the browser.I worked around this by creating a default
OUTPUT_BASE
folder, which I toldnodemon
to ignore through-i outputs
.I have created a
dev-server
target in thepackage.json
to be able to conveniently runnpm run dev-server
without having to remember the correct command line every time.As far as the implementation goes it was quite straightforward, but I did not invest into error checking and the tool will just crash if it can't write the file.
The
ImportWCIF
function is quite straightforward too, and load a file relative toSCRIPT_BASE
.I also took the liberty of implementing a
ClearWCIF
function: the name may need to be adjusted, since the purpose is not to reset the whole WCIF but basically provide a "clean" WCIF on top of which the script will run (no assignments, no groups, no unexpected extensions).It's actually awesome just to make sure anything created by another tool is gone.
If I'm not mistaken there is not such a function even for the WCA website admins; you would have to go into rails' console to clean up the WCIF manually (which I believe I've done several times in the past when some competitions' state got messed up).