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

[IMPORT][SYNTHESE] Sélection du JDD ligne par ligne #2943

Conversation

andriacap
Copy link
Contributor

@andriacap andriacap commented Mar 5, 2024

Tâche liée projet IMPORT V3 [BACKEND][SYNTHESE] Sélection du jdd ligne par ligne

Alembic

  • Revision alembic to add column unique_dataset_id and src_unique_dataset_id
  • Ajout du champ unique_dataset_id dans table bib_fields

Checks

Test backend

  •  Réaliser les tests liés à cet ajout de champ unique_dataset_id lors de l'import csv
    voir ce qui est fait pour occhab :
    @pytest.fixture()
    def uploaded_import(client, users, datasets, import_file_name):
    with open(test_files_path / import_file_name, "rb") as f:
    test_file_line_count = sum(1 for line in f) - 1 # remove headers
    f.seek(0)
    content = f.read()
    content = content.replace(
    b"VALID_DATASET_UUID",
    datasets["own_dataset"].unique_dataset_id.hex.encode("ascii"),
    )
    content = content.replace(
    b"FORBIDDEN_DATASET_UUID",
    datasets["orphan_dataset"].unique_dataset_id.hex.encode("ascii"),
    )
    f = BytesIO(content)
    data = {
    "file": (f, import_file_name),
    "datasetId": datasets["own_dataset"].id_dataset,
    }
    with logged_user(client, users["user"]):
    r = client.post(
    url_for("import.upload_file"),
    data=data,
    headers=Headers({"Content-Type": "multipart/form-data"}),
    )
    assert r.status_code == 200, r.data
    return TImports.query.get(r.json["id_import"])

Reviewed-by: andriacap

@andriacap andriacap force-pushed the feat/add-unique-dataset-id-to-synthese branch 6 times, most recently from 7337b3a to d2c2eec Compare March 5, 2024 11:35
@andriacap andriacap changed the title [IMPORT[SYNTHESE] Sélection du jdd ligne par ligne [IMPORT][SYNTHESE] Sélection du jdd ligne par ligne Mar 5, 2024
@andriacap andriacap force-pushed the feat/add-unique-dataset-id-to-synthese branch 2 times, most recently from 586bc52 to 0e8d355 Compare March 5, 2024 12:08
Copy link

codecov bot commented Mar 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.83%. Comparing base (d87e880) to head (a2cb5a9).

Additional details and impacted files
@@               Coverage Diff               @@
##           feat/import    #2943      +/-   ##
===============================================
+ Coverage        81.81%   81.83%   +0.02%     
===============================================
  Files              120      120              
  Lines             9291     9297       +6     
===============================================
+ Hits              7601     7608       +7     
+ Misses            1690     1689       -1     
Flag Coverage Δ
pytest 81.83% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@andriacap andriacap force-pushed the feat/add-unique-dataset-id-to-synthese branch 2 times, most recently from 3213f05 to c0882c9 Compare March 6, 2024 10:56
@andriacap andriacap force-pushed the feat/add-unique-dataset-id-to-synthese branch 6 times, most recently from f442346 to 887757e Compare March 7, 2024 14:49
@andriacap andriacap force-pushed the feat/add-unique-dataset-id-to-synthese branch from 887757e to 3ccd8c8 Compare March 8, 2024 18:37
- Revision alembic to add column unique_dataset_id and src_unique_dataset_id
- Add into bib_fields and into cor_entity_fields
- change the model Synthese Geonature to add unique_dataset_id

Reviewed-by: andriacap
In database these two fields are nullable then
change type to allow "None" value

Reviewed-by: andriacap
Fix errors based on adding unique_dataset_id

Reviewed-by: andriacap
 utiliser la colonne id_dataset de la table t_import_synthese plutôt que d’utiliser la valeur litéral imprt.id_dataset
@andriacap andriacap force-pushed the feat/add-unique-dataset-id-to-synthese branch from 3ccd8c8 to ad3a932 Compare March 11, 2024 09:27
@andriacap andriacap force-pushed the feat/add-unique-dataset-id-to-synthese branch from ad3a932 to 1dc1532 Compare March 11, 2024 10:00
backend/geonature/core/gn_synthese/imports/__init__.py Outdated Show resolved Hide resolved
@@ -143,11 +143,25 @@ def new_import(synthese_destination, users, import_dataset):


@pytest.fixture()
def uploaded_import(new_import, import_file_name):
def uploaded_import(client, new_import, datasets, import_file_name):
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
def uploaded_import(client, new_import, datasets, import_file_name):
def uploaded_import(new_import, datasets, import_file_name):

backend/geonature/tests/imports/test_imports_synthese.py Outdated Show resolved Hide resolved
backend/geonature/tests/imports/test_imports_synthese.py Outdated Show resolved Hide resolved
Based on Elie's review

Reviewed-by: andriac
@andriacap andriacap force-pushed the feat/add-unique-dataset-id-to-synthese branch from 1dc1532 to a2cb5a9 Compare March 13, 2024 09:14
@VincentCauchois VincentCauchois changed the title [IMPORT][SYNTHESE] Sélection du jdd ligne par ligne [IMPORT][SYNTHESE] Sélection du JDD ligne par ligne Jul 25, 2024
@andriacap
Copy link
Contributor Author

Salut,

Je fais une passe sur nos PR et je voulais savoir si cette PR n'était pas censée être fermée ?Car si j'ai bien compris cette PR : #3129 a repris le travail fait ici ?

Merci d'avance :)

@bouttier bouttier force-pushed the feat/import branch 2 times, most recently from 22e3600 to 3cc485f Compare August 14, 2024 13:42
@bouttier
Copy link
Contributor

Repris dans #3129

@bouttier bouttier closed this Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Archive
Development

Successfully merging this pull request may close these issues.

6 participants