Extract methods from proposals seeds#12005
Merged
Conversation
Also implement random_scope method so we don't have to be passing arguments for the scope
It's no longer necessary as now we're doing it for all the resources that support endorsements
This was referenced Nov 15, 2023
alecslupu
suggested changes
Nov 18, 2023
Contributor
alecslupu
left a comment
There was a problem hiding this comment.
The PR looks ok, the seeds are doing what they are supposed to do, but there are some small changes that needs to be done before.
Also, make it consistent with the `organization` method Co-authored-by: Alexandru Emil Lupu <contact@alecslupu.ro>
This was referenced Nov 18, 2023
This was referenced Nov 27, 2023
This was referenced Dec 20, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎩 What? Why?
Refactors the proposals seeds to individual methods.
There are lots of good reasons why doing this (lower the complexity of these classes, make it more readable, etc). But my main reason is to provide an API to be able to work on some issues that we need to have lots of contents (like #11874).
So, this API would be like:
Apart from that I fixed some sampling that was too complex, and I've removed the Endorsements from here (as we're doing it at #11996). Another difference is the use the
nandmvariables. Apart from not wanting to pass it as a parameter, I prefer to have some randomness there, so we don't have always the same contents in all the spaces (like always only one rejected proposal, another approved, another evaluating, and so on)For making the review process easier, I tried to do granular commits, so I recommend reviewing this on a commit by commit basis.
Testing
Regenerating the
development_appdatabase should have different kind of proposals (almost the same as before):$ bin/rails db:drop db:create db:migrate db:seedYou can play with the methods like this too: