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

Require a description for a PublicBodyCategory translation #2112

Closed
garethrees opened this issue Jan 22, 2015 · 6 comments
Closed

Require a description for a PublicBodyCategory translation #2112

garethrees opened this issue Jan 22, 2015 · 6 comments
Labels
awaiting-review bug Breaks expected functionality

Comments

@garethrees
Copy link
Member

Given a PublicBody is marked with a tag that relates to a PublicBodyCategory,
When you visit the "show" page of that PublicBody where the PublicBodyCategory does not have a description in the current locale
Then there should be no error.

A TypeError occurred in public_body#show:

can't convert nil into String
app/models/public_body.rb:347:in `+'

Need to add a validation on PublicBodyCategory to ensure all locales have a description if the primary locale contains a description.

Alternatively, modify PublicBody#type_of_authority to only try to render the description if it's available in the current locale.

https://github.com/mysociety/alaveteli/blob/rails-3-develop/app/models/public_body.rb#L347

@lizconlan
Copy link

had a similar issue on Panama last week - #2105

possibly related, is the check at app/models/public_body.rb:344 looking at the right thing, or should there be an additional check that the lookup has found something?

@garethrees
Copy link
Member Author

possibly related, is the check at app/models/public_body.rb:344 looking at the right thing, or should there be an additional check that the lookup has found something?

It looks like it's used so that it only capitalises the first result. It should probably also check that it's found something.

@garethrees
Copy link
Member Author

We actually validate that a PublicBodyCategory has a description (#2012), so that should probably be true for the translated versions.

@garethrees
Copy link
Member Author

This ticket is pretty much wontfix, since it's expecting a description to be there.

@crowbot crowbot added 0 - icebox and removed 1 - new labels Feb 2, 2015
@garethrees garethrees changed the title A PublicBodyCategory requires a description in all locales Require a description for a PublicBodyCategory translation Feb 4, 2015
@garethrees
Copy link
Member Author

Renamed the ticket to reference what the fix should be.

A translation of a PublicBodyCategory should not be valid if its description attribute is empty.

@crowbot
Copy link
Member

crowbot commented Mar 19, 2015

Covered in #2140

@crowbot crowbot closed this as completed Mar 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-review bug Breaks expected functionality
Projects
None yet
Development

No branches or pull requests

3 participants