Skip to content

Define voting type#7217

Merged
mrcasals merged 12 commits intodevelopfrom
feat/define-vonting-type
Feb 2, 2021
Merged

Define voting type#7217
mrcasals merged 12 commits intodevelopfrom
feat/define-vonting-type

Conversation

@orlera
Copy link
Copy Markdown
Contributor

@orlera orlera commented Jan 25, 2021

🎩 What? Why?

Adds a voting_type field to Voting and the related business logic:

  • From the admin panel, an admin can now:
    • Choose which voting type they want when creating/updating a voting;
    • Add components to a voting (wasn't yet present);
  • When a voting is of type "Online" or "Hybrid", a persistent red banner reminds the admin that they need to add at least an election component to the current voting.

Notice that Polling Stations and Polling Station Officers are to be implemented in upcoming tickets (#7105 #7106), so the AC concerning them could not be fulfilled yet (or is inherently fulfilled, depending on the point of view 😉).

📌 Related Issues

Link your PR to an issue

Testing

Describe the best way to test or validate your PR.

📋 Checklist

🚨 Please review the guidelines for contributing to this repository.

  • CONSIDER adding a unit test if your PR resolves an issue.
  • ✔️ DO check open PR's to avoid duplicates.
  • ✔️ DO keep pull requests small so they can be easily reviewed.
  • ✔️ DO build locally before pushing.
  • ✔️ DO make sure tests pass.
  • ✔️ DO make sure any new changes are documented in docs/.
  • ✔️ DO add and modify seeds if necessary.
  • ✔️ DO add CHANGELOG upgrade notes if required.
  • ✔️ DO add to GraphQL API if there are new public fields.
  • ✔️ DO add link to MetaDecidim if it's a new feature.
  • AVOID breaking the continuous integration build.
  • AVOID making significant changes to the overall architecture.

📷 Screenshots

type

♥️ Thank you!

@orlera orlera force-pushed the feat/define-vonting-type branch from f8fb17f to 95e6609 Compare January 25, 2021 16:01
@orlera orlera force-pushed the feat/define-vonting-type branch from 95e6609 to 753dde5 Compare January 26, 2021 08:31
@orlera orlera changed the base branch from develop to feat/add-votings-attachments January 26, 2021 08:32
@orlera orlera linked an issue Jan 26, 2021 that may be closed by this pull request
5 tasks
@orlera orlera self-assigned this Jan 26, 2021
@orlera orlera added project: e-voting Barcelona City Council contract space: votings labels Jan 26, 2021
Base automatically changed from feat/add-votings-attachments to develop January 26, 2021 11:01
@orlera orlera force-pushed the feat/define-vonting-type branch from 899e1e1 to 7577624 Compare January 27, 2021 10:21
@orlera orlera force-pushed the feat/define-vonting-type branch 2 times, most recently from f7c67d2 to ff401bc Compare January 27, 2021 14:07
@orlera orlera mentioned this pull request Jan 27, 2021
5 tasks
@orlera orlera force-pushed the feat/define-vonting-type branch from ff401bc to c9cc86e Compare January 27, 2021 15:49
@leio10 leio10 force-pushed the feat/define-vonting-type branch from 48d34db to 0cdb022 Compare January 28, 2021 11:30
@agustibr
Copy link
Copy Markdown
Contributor

@orlera 👀 🤖 rubocop is offended because of 2 Missing frozen string literal comments 😁

@orlera orlera force-pushed the feat/define-vonting-type branch from e7e9282 to 78f7058 Compare January 28, 2021 15:27
@orlera orlera force-pushed the feat/define-vonting-type branch from 78f7058 to 33425b8 Compare January 28, 2021 15:33
leio10
leio10 previously approved these changes Jan 28, 2021
Copy link
Copy Markdown
Contributor

@leio10 leio10 left a comment

Choose a reason for hiding this comment

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

Nice! 💎 🚂


def online_voting?
voting_type == "online"
end
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we add an in_person_voting? method?

Copy link
Copy Markdown
Contributor Author

@orlera orlera Jan 28, 2021

Choose a reason for hiding this comment

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

Hey @leio10!
I guess you were reviewing by commit and didn't notice that that method has been added in a later commit? :)
BTW, I gave a quick shot at enum as you recommended and it was 🤩 until I tried to use it in a select - there for some reason it wasn't able to show the selected option (although it showed the list of options and store the correct one in db when the user selects one).
Might try to give it another spin tomorrow morning 👍

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Found some inspiration reviewing @slickepinne's PR to make the enum work in a select 🎉

@orlera
Copy link
Copy Markdown
Contributor Author

orlera commented Jan 29, 2021

@decidim/mantainers approved by product and ready for review 🎉

@orlera orlera marked this pull request as ready for review January 29, 2021 13:54
beagleknight
beagleknight previously approved these changes Jan 29, 2021
Copy link
Copy Markdown
Contributor

@beagleknight beagleknight left a comment

Choose a reason for hiding this comment

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

Great job! ✨ Just added a few suggestions 👍

agustibr
agustibr previously approved these changes Feb 1, 2021
Copy link
Copy Markdown
Contributor

@agustibr agustibr left a comment

Choose a reason for hiding this comment

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

Good Work!

include Decidim::HasAttachments
include Decidim::HasAttachmentCollections

enum voting_type: [:in_person, :online, :hybrid].map { |type| [type, type.to_s] }.to_h, _suffix: :voting
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👏

@mrcasals
Copy link
Copy Markdown
Contributor

mrcasals commented Feb 2, 2021

@orlera there are some conflicts! Ping me when they're solved so I can review it again! :)

@orlera
Copy link
Copy Markdown
Contributor Author

orlera commented Feb 2, 2021

@mrcasals thanks for the heads-up! Rebased with develop, although I didn't get any conflict in my local env... 🤷

Copy link
Copy Markdown
Contributor

@mrcasals mrcasals left a comment

Choose a reason for hiding this comment

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

Looks good to me, nice job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: elections project: e-voting Barcelona City Council contract

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Define voting type

5 participants