Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
TheoLechemia committed Jul 28, 2021
2 parents ec7cffa + 24f8925 commit 00489e8
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 15 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.7.4
2.7.5
4 changes: 2 additions & 2 deletions backend/geonature/core/gn_meta/repositories.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def get_metadata_list(info_role, args, exclude_cols):
return query


def get_datasets_cruved(info_role, params=dict(), as_model=False, depth=0, lazyloaded=[]):
def get_datasets_cruved(info_role, params=dict(), as_model=False, fields=[], lazyloaded=[]):
"""
Return the datasets filtered with cruved
Expand Down Expand Up @@ -238,7 +238,7 @@ def get_datasets_cruved(info_role, params=dict(), as_model=False, depth=0, lazyl
data = q.all()
if as_model:
return data
return [d.as_dict(depth=depth) for d in data]
return [d.as_dict(fields=fields) for d in data]


def filtered_ds_query(info_role, args):
Expand Down
7 changes: 4 additions & 3 deletions backend/geonature/core/gn_meta/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,13 @@ def get_datasets(info_role):
id_user=info_role.id_role, id_organism=info_role.id_organisme
)
except Exception as e:

log.error(e)
with_mtd_error = True
params = request.args.to_dict()
depth = params.get("depth", 0)
datasets = get_datasets_cruved(info_role, params, depth=int(depth))
fields = params.get("fields", None)
if fields:
fields = fields.split(',')
datasets = get_datasets_cruved(info_role, params, fields=fields)
datasets_resp = {"data": datasets}
if with_mtd_error:
datasets_resp["with_mtd_errors"] = True
Expand Down
15 changes: 14 additions & 1 deletion docs/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,25 @@
CHANGELOG
=========

2.7.5 (2021-07-28)
------------------

**🐛 Corrections**

* Compatibilité avec Occtax-mobile. Possibilité d'ajouter la query string "fields" sur la route `meta/datasets` pour contrôler les champs renvoyés par l'API

**⚠️ Notes de version**

Si vous mettez à jour GeoNature :

* Vous pouvez passer directement à cette version mais en suivant les notes des versions intermédiaires

2.7.4 (2021-07-23)
------------------

**🐛 Corrections**

* Correction d'un import manquant entrainant un problème de compilation du frontend.
* Correction d'un import manquant entrainant un problème de compilation du frontend (#1424)

**⚠️ Notes de version**

Expand Down
6 changes: 4 additions & 2 deletions frontend/src/app/GN2CommonModule/form/data-form.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,12 @@ export class DataFormService {
});
}

getDatasets(params?: ParamsDict, orderByName = true, depth = 0) {
getDatasets(params?: ParamsDict, orderByName = true, fields = []) {
let queryString: HttpParams = new HttpParams();
queryString = this.addOrderBy(queryString, 'dataset_name');
queryString = queryString.set('depth', depth.toString())
fields.forEach(f => {
queryString = queryString.append('fields', f)
})

if (params) {
for (const key in params) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,14 @@ export class DatasetsComponent extends GenericFormComponent implements OnInit, O
}

getDatasets(params?) {
params = {};

const filter_param = {};
if (this.displayOnlyActive) {
params['active'] = true;
filter_param['active'] = true;
}
if (this.moduleCode) {
params['module_code'] = this.moduleCode;
filter_param['module_code'] = this.moduleCode;
}
this._dfs.getDatasets((params = params)).subscribe(
this._dfs.getDatasets((params = filter_param)).subscribe(
res => {
this.datasetStore.filteredDataSets = res.data;
this.datasetStore.datasets = res.data;
Expand Down
2 changes: 1 addition & 1 deletion install/install_all/install_all.ini
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ usershub_release=2.1.3
### CONFIGURATION GEONATURE ###

# Version de GeoNature
geonature_release=2.7.4
geonature_release=2.7.5
# Effacer la base de données GeoNature existante lors de la réinstallation
drop_geonaturedb=false
# Nom de la base de données GeoNature
Expand Down

0 comments on commit 00489e8

Please sign in to comment.