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

feat(test-data): Adds 'create_dummy_data' command #1064

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

Dansk-Torskerognsforening

Adds 'create_dummy_data' command to generate test data to use when developing.

Changes provider 'Activity' (which creates fake activity names) to allow specifying a year instead of using random.

solve #664

Adds 'create_dummy_data' command to generate test data to use when developing.

Changes provider 'Activity' (which creates fake activity names) to allow specifying a year instead of using random.
Copy link

what-the-diff bot commented Jun 17, 2024

PR Summary

  • Addition of create_dummy_data.py File
    A new file has been created named create_dummy_data.py. This file will now reside in the members/management/commands/ directory. This will furnish the system with extra capabilities.

  • Modifications in activity Method
    The existing activity method from the members/tests/factories/providers.py file has been updated. It now includes an optional year parameter. This addition will increase the flexibility of the said function, allowing it to be more adaptable to various inputs conditions.

Departments no longer uses a factory that creates a "closed_dtm". but is set to None. This fixes a bug that made departments closed.

Departments' address.region is now the region of their union.

Unions are now in the right region.

Also includes minor code additions to prepare for a refactoring of handle() and the UNIONS_TO_CREATE list.
Each union used to be named "Region ____". which made it easy to use the union's name as the name of the region too (since there's a union for each region).

However this made the names wierd, because the union for Syddanmark should be named "Syddanmark", not "Region Syddanmark". The commit refactors the UNIONS_TO_CREATE list to contain named tuples which has "union_name" and "region_name". This
fixes the wierd names and makes it possible to have a union be called something completely unrelated to the region its in, should you want that.
Setup of the waitlist, is moved into its own _setup_waitlist() function. It creates two children and puts them on a waitlist for two departments (which handle() supplies)

The function is very 'static' and only does what is required (no parameters for alternative options). Hopefully, moving the code to its own function. will provide an easier opportunity to expand it later on.

This update also fixes a bug with the help text.
The ActivityFactory made the signup_closing field be a date +/-100 days from when the script was run. This made some acitivities not show up in the activities overview of the website, since the signup had already closed. This is now fixed by setting signup_closed to a date 1-10 days in the future.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant