From 14e806be5266efa40036d78ad833bdc590be24dc Mon Sep 17 00:00:00 2001 From: Adrian Short Date: Fri, 2 May 2014 14:25:34 +0100 Subject: [PATCH] Gracefully display elections which haven't yet been contested --- views/candidate.haml | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/views/candidate.haml b/views/candidate.haml index 8392ae0..247c722 100644 --- a/views/candidate.haml +++ b/views/candidate.haml @@ -31,9 +31,21 @@ %td %a{ :href => "/bodies/#{ccy['body_slug']}/elections/#{ccy['d']}/#{ccy['districts_name']}/#{ccy['district_slug']}" } = ccy['district_name'] - %td.right= commify(ccy['votes']) - %td.right= to_ordinal(ccy['position']) - %td= ccy['seats'] == 1 ? "Elected" : "Not elected" + - if ccy['votes'].nil? # election results not yet available + %td.right — + %td.right — + %td.right — + - else + %td.right= commify(ccy['votes']) + %td.right= to_ordinal(ccy['position']) + %td= ccy['seats'] == 1 ? "Elected" : "Not elected" .warning - This might not be the complete electoral history for this candidate. They might have stood in elections outside Sutton and / or in Sutton elections for which we don't have data. \ No newline at end of file + %p + This might not be the complete electoral history for this candidate. They might have stood in elections outside Sutton and / or in Sutton elections for which we don't have data. + + %p + Some candidates have more than one profile page due to them using slightly different names in different elections. See the full + %a{ :href => "/candidates/##{@candidate.surname[0]}" }< + candidates list + for details.