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

Fix multiple days in debates #33

Closed
wants to merge 37 commits into from

Conversation

IvanOrtizp
Copy link

@IvanOrtizp IvanOrtizp commented Nov 13, 2020

🎩 What? Why?

It is used to add the end date of a debate, and appear on the view in addition to the start date with the day and month.

📌 Related Issues

Link your PR to an issue

Testing

Testing to verify that the dates appear correctly

📋 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

image

image

image

Description

♥️ Thank you!

@IvanOrtizp IvanOrtizp changed the title change Fix branch Nov 20, 2020
@IvanOrtizp IvanOrtizp changed the title Fix branch Fix multiple days in debates Nov 26, 2020
Copy link

@microstudi microstudi left a comment

Choose a reason for hiding this comment

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

primer exemple de review (les reals son en anglès):

  • Falta millorar la descripció del que has fet, no cal posar "I fix", es millor posar de manera mes neutre que fa el pr que ho pugui entendre una persona que no sap de que va.
  • Si el canvi es visual, cal incloure un screenshot del abans i després (podeu enganxar una imatge a la descripció del github, es puja automticament)
  • Quan feu commits, es important que la descripció sigui una mica mes entenedora (no posar "a" com a descripció). Sempre de la forma imperativa, com contestant a la pregunta: "If i apply this change it will ...", els 3 punts seria el que hauries d'escriure.
  • Un cop posat el PR cal mirar si passa els testos, el primer de tots es el d'estil "Lint", si hi ha errors cal arreglar-ho. Hi ha eines automatiques per fer-ho depenent del tipus d'error:
bundle exec rubocop -a
bundle exec erblint decidim-*/app/**/*.erb --autocorrect

@IvanOrtizp
Copy link
Author

IvanOrtizp commented Nov 26, 2020 via email

@IvanOrtizp IvanOrtizp marked this pull request as draft December 3, 2020 10:28
@@ -139,7 +139,6 @@
context "when the has address checkbox is checked" do
let(:has_address) { true }

# rubocop:disable RSpec/EmptyExampleGroup
Copy link
Member

Choose a reason for hiding this comment

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

This comments should not be deleted. Since this PR will be about decidim-debates, we should not change things in other components.

@@ -152,7 +151,6 @@
it { is_expected.to be_invalid }
end
end
# rubocop:enable RSpec/EmptyExampleGroup
Copy link
Member

Choose a reason for hiding this comment

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

The same for this one

@@ -12,6 +12,11 @@
}
}

.icon-arrow-thin-right {
Copy link
Member

Choose a reason for hiding this comment

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

Do we want this class to be used in the whole of decidim or will it only be used in the cards used by debates? If so maybe it should go in another scss file related to cards or to debates.

Copy link

@verarojman verarojman 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! I left some suggestions to improve the code and ensure it follows some standards that help us developers better understand each other 🤖 🌱

Another thing that helps is to make sure your commit messages are descriptive (there are loooooots of guides of how to do it, I picked one randomly for you: https://chris.beams.io/posts/git-commit/#seven-rules)

Quick tip: If you haven't pushed changes yet, you can amend commits

Commits

And, one question: Why did you make so many commits? :D

@@ -76,14 +90,12 @@ edit_link(
<% end %>
</span>
</div>

Choose a reason for hiding this comment

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

It is unnecessary to remove these blank lines, and it makes it more difficult to focus on the real changes this PR is making ;) The automatic erb linter should take care that .erb files have a concise style, you don't need to worry about it!


<% if endorsements_enabled? && allowed_to?(:endorse, :debate, debate: debate) %>
<% if endorsements_enabled? && allowed_to?(:endorse, :debate, debate: debate) %>

Choose a reason for hiding this comment

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

Woops! Wrong indentation 🙆🏽‍♀️

Comment on lines 50 to 66
<div>
<%= l debate.start_time, format: "%d" %> <span class="extra__month"> <%= l debate.start_time, format: "%B" %></span>
<div class="extra__time text-small"> <%= l debate.start_time, format: "%H:%M" %> - <%= l debate.end_time, format: "%H:%M" %></span></div>
</div>
<% else %>
<div>
<%= l debate.start_time, format: "%d" %> <span class="extra__month"> <%= l debate.start_time, format: "%B" %></span>
<div class="extra__time text-small"> <%= l debate.start_time, format: "%H:%M" %></span></div>
</div>
<%= icon "arrow-thin-right", class: "icon-arrow-thin-right" %>
<div>
<%= l debate.end_time, format: "%d" %> <span class="extra__month"> <%= l debate.end_time, format: "%B" %></span>
<div class="extra__time text-small"> <%= l debate.end_time, format: "%H:%M" %></span></div>
</div>
<% end %>
</div>
<% end %>

Choose a reason for hiding this comment

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

Nice! It's working as it should :) To improve it, I would:

  • Run erblint to correct the indentation (check the decidim docs if you're not sure how to do it)
  • Extracting the logic into a Rails helper would be super super nice 👌🏽 That way this file would be more readable and therefore easy to understand.

Comment on lines 12 to 24
it "shows the start date" do
within "extra__date" do
expect(page).to have_content(debate.start_time.strftime("%d"))
expect(page).to have_content(debate.start_time.strftime("%H:%M"))
end
end

it "shows the end date" do
within "extra__date" do
expect(page).to have_content(debate.end_time.strftime("%d"))
expect(page).to have_content(debate.end_time.strftime("%H:%M"))
end
end

Choose a reason for hiding this comment

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

Good! You should add the other cases too (when only one day is displayed, when there is no end date...)

@IvanOrtizp
Copy link
Author

Thanks for the review

@IvanOrtizp IvanOrtizp marked this pull request as ready for review March 11, 2021 11:44
@microstudi microstudi closed this Jul 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
practiques Pràctiques Decidim
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Debates with multiple days
4 participants