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

1700: Refactor and clean up csv import #1765

Merged
merged 3 commits into from
Dec 2, 2024
Merged

Conversation

steffenkleinle
Copy link
Member

@steffenkleinle steffenkleinle commented Nov 11, 2024

Short description

Refactor and clean up csv import to avoid implicit side effects.

Proposed changes

  • Move responsibility and code to where it is actually needed
  • Avoid implicit side effects
  • Fix naming

Side effects

  • None.

Testing

Make sure that both normal and freinet CSV import still works.

Resolved issues

Fixes: #1700

@@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
Copy link
Member Author

Choose a reason for hiding this comment

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

This appeared after setting the eslint configuration in IntelliJ to automatic, I guess we want this project wide then?

@@ -0,0 +1,7 @@
import { ProjectConfig } from '../getProjectConfig'

export const getCsvHeaders = (projectConfig: ProjectConfig): string[] => [
Copy link
Member Author

Choose a reason for hiding this comment

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

Do you think this is good naming? Or should we change this to columnNames or similar?

Copy link
Contributor

@f1sh1918 f1sh1918 Nov 12, 2024

Choose a reason for hiding this comment

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

hm for now i think its okay because it serves this particular purpose and can't be reused that easily. But if we combine name, expiry date and extensions into one array to make it more flexible and to enable better reordering of form fields we might not need to explicitly define here the columns names in the array but just loop through and then we could rename it to getColumnNames

Copy link
Contributor

@f1sh1918 f1sh1918 left a comment

Choose a reason for hiding this comment

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

Looks good!
Nice refactoring 👍

Tested csv import for nuernberg and bavaria

Copy link
Member

@ztefanie ztefanie left a comment

Choose a reason for hiding this comment

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

Code looks good, thanks for this improvement.

Tested on Firefox:

Previously a data like this 10.01.25 was valid. Now this is transformed as "10.01.0025" and is invalid. This should be fixed to the previous behavior.

@steffenkleinle
Copy link
Member Author

steffenkleinle commented Dec 2, 2024

Previously a data like this 10.01.25 was valid. Now this is transformed as "10.01.0025" and is invalid. This should be fixed to the previous behavior.

I just tried this on main and the behavior seems to be the same for csv import, seems like this was broken before. I'll create an issue for this: #1805

@steffenkleinle steffenkleinle merged commit c11035f into main Dec 2, 2024
1 check passed
@steffenkleinle steffenkleinle deleted the 1700-refactor-csv-import branch December 2, 2024 09:15
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.

Refactor freinet CSV import
3 participants