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

generate reports using rake task #56

Merged
merged 1 commit into from
Feb 10, 2022
Merged

Conversation

vzaragoza
Copy link
Collaborator

No description provided.

@vzaragoza vzaragoza requested a review from mapreal19 February 10, 2022 14:57
@vzaragoza vzaragoza merged commit 86b6415 into staging Feb 10, 2022
reports = args[:total]
puts "Generating #{reports} reports..."
Report.delete_by(student:, course:)
reports.times do |i|
Copy link
Collaborator

Choose a reason for hiding this comment

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

You could simplify this code with create_list and a trait. In the case this performs bad create_list might just do one SQL query

FactoryBot.create_list(:report, reports.count, :with_fake_pdf)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I need to generate a different pdf for each report and FactoryBot always creates the same content/pdf

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe with https://github.com/thoughtbot/factory_bot/blob/main/GETTING_STARTED.md#sequences you can tweak it and have different contents?

Copy link
Collaborator

@mapreal19 mapreal19 left a comment

Choose a reason for hiding this comment

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

👍

@mapreal19 mapreal19 deleted the generate-dataset-rake branch February 11, 2022 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants