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 "House Download" page #15245

Merged
merged 11 commits into from
Sep 1, 2016
Merged

Add "House Download" page #15245

merged 11 commits into from
Sep 1, 2016

Conversation

octopusinvitro
Copy link
Contributor

@octopusinvitro octopusinvitro commented Aug 30, 2016

What does this do?

This PR creates dedicated download pages for a single-legislature-data download.

Why was this needed?

The per-country Download page is too cluttered and confusing, so we want to split it up into separate Download pages per legislature instead.

Relevant Issue(s)

Part of #13599. Part of #15256.

Implementation notes

Adds:

  • A new page class, HouseDownload
  • A route in the app.rb
  • A new template (copy-pasted the country download one, removed the loop on legislatures and updated the relevant stuff to make it a legislature download page)
  • Tests for what we send to the template from the new page

Screenshots

house

Notes to Reviewer

There is a lot of duplication here with the Country Download page (particularly the template). However, we will be removing that page before this one goes public, so it's OK to live with the duplication for a little while.

Notes to Merger

This should not go fully live (i.e. on EveryPolitician.org until all the tickets in the first section of #15256 are complete, however it is safe to merge before then as no other public pages will link to here, and so it will not yet get spidered.

@tmtmtmtm tmtmtmtm requested a deployment to everypolitician-viewe-pr-15245 August 30, 2016 14:14 Pending
@tmtmtmtm tmtmtmtm requested a deployment to everypolitician-viewe-pr-15245 August 30, 2016 14:14 Pending
@tmtmtmtm tmtmtmtm requested a deployment to everypolitician-viewe-pr-15245 August 30, 2016 14:26 Pending
@tmtmtmtm tmtmtmtm requested a deployment to everypolitician-viewe-pr-15245 August 30, 2016 14:27 Pending

def legislative_periods
house.legislative_periods
end
Copy link
Contributor

Choose a reason for hiding this comment

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

All the tests pass if I change this implementation to house.legislative_periods.take(1), which probably isn't so good…

@tmtmtmtm tmtmtmtm assigned octopusinvitro and unassigned tmtmtmtm Aug 30, 2016
@tmtmtmtm tmtmtmtm requested a deployment to everypolitician-viewe-pr-15245 August 30, 2016 15:12 Pending
@tmtmtmtm tmtmtmtm requested a deployment to everypolitician-viewe-pr-15245 August 30, 2016 15:13 Pending
@tmtmtmtm tmtmtmtm mentioned this pull request Aug 30, 2016
@octopusinvitro octopusinvitro removed their assignment Aug 31, 2016
def initialize(country:, house:, index:)
@country = country
@house = house
@index = index
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do you need to instantiate with a @country here?

@@ -0,0 +1,198 @@
<div class="page-section page-section--grey text-center">
<div class="container">
<h3>Download data for politicians in <%= @page.house.name %>, <%= @page.country.name %>.</h3>
Copy link
Contributor

@davewhiteland davewhiteland Aug 31, 2016

Choose a reason for hiding this comment

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

I think this might be simpler as "Download data for politicians in this legislature." because

  • you've already got the house and country name immediately above this line anyway
  • it might an article (e.g., "...politicians in the Senate..." but I'm not sure that automatically works for every house name we have (it might))

So I suggest you simplify this with no variables in the string, and if it causes upset subsequently raise an issue to fix/refine it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, as we did in the House page 👍

@tmtmtmtm tmtmtmtm requested a deployment to everypolitician-viewe-pr-15245 August 31, 2016 11:54 Pending
@tmtmtmtm tmtmtmtm requested a deployment to everypolitician-viewe-pr-15245 August 31, 2016 11:54 Pending
@tmtmtmtm tmtmtmtm requested a deployment to everypolitician-viewe-pr-15245 August 31, 2016 12:10 Pending
@tmtmtmtm tmtmtmtm requested a deployment to everypolitician-viewe-pr-15245 August 31, 2016 12:11 Pending
@tmtmtmtm
Copy link
Contributor

tmtmtmtm commented Aug 31, 2016

Generally looking good, though I'm a little concerned that we have a "Want politicians who aren’t from [this country]?" section, but don't explain what to do if you want politicians from a different house in the same country. It doesn't necessarily need to be solved in this PR, but if it's going to happen separately we should at least link to the issue for resolving that. (Likewise for un-hiding the terms.)
--> Update: issue covering this: #15259

@davewhiteland perhaps this PR is a good test case for rewriting the description in the style that the new PR template should take?

@tmtmtmtm tmtmtmtm changed the title House download page Add "House Download" page Sep 1, 2016
@tmtmtmtm
Copy link
Contributor

tmtmtmtm commented Sep 1, 2016

Review summary

Meets acceptance criteria?

UX

Slight issue with getting to equivalent page for other legislatures in this country, but that can be done in another PR.

Architecture

  • one new class — follows existing patterns with no new interface/naming decisions.
  • new Page is instantiated with suitable (and minimal) arguments.

Tests

  • all new public methods tested
  • existing tests all still pass

Style

  • rubocop clean
    • though adds 7 new "line too long" warnings
  • no warnings from flay
  • acceptable flog scores
    • Highest = 10.2 for HouseDownload#subject test set-up

Git/GitHub

  • Good PR title
  • Good PR description
  • fixup!s squashed

@davewhiteland I've rewritten the Issue description more in line with the style I think we should move to, and cross-linked the things that are now more clearly able to be done post-merge, than as pre-requisites to merge. So I think this is good to go! 👍

@octopusinvitro If you want squash down the fixup! commit before merging, go ahead. Otherwise, let's :shipit:

@tmtmtmtm tmtmtmtm requested a deployment to everypolitician-viewe-pr-15245 September 1, 2016 10:31 Pending
@tmtmtmtm tmtmtmtm temporarily deployed to everypolitician-viewe-pr-15245 September 1, 2016 10:31 Inactive
This template was based on the country download template.
It allows to download data for a single legislature.
The terms information describe was misleading as it was testing
for a single term. This commit adds a test for the total number
of terms and tests the information of two different terms, 113
and 114
Removed because they are already in the main header
Removed because it is already in the main heading
After rebasing master onto this branch and running the tests,
some were failing due to the recent simplification of the signature
of the term_table_url method. This commit updates the
template to use the new signature.
@tmtmtmtm tmtmtmtm temporarily deployed to everypolitician-viewe-pr-15245 September 1, 2016 11:07 Inactive
@tmtmtmtm tmtmtmtm merged commit 40dacf4 into master Sep 1, 2016
@octopusinvitro octopusinvitro deleted the house-download branch September 1, 2016 13:12
wfdd added a commit to wfdd/viewer-sinatra that referenced this pull request Sep 26, 2016
This was omitted when migrating download pages from country to
house level.  Refer to everypolitician#15245, everypolitician#15255.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants