diff --git a/README.rst b/README.rst index c5d7ffa40..cccfe6c14 100644 --- a/README.rst +++ b/README.rst @@ -131,6 +131,19 @@ If you want to check all files, not just the modified ones, you can run:: pre-commit run --all-files +Creating mock data (for development) +~~~~~~~~~~~~~~~~~~~~~~~ + +To quickly populate your development environment with sample data, you can use the following commands:: + + ./easy_toolbox.py populate-sample-data + +This creates a contest with a sample problem package and 10 users, each with 3 submissions. + +To remove all the data created by the above command (and any data created by the mass_create_tool):: + + ./easy_toolbox.py wipe-sample-data + Manual installation (deprecated) ~~~~~~~~~~~~~~~~~~~ diff --git a/easy_toolbox.py b/easy_toolbox.py index de5b102c7..60aff3885 100755 --- a/easy_toolbox.py +++ b/easy_toolbox.py @@ -74,6 +74,17 @@ "Run Ruff, a linter and formatter. You can add `--fix` to automatically fix some errors.", "{exec} -w /sio2/oioioi web bash -c 'ruff check . {extra_args} ; echo ; ruff format .'", ), + ( + "populate-sample-data", + "Create a contest with the sample problem package and 10 users, with 3 submissions each.", + "{exec} web python manage.py mass_create_tool -cn demo -cc -pp test_full_package.tgz -u 10 -sf sum-correct.cpp sum-various-results.cpp -spu 3 -v 0", + ), + ( + "wipe-sample-data", + "Wipe all contests, problems, users and submissions created with `populate-sample-data`.", + "{exec} web python manage.py mass_create_tool --wipe", + "Warning: This will wipe all data created using the mass_create_tool. Are you sure you want to proceed?" + ) ] longest_command_arg = max([len(command[0]) for command in RAW_COMMANDS])