AkaBlas / akalisten

0 stars 0 forks source link

Horizontal Alignment of Registers #12

Closed Bibo-Joshi closed 6 hours ago

Bibo-Joshi commented 5 days ago

Should apply only for desktop view/wide screens where the yes/no/maybe columns are displayed next to each other

Instead of

Yes No
Category 1 Category 2
A A
B B
C
Category 2
A

I'd like to see

Yes No
Category 1
A
B
C
Category 2 Category 2
A A
B

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:

Note that also Registers without any vote in the option need to be added

fscholdei commented 5 days 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.

Bibo-Joshi commented 4 days ago

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 :)

fscholdei commented 3 days ago

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.

fscholdei commented 3 days ago

A first attempt can be found on branch feature/horizontal_alignment.

Bibo-Joshi commented 2 days ago

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 :)

fscholdei commented 17 hours ago

I would like to remove the logic from the no-column so that I can only use option_block.j2 for all variants.

https://github.com/AkaBlas/akalisten/blob/bb5768755375db79d2e7c8b77a3d04e2d5456e20/akalisten/templates/lotsude/index.j2#L87-L93

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?

Bibo-Joshi commented 13 hours ago

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.