-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Rename Poll::Question::Answer to Poll::Question::Option #5537
Merged
Conversation
This file contains 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
433ed8f
to
a4779f5
Compare
a4779f5
to
3284871
Compare
87540aa
to
0e31139
Compare
We were using three different variable names for the same thing, in consecutite tests.
Not sure about when we stopped needing them, but all usages of require_dependency definitely become obsolete after we started using Zeitwerk in commit 5f24ee9. We're also going to rename `Poll::Question::Answer` to `Poll::Question::Option`, so the conflict of having two `Answer` classes, that made us add this code in the first place, will not even exist.
Just like we do every else (sometimes even on that very same file), we use the method instead of the instance variable. We're doing this change now because we're about to modify one of these files (the poll question answers documents index component).
5d5e5b2
to
785e0e4
Compare
49ac93b
to
eb8b66b
Compare
Having a class named `Poll::Question::Answer` and another class named `Poll::Answer` was so confusing that no developer working on the project has ever been capable of remembering which is which for more than a few seconds. Furthermore, we're planning to add open answers to polls, and we might add a reference from the `poll_answers` table to the `poll_question_answers` table to property differentiate between open answers and closed answers. Having yet another thing named answer would be more than what our brains can handle (we know it because we did this once in a prototype). So we're renaming `Poll::Question::Answer` to `Poll::Question::Option`. Hopefully that'll make it easier to remember. The name is also (more or less) consistent with the `Legislation::QuestionOption` class, which is similar. We aren't changing the table or columns names for now in order to avoid possible issues when upgrading (old code running with the new database tables/columns after running the migrations but before deployment has finished, for instance). We might do it in the future. I've tried not to change the internationalization keys either so existing translations would still be valid. However, since we have to change the keys in `activerecord.yml` so methods like `human_attribute_name` keep working, I'm also changing them in places where similar keys were used (like `poll_question_answer` or `poll/question/answer`). Note that it isn't clear whether we should use `option` or `question_option` in some cases. In order to keep things simple, we're using `option` where we were using `answer` and `question_option` where we were using `question_answer`. Also note we're adding tests for the admin menu component, since at first I forgot to change the `answers` reference there and all tests passed.
Since we've renamed the class to `Option`, having variables, methods and texts refering to it as `answer` was confusing.
Since now poll question answers have been renamed to poll question options, using HTML IDs, classes and data attributes named `answer` was confusing.
8d6cece
to
8420ea1
Compare
taitus
approved these changes
Jun 13, 2024
The code for Poll::PairAnswer was removed in commit af7c376.
8420ea1
to
ca8329d
Compare
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.
Objectives
Poll::Answer
class doesRelease notes
Poll::Question::Answer
model toPoll::Question::Option
. If you've got some custom codes dealing with polls, you might have to update it. For now, we are not renaming the related database tables in order to make the upgrade easier.Sponsored
Functionality developed by