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

Add scheduled debate date to awaiting debate petitions view #456

Conversation

@leandroalemao
Copy link
Contributor

@leandroalemao leandroalemao commented Apr 14, 2016

Hi people,

I've added the debate schedule date to the awaiting debate petitions view. Useful to check the debate date before clicking on the petition.

image

@@ -44,4 +44,13 @@ def api_date_format(date_time)
end
end
end

def to_be_debated_on_in_words(date)
return unless date.present?

This comment has been minimized.

@pixeltrix

pixeltrix Apr 14, 2016
Contributor

By doing the checking for the debate date here you end up with and empty <p> tag which is undesirable - we should use scheduled_debate_date? on the petition in the view and remove this check. E.g:

<% if petition.scheduled_debate_date? %>
<p><%= to_be_debated_on_in_words(petition.scheduled_debate_date) %></p>
<% end %>
it "returns nil" do
expect(helper.to_be_debated_on_in_words(nil)).to be_nil
end
end

This comment has been minimized.

@pixeltrix

pixeltrix Apr 14, 2016
Contributor

Obviously we need to remove this test if we add the condition to the view.

@pixeltrix
Copy link
Contributor

@pixeltrix pixeltrix commented Apr 14, 2016

Other than the comments it looks 👍

@henryhadlow do we want to do relative dates, eg. 'To be debated today', 'To be debated tomorrow' ?

@leandroalemao
Copy link
Contributor Author

@leandroalemao leandroalemao commented Apr 14, 2016

@pixeltrix tks for replying..

I agree.. and I'm making the changes right now and waiting for @henryhadlow reply.

👍

@@ -45,11 +46,12 @@ def api_date_format(date_time)
end
end

def to_be_debated_on_in_words(date)
def to_be_debated_on_in_words(date, today = Date.today)

This comment has been minimized.

@pixeltrix

pixeltrix Apr 14, 2016
Contributor

Needs to be Date.current to take account of application timezone

end

context "when the date is today" do
let(:date) { Date.today }

This comment has been minimized.

@pixeltrix

pixeltrix Apr 14, 2016
Contributor

As above, it needs to be Date.current

This comment has been minimized.

@leandroalemao

leandroalemao Apr 14, 2016
Author Contributor

👍 😄

@@ -44,4 +45,14 @@ def api_date_format(date_time)
end
end
end

def to_be_debated_on_in_words(date, today = Date.current)
return unless date.present?

This comment has been minimized.

@pixeltrix

pixeltrix Apr 17, 2016
Contributor

You don't need this check here now since we're checking in the view for the presence of the date

This comment has been minimized.

@leandroalemao

leandroalemao Apr 18, 2016
Author Contributor

Yes I agree.. sorry, I forgot to remove it.. but it's all done now.. commit 4700c6f 👍 😄 tks

@pixeltrix pixeltrix merged commit 077ced0 into alphagov:master Apr 22, 2016
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@pixeltrix
Copy link
Contributor

@pixeltrix pixeltrix commented Apr 22, 2016

@leandroalemao thanks!

@leandroalemao
Copy link
Contributor Author

@leandroalemao leandroalemao commented Apr 22, 2016

@pixeltrix, I'm glad to see you've merged my pull request.. 👍 😄 I'm willing to contribute more and more. Tks!

@pixeltrix
Copy link
Contributor

@pixeltrix pixeltrix commented Apr 24, 2016

@leandroalemao it was a pleasure - if you're looking for something else to work on then #450 is a nice and easy one but if you're looking for something a bit deeper then #458 should be interesting. Feel free to ask questions if you need anything clarifying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.