Closed Bibo-Joshi closed 6 hours ago
This could also be implemented if I could use max_votes
in the template. However, I cannot extract it from poll_votes[poll.id].options.items()
where I need the info about the maximum number of votes per register in one yes/no/maybe category, according to my understanding.
Hey. max_votes
is a property ("attribute"/"field") on objects of type PollOptionVotes
. poll_votes[poll.id].options
is a mapping of option names (e.g. "Anzähler") to the corresponding PollOptionVotes
objects. That meas that in
for option, votes in poll_votes[poll.id].options.items()
option
is "Anzähler" and votes
is a PollOptionVotes
object representing the info who voted yes/no/maybe for that option. In particular, votes.max_votes
gives you the max of the number of votes in yes/no/maybe.
that that clarify it? Otherwise let's sync offline :)
Could you filter out all no votes in advance that have also voted yes or maybe somewhere else at the same time? I'm worried that this might prevent the placeholder count from working. So I could also remove some logic in the code for this case.
A first attempt can be found on branch feature/horizontal_alignment
.
I've added PollOptionVotes.get_max_votes
to the same branch. You can use it as
votes.get_max_votes(poll_votes[poll.id].users.values())
For better visibility, I've opened #15 as WIP-PR :) I've also set the opacity for placeholder-li elements - personal taste :)
I would like to remove the logic from the no-column so that I can only use option_block.j2 for all variants.
I don't think the change really helps me with that problem. Do you think there are situations in which you also need all undecided “no” votes?
Got you point. I added more computations on python side, now sorted_sanitized_no
and max_sanitized_votes
are available. Templates where adapted and simplified accordingly. This also appears to remove the false ordering of the placeholder items.
Should apply only for desktop view/wide screens where the yes/no/maybe columns are displayed next to each other
Instead of
I'd like to see
On python side I already made available the number of max votes acress options:
https://github.com/AkaBlas/akalisten/blob/00f1eba2971ac936152d7044600f7ba5523297b8/akalisten/polls.py#L231-L233
I imagine that one can do the following:
max_votes - option_votes
additional<li>
elements wittha a classfiller
filler.display = hidden
for wide screensfiller.display = none
for narrow screensNote that also Registers without any vote in the option need to be added