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

IA-3953: include opening / closing date on import export #1993

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

beygorghor
Copy link
Collaborator

What problem is this PR solving? Explain here in one sentence.

Related JIRA tickets : IA-3953

Self proofreading checklist

  • Did I use eslint and black formatters
  • Is my code clear enough and well documented
  • Are my typescript files well typed
  • New translations have been added or updated if new strings have been introduced in the frontend
  • My migrations file are included
  • Are there enough tests
  • Documentation has been included (for new feature)

Changes

Modify import and export script to take opening and closed date into consideration

How to test

Make sure you have an org unit with a opening and closing date
Generate a gpkg export from the org units page of all the org units
Recreate a new version of the source from the generated gpkg
Open the detail on the org unit on the new version, opening / closing dates should be ok

If a specific config is required explain it here: dataset, account, profile, etc.

Follow the Conventional Commits specification

The merge message of a pull request must follow the Conventional Commits specification.

This convention helps to automatically generate release notes.

Use lowercase for consistency.

Example:

fix: empty instance pop up

Refs: IA-3665

Note that the Jira reference is preceded by a line break.

Both the line break and the Jira reference are entered in the Add an optional extended description… field.

@beygorghor beygorghor requested a review from madewulf February 21, 2025 16:44
@beygorghor beygorghor added the release Should be released in production at next deploy label Feb 21, 2025
@madewulf madewulf removed the release Should be released in production at next deploy label Feb 25, 2025
Copy link
Member

@madewulf madewulf left a comment

Choose a reason for hiding this comment

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

This needs a bit of automated tests

@madewulf
Copy link
Member

I tested the feature on staging with the following file: https://drive.google.com/file/d/1ldRL_iVISeKTBevl292yntpXQWzlOJQs/view?usp=sharing and it did not update the opening times after I edited them in QGIS:
CleanShot 2025-02-25 at 10 56 12@2x

@beygorghor beygorghor requested a review from madewulf March 3, 2025 14:06
@beygorghor
Copy link
Collaborator Author

@madewulf this as not been deployed on staging yet, you have to try it locally to make it work, anyway i have added some test on the import and the export features

@beygorghor beygorghor requested a review from mestachs March 3, 2025 14:09
Copy link
Contributor

@mestachs mestachs left a comment

Choose a reason for hiding this comment

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

I was able to extract a GeoPackage and saw the 2 columns.
image

I was able to import a GeoPackage that didn't have the two columns.
I was able to import a GeoPackage that has the new columns.
I updated the two dates, re-exported the package, and saw my two dates.

to visualize a geopackage without too much work : https://mestachs.github.io/taskr/#/gh/g/mestachs/61ec8c5561ca40630df34fc2a6d92f9a

@mestachs
Copy link
Contributor

mestachs commented Mar 3, 2025

tested the update

sudo apt update && sudo apt install libsqlite3-mod-spatialite`
sqlite3 'development-Organisation Namestable-2-41-3-org_units-2025-03-03-15-05.gpkg

had to drop these triggers (Parse error: unsafe use of ST_IsEmpty())

DROP TRIGGER "rtree_level-4-Facility_geom_insert";
DROP TRIGGER "rtree_level-4-Facility_geom_update1";
DROP TRIGGER "rtree_level-4-Facility_geom_update2";
DROP TRIGGER "rtree_level-4-Facility_geom_update3";
DROP TRIGGER "rtree_level-4-Facility_geom_update4";
DROP TRIGGER "rtree_level-4-Facility_geom_delete";

then updated all the opening date

UPDATE "level-4-Facility" SET opening_date = '1977-07-15';

then update the version based on the geopackage
image

then verified the new date is there
image

stuff I'm unsure : behavior if I update a geopackage that doesn't have the column or where the columns is null, will it "nullify" the date ?

@mestachs
Copy link
Contributor

mestachs commented Mar 3, 2025

so when the column is set to null the date in iaso are untouched.

UPDATE "level-4-Facility" SET opening_date = NULL;

I would change the behavior to something "geopackage" is the "truth" with

  • si la colonne n'est pas dans le geopackage : ne rien toucher
  • si la colonne est la et remplie : on prend cette date dans iaso
  • si la colonne est la et null ou vide : on met à null dans iaso

@beygorghor beygorghor marked this pull request as draft March 4, 2025 15:59
@beygorghor beygorghor marked this pull request as ready for review March 7, 2025 16:01
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.

3 participants