#76 info link does not appear on voting page when candidates are FAS users
Closed: Fixed 2 years ago by bcotton. Opened 4 years ago by bcotton.

May be related to #74? pingou suggests the following

diff --git a/ fedora_elections/templates/_formhelpers.html b/ fedora_elections/templates/_formhelpers.html
index 0683977..82e1d75 100644
--- a/ fedora_elections/templates/_formhelpers.html 
+++ b/ fedora_elections/templates/_formhelpers.html 
@@ -72,11 +72,9 @@
 </div>
 {% endmacro %}

-{% macro render_field_data_in_row(field, usernamemap=None, after="") %}
+{% macro render_field_data_in_row(field, after="") %}
 <div class="list-group-item {% if field.errors %}has-danger list-group-item-danger{% endif %}">
-    {% if usernamemap %} {{ usernamemap[field.name] }} {%
-        else %} {{ field.label }} {% endif %}
-          {{ field(class_="c-select pull-xs-right")}}
+      {{ field.label }} {{ field(class_="c-select pull-xs-right")}}
       {% if after %} <div><small class="text-muted">{{ after }}</small></div>{% endif %}
       {% if field.errors %}
         {% for error in field.errors%}
diff --git a/ fedora_elections/templates/about.html b/ fedora_elections/templates/about.html
index b87fea8..fd7cf9c 100644
--- a/ fedora_elections/templates/about.html    
+++ b/ fedora_elections/templates/about.html    
@@ -149,11 +149,7 @@
             {% if candidate.url %}
               <a href="{{ candidate.url }}">
             {% endif %}
-            {% if election.candidates_are_fasusers %}
-              {{ usernamemap['%s' % candidate.id] }}
-            {% else %}
-              {{candidate.name}}
-            {% endif %}
+            {{ candidate.fas_name or candidate.name }}
             {% if candidate.url %}
               </a>
             {% endif %}
diff --git a/ fedora_elections/templates/results_text.html b/ fedora_elections/templates/results_text.html
index 14f9503..255827f 100644
--- a/ fedora_elections/templates/results_text.html 
+++ b/ fedora_elections/templates/results_text.html 
@@ -52,9 +52,7 @@ The results for the elections are as follows:
   {%- if lastrow[-1] == 1 %}
 - --------+----------------------
   {%- endif %}
-{{ candidate.vote_count | rjust(8) }}  | {% if election.candidates_are_fasusers -%}
-      {{ usernamemap[candidate.id] }} {%- else -%} {{candidate.name}}
-    {%- endif %}
+{{ candidate.vote_count | rjust(8) }}  | {{ candidate.fas_name or candidate.name }}
 {%- endfor %}


diff --git a/ fedora_elections/templates/vote_range.html b/ fedora_elections/templates/vote_range.html
index d6f0f2b..786073f 100644
--- a/ fedora_elections/templates/vote_range.html   
+++ b/ fedora_elections/templates/vote_range.html   
@@ -18,8 +18,7 @@
     <p>Here are the candidates for the {{ election.seats_elected }} seat(s) open:</p>
     <form action="{{ url_for('vote', election_alias=election.alias) }}" method="post">
         {% for field in form if field.widget.input_type != 'hidden' %}
-          {{ render_field_data_in_row(
-              field, usernamemap=usernamemap) }}
+          {{ render_field_data_in_row(field) }}
         {% endfor %}

       {% if g.fas_user %}

He also says:

so I think most of the usernamemap can be dropped since we now cache the FAS username in the DB directly
[11:41] <pingou> the usernamemap is an artifact from when the full name was retrieved from FAS upon request (and cached)
[11:41] <pingou> that made elections so slow... :D
[11:42] <pingou> and it's not like fullnames are changing so often, worst case if people want to change it, remove the candidate, add him/her again and it's synced again
[11:42] <pingou> (don't do this in the middle of an election though, as all votes would get lost)

Metadata Update from @bcotton:
- Issue set to the milestone: 2.10 (F32 target)

4 years ago

pingou fixed this when dropping the username map

Metadata Update from @bcotton:
- Issue close_status updated to: Fixed
- Issue set to the milestone: None (was: 2.10 (F32 target))
- Issue status updated to: Closed (was: Open)

2 years ago

Login to comment on this ticket.

Metadata