Skip to content

Commit 24a3087

Browse files
chore(metadata): replace ds synthese "records_count" with "nb_obs"
1 parent 3cb1680 commit 24a3087

File tree

7 files changed

+12
-12
lines changed

7 files changed

+12
-12
lines changed

backend/geonature/core/gn_meta/routes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def get_datasets():
119119

120120
for item_nb_observations in [
121121
"nb_observations",
122-
"synthese_records_count",
122+
"nb_observations_synthese",
123123
"nb_observations_habitats",
124124
]:
125125
if params.get(item_nb_observations, type=int, default=0):

backend/geonature/core/gn_meta/schemas.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from geonature.core.gn_commons.schemas import ModuleSchema
1616

1717
# Note: import of SourceSchema is importent as it trigger import of synthese models
18-
# which define [TDatasets.sources, TDatasets.synthese_records_count, TDatasets.nb_observations_habitats, TDatasets.nb_observations], and these must be
18+
# which define [TDatasets.sources, TDatasets.nb_observations_synthese, TDatasets.nb_observations_habitats, TDatasets.nb_observations], and these must be
1919
# defined before AutoSchema creation to be known by marshmallow!
2020
from geonature.core.gn_synthese.schemas import SourceSchema
2121
from geonature.core.gn_permissions.tools import get_scopes_by_action

backend/geonature/core/gn_synthese/blueprints/statistics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def observation_count_per_column(column):
112112
113113
This function was used to count observations per dataset,
114114
but this usage have been replaced by
115-
TDatasets.synthese_records_count.
115+
TDatasets.nb_observations_synthese.
116116
Remove this function as it is very inefficient?
117117
"""
118118
if column not in inspect(Synthese).column_attrs:

backend/geonature/core/gn_synthese/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,7 @@ def sort(cls, columns: List[str], *, query):
880880
.where(Synthese.id_dataset == TDatasets.id_dataset)
881881
.scalar_subquery()
882882
)
883-
TDatasets.synthese_records_count = column_property(
883+
TDatasets.nb_observations_synthese = column_property(
884884
request_nb_obs_synthese.label("nb_observations_synthese"),
885885
deferred=True,
886886
)

backend/geonature/tests/test_gn_meta.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -868,10 +868,10 @@ def test_get_dataset(self, users, datasets):
868868
assert DatasetSchema().validate(response.json)
869869
assert response.json["id_dataset"] == ds.id_dataset
870870

871-
def test_get_datasets_synthese_records_count(self, users):
871+
def test_get_datasets_nb_observations_synthese(self, users):
872872
# FIXME : verify content
873873
set_logged_user(self.client, users["admin_user"])
874-
response = self.client.get(url_for("gn_meta.get_datasets", synthese_records_count=1))
874+
response = self.client.get(url_for("gn_meta.get_datasets", nb_observations_synthese=1))
875875

876876
assert response.status_code == 200
877877

frontend/src/app/metadataModule/metadata-dataset.component.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,12 @@
7979
aria-hidden="true"
8080
*ngIf="dataset.nb_observations"
8181
[matTooltip]="
82-
(dataset?.synthese_records_count
82+
(dataset?.nb_observations_synthese
8383
? ('MetaData.ObservationsSyntheseTooltip' | translate) +
8484
': ' +
85-
dataset?.synthese_records_count
85+
dataset?.nb_observations_synthese
8686
: '') +
87-
(dataset?.synthese_records_count && dataset?.nb_observations_habitats ? ' - ' : '') +
87+
(dataset?.nb_observations_synthese && dataset?.nb_observations_habitats ? ' - ' : '') +
8888
(dataset?.nb_observations_habitats
8989
? ('MetaData.ObservationsHabitatsTooltip' | translate) +
9090
': ' +
@@ -104,13 +104,13 @@
104104

105105
<a
106106
mat-icon-button
107-
[disabled]="dataset?.synthese_records_count == 0"
107+
[disabled]="dataset?.nb_observations_synthese == 0"
108108
[routerLink]="['/synthese']"
109109
[queryParams]="{ id_dataset: dataset.id_dataset }"
110110
[attr.data-qa]="'pnx-metadata-jdd-display-data-' + dataset.unique_dataset_id"
111111
>
112112
<mat-icon
113-
*ngIf="dataset?.synthese_records_count == 0; else elseSynthese"
113+
*ngIf="dataset?.nb_observations_synthese == 0; else elseSynthese"
114114
matTooltip="Ce jeu de données ne comporte aucune donnée dans la Synthèse"
115115
>
116116
room

frontend/src/app/metadataModule/metadata.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ export class MetadataComponent implements OnInit {
183183
let params = {};
184184
const queryStrings: ParamsDict = {
185185
nb_observations: 1,
186-
synthese_records_count: 1,
186+
nb_observations_synthese: 1,
187187
};
188188
if (this.config.OCCHAB) {
189189
queryStrings['nb_observations_habitats'] = 1;

0 commit comments

Comments
 (0)