Closed (fixed)
Project:
Election
Version:
7.x-1.x-dev
Component:
election_fptp
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
19 Jun 2015 at 19:03 UTC
Updated:
21 Dec 2016 at 18:27 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
liam morlandComment #2
liam morlandComment #3
pjcdawkins commentedCould you use a single multiple-value insert query instead? See this answer: http://drupal.stackexchange.com/a/53319
Comment #4
liam morlandThanks for the suggestion. Rerolled using that technique.
Comment #5
liam morlandNew version shows the number of vacancies on the ballot.
Comment #6
pjcdawkins commentedCasting a property to an integer and then comparing it to 1 has the same effect as using the == operator.
It doesn't seem right to me to cast the type of vacancy_count, you have this in 3 places already - is there a particular reason?
This should use format_plural().
Comment #7
liam morlandThanks. PHP sometimes does unexpected things with the == and != operators, so I am in the habit of casting and using ===. This ensures that I know exactly what is being compared. I don't think that slows things down any because PHP will do some sort of casting whenever == is used. If you don't like this style, I will write it without the casting.
I will create a patch using format_plural().
Comment #8
liam morlandPatch using format_plural().
Comment #9
liam morlandAny further comments on this patch?
Comment #10
liam morlandFixed in 052efb7.
Comment #12
dasfuller commentedJust discovered an issue:
In the foreach loop in
election_fptp_preprocess_election_vote_confirm(), the$candidate_idis used as the index for the$form_state['candidates']array, but that array uses incremental indices starting at 0. So the names never appear on the vote confirmation page because candidate objects aren't getting passed intoelection_candidate_get_name()unless the$candidate_idmatches one of the indices.Comment #13
liam morlandPlease make a child issue and provide steps to reproduce the problem.