Add executive office org type #397

Merged
merged 4 commits into from Mar 27, 2013

Conversation

Projects
None yet
2 participants
Contributor

h-lame commented Mar 27, 2013

Adds new org type (via data_migration) and makes sure they appear at the top of the org list on /government

For: https://www.pivotaltracker.com/story/show/42870995

Add executive office as new organisation type
It appears at the start of the list when in listing order

@ghost ghost assigned chrismdp Mar 27, 2013

app/models/organisation_type.rb
def self.agency_or_public_body
where(arel_table[:name].not_eq("Sub-organisation"))
end
def listing_order
- LISTING_ORDER.index(name)
+ LISTING_ORDER.index(name) || 99
@chrismdp

chrismdp Mar 27, 2013

Contributor

Are we just ensuring that the new types go at the bottom? Can we use an intention-reflecting constant here?

test/functional/organisations_controller_test.rb
queries_used = count_queries { get :index }
- assert 18 > queries_used, "Expected less than 18 queries, #{queries_used} were counted"
+ assert 21 > queries_used, "Expected less than 18 queries, #{queries_used} were counted"
@chrismdp

chrismdp Mar 27, 2013

Contributor

Message needs updating.

h-lame added some commits Mar 27, 2013

In admin, use listing_order for the org type dropdown
This means making OrganisationType#listing_order return a default (a high number) if it's name is not in the LISTING_ORDER. This because most factory built org types are not from that list.
Contributor

h-lame commented Mar 27, 2013

Rebased to address @chrismdp's comments.

@chrismdp chrismdp merged commit f8e542d into master Mar 27, 2013

1 check passed

default The Travis build passed
Details

@chrismdp chrismdp deleted the add-executive-office-org-type branch Mar 27, 2013

Contributor

chrismdp commented Mar 27, 2013

👍

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