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

Resolves #300 - Set missing participant value on FSDB import #301

Open
wants to merge 1 commit into
base: development
Choose a base branch
from

Conversation

jsastreh
Copy link

@jsastreh jsastreh commented Nov 21, 2022

Populate "glider_cert" field with "class" FsCustomAttribute when importing pilots from FSDB file.

Populate "glider_cert" field with "class" FsCustomAttribute when importing pilots from FSDB file.
Copy link
Collaborator

@biuti biuti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Id like to populate 'glider_cert' only if 'class' value is a valid certification.
Sometimes they are 'Standard" or 'Sport' or other classes like that.
In these cases it creates a CustomAttribute called 'class'.
I'd also like a neat result with only 'glider_cert' or 'class' CustomAttribute populated.

You get valid certification values using

def get_certifications_details() -> dict:

And then checking against values of the comp_class, like it is done here:

classes_are_certs = all(c in certs for c in classes)

But accepted certifications list should be calculated in fsdb.py once to avoid reiterating for each Participant.
In Excel import procedure it iterates all participants and switches from CustomAttribute to 'glider_cert' only if all column values are valid.
I'm not sure this is feasible in lxml.
Best solution that comes to my mind at the moment would be to let them be imported as CustomAttribute, then check all Participants against the valid certification list, and if confirmed, copy values to 'gliders_cert and delete CustomAttribute before saving in database.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants