-
Notifications
You must be signed in to change notification settings - Fork 3
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
1492: Add bulk import from freinet #1541
Conversation
550c2f6
to
3584167
Compare
3584167
to
9c3b8f6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
administration/src/bp-modules/cards/ImportCardsFromFreinetController.tsx
Outdated
Show resolved
Hide resolved
administration/src/bp-modules/cards/ImportCardsFromFreinetController.tsx
Outdated
Show resolved
Hide resolved
administration/src/bp-modules/cards/ImportCardsFromFreinetController.tsx
Outdated
Show resolved
Hide resolved
csvHeader[csvHeader.length] = nameCoulmnName | ||
} | ||
|
||
const indexVorname = csvHeader.indexOf(FREINET_FIRSTNAME_COLUMN_HEADER) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we should add some error handling if columns do not exists
administration/src/bp-modules/cards/ImportCardsFromFreinetController.tsx
Outdated
Show resolved
Hide resolved
# Conflicts: # administration/src/project-configs/bayern/config.ts # administration/src/project-configs/getProjectConfig.ts # administration/src/project-configs/nuernberg/config.ts # administration/src/project-configs/showcase/config.ts
@ztefanie A second (optional) thing could be to set a |
Yes both is as it should be. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright works as expected 👍
For later testing i think it could help to also provide a working csv example.
Sorry i was a bit confused while testing it ^^
const FREINET_LASTNAME_COLUMN_HEADER = 'nachname' | ||
const FREINET_CARDTYPE_COLUMN_HEADER = 'inhaber_ehrenamtskarte' | ||
|
||
const mergeFirstAndLastnameIntoNewColumn = (line: string[], csvHeader: string[], nameColumnName: string) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙃 Is all of this done in place as no copies or anything are returned? Wouldn't it be a lot safer to work with copies? Looks kindof error prone to me.
E.g. if the header is adjusted in an early iteration, doesn't that have implications for later iterations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it does impact later iterations, but this is handled and works as expected. You are right it may be not the best implementation, but we are not planning to have this feature for a ever or a long time, it is just a workaround, we will remove this as soon as Freinet and entitlemtcard are connected.
administration/src/bp-modules/cards/ImportCardsFromFreinetController.ts
Outdated
Show resolved
Hide resolved
administration/src/bp-modules/cards/ImportCardsFromFreinetController.ts
Outdated
Show resolved
Hide resolved
administration/src/bp-modules/cards/ImportCardsFromFreinetController.ts
Outdated
Show resolved
Hide resolved
administration/src/bp-modules/cards/ImportCardsFromFreinetController.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Steffen Kleinle <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on firefox. I can open the CSV you linked in the issue (#1492 (comment)), but it looks like this:
So it checked that there are invalid values and therefore blocks creating the QR codes, but I am not able to change the names or anything? Am I doing something wrong?
If this is supposed to happen in another issue/PR, it works as expected!
Tests are missing, I will create a ticket for them if i will not manage to add some this week before my vacation
Did you manage to do this?
And perhaps you could add the csv here too? https://github.com/digitalfabrik/entitlementcard/tree/main/administration/resources/cards |
this is expected. just remove the ";" from the csv and create a card :) @steffenkleinle |
…from-freinet # Conflicts: # administration/src/bp-modules/cards/ImportCardsInput.tsx
resolved merge conflicts and merge @ztefanie to put it in the next release |
Short description
Adding bulk import csv option from freinet csv format
Proposed changes
Side effects
Resolved issues
Fixes: #1492