Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autogenerate proposition voting ID #11

Open
dpausp opened this issue Oct 14, 2019 · 3 comments
Open

Autogenerate proposition voting ID #11

dpausp opened this issue Oct 14, 2019 · 3 comments
Assignees
Labels
enhancement will fix bug this will fix a bug

Comments

@dpausp
Copy link
Member

dpausp commented Oct 14, 2019

It should be possible to autogenerate proposition voting IDs when propositions are assigned to a voting phase from a string template. This is configured per proposition type and is optional.

Example: If the proposition is the first one of its type associated with a voting phase and the string template for the proposition type is "{abbreviation}{:03d}" with abbreviation set to "WP" the voting ID would be "WP001".

@GamesGamble
Copy link
Contributor

this fixes the creating of propositions inside the admin cp with the finished status

@Plexar
Copy link
Collaborator

Plexar commented Jan 31, 2021

The implementation for issue #11 is suggested as follows by Tobias and Holger:

Counters are managed for each combination of proposition type and voting phase.
A new table named 'voting_id_counter' is created with 3 columns to store these counters:

  1. propositiontype_id : id of corresponding proposition type
  2. voting phase_id : id of corresponding voting phase
  3. counter : counter for this combination

When editing proposition types it is possible to enter a pattern for a proposition
identifier. This pattern can be used for formatting Python strings without prior
processing the pattern. The pattern is stored in the column 'abbreviation' of table
'proposition_types'.

When submitting an edited ballot, the pattern mentioned above is evaluated and the counter
from table 'voting_id_counter' for this proposition type and this voting phase is used to
create new identifiers for the propositions of this ballot. For each proposition the
corresponding generated identifier is stored in column 'voting_identifier' of table
'propositions'. A new identifier for a proposition is generated only if it not yet has
one.

@dpausp
Copy link
Member Author

dpausp commented Jan 31, 2021

The pattern is stored in the column 'abbreviation' of table 'proposition_types'.

abbreviation is already present and should be kept. Use a new column voting_identifier_template, for example.

@dpausp dpausp removed this from the Pre-BPT 20.1 milestone Jun 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement will fix bug this will fix a bug
Projects
None yet
Development

No branches or pull requests

3 participants