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

Data Hub Test Data - Investment Project Generator #5393

Conversation

oliverjwroberts
Copy link
Contributor

Description of change

This PR ports over the existing adviser and company generators to a new datagen.py script (with the intention to replace the data_generator.py script in a subsequent PR.

It also adds a generator for invesmtnent projects.

Checklist

  • Has this branch been rebased on top of the current main branch?

    Explanation

    The branch should not be stale or have conflicts at the time reviews are requested.

  • Is the CircleCI build passing?

General points

Other things to check

  • Make sure fixtures/test_data.yaml is maintained when updating models
  • Consider the admin site when making changes to models
  • Use select-/prefetch-related field lists in views and search apps, and update them when fields are added
  • Make sure the README is updated e.g. when adding new environment variables

See docs/CONTRIBUTING.md for more guidelines.

@oliverjwroberts oliverjwroberts self-assigned this Apr 30, 2024
@codecov-commenter
Copy link

codecov-commenter commented Apr 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.40%. Comparing base (9b50190) to head (601d541).

Additional details and impacted files
@@                       Coverage Diff                        @@
##           firebreak/data-hub-test-data    #5393      +/-   ##
================================================================
- Coverage                         96.40%   96.40%   -0.01%     
================================================================
  Files                               939      939              
  Lines                             22334    22334              
  Branches                           2003     2003              
================================================================
- Hits                              21532    21530       -2     
- Misses                              655      656       +1     
- Partials                            147      148       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@oliverjwroberts oliverjwroberts marked this pull request as ready for review May 1, 2024 08:59
@oliverjwroberts oliverjwroberts requested a review from a team as a May 1, 2024 08:59
Comment on lines +36 to +44
# Handle case when requested number is too small
if number_of_companies < 10:
for adviser in advisers[:number_of_companies]:
CompanyFactory(
created_by=adviser,
modified_by=adviser,
)
print(f'Generated {number_of_companies} companies') # noqa
return
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should/could this be refactored into a function to bring down the size of the generate_companies one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, there is some refactoring opportunity here. What I will do is merge in this PR and raise a subsequent one with a number of refactors, including this suggestion, to keep things clearer.

@oliverjwroberts oliverjwroberts force-pushed the firebreak/data-hub-test-data branch from 982805b to 9b50190 Compare May 14, 2024 08:01
@oliverjwroberts oliverjwroberts force-pushed the firebreak/data-hub-test-data--investments branch from da4994b to 601d541 Compare May 14, 2024 08:02
@oliverjwroberts oliverjwroberts merged this pull request into firebreak/data-hub-test-data May 14, 2024
2 checks passed
@oliverjwroberts oliverjwroberts deleted the firebreak/data-hub-test-data--investments branch May 14, 2024 08:19
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.

3 participants