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

Set max and min amount of person with a given role in entities specification #721

Closed
Anna-Livia opened this issue Aug 31, 2018 · 1 comment
Assignees
Labels
kind:feat A feature request, a feature deprecation

Comments

@Anna-Livia
Copy link
Contributor

Anna-Livia commented Aug 31, 2018

Rewritten by @fpagnoux

As a country package maintainer, I'd like to be able to specify, for each role of an entity:

  • How many people can have this role?
  • If this role is mandatory

Currently, I can specify a max but it doesn't work well: if I send to many people with this role, I get a very non-explicit error:

    yield role.subroles[legacy_role_j], legacy_role_i + legacy_role_j, individu
IndexError: list index out of range

There is no way right now to specify that a role is mandatory.


Suggestion:

  • Properly enforce the max of a role, and send a nice error message when a user tries to send more
  • Introduce a min properties of role, and handle it the same way

(I have a slight preference for min over mandatory as it's more consistent with max and a little more versatile, but up to debate)

@Anna-Livia Anna-Livia changed the title openfisca-core Add a mandatory attribute to entities's roles Aug 31, 2018
@Anna-Livia Anna-Livia self-assigned this Aug 31, 2018
@bonjourmauko bonjourmauko added the kind:feat A feature request, a feature deprecation label Sep 20, 2018
@fpagnoux fpagnoux changed the title Add a mandatory attribute to entities's roles Set max and min amount of person with a given role in entities specification Nov 5, 2018
@Morendil
Copy link
Contributor

Morendil commented Apr 4, 2019

Closing this as #782 is the same issue but the discussion has much more detail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:feat A feature request, a feature deprecation
Projects
None yet
Development

No branches or pull requests

4 participants