From b88bd8683dc59d63f4f61815a53afba621ee2e98 Mon Sep 17 00:00:00 2001 From: TheoLechemia Date: Fri, 30 Oct 2020 12:22:03 +0100 Subject: [PATCH] Add score column in validation #1105 --- .../gn_module_validation/backend/blueprint.py | 8 ++++- .../validation-synthese-list.component.html | 32 +++++++++++++++++++ .../synthese-info-obs.component.ts | 2 +- frontend/src/styles.scss | 8 +++++ 4 files changed, 48 insertions(+), 2 deletions(-) diff --git a/contrib/gn_module_validation/backend/blueprint.py b/contrib/gn_module_validation/backend/blueprint.py index de4958dab3..dcbee56fdc 100644 --- a/contrib/gn_module_validation/backend/blueprint.py +++ b/contrib/gn_module_validation/backend/blueprint.py @@ -17,6 +17,7 @@ from geonature.core.gn_synthese.utils.query_select_sqla import SyntheseQuery from geonature.core.gn_permissions import decorators as permissions from geonature.core.gn_commons.models import TValidations +from geonature.core.gn_profiles.models import VConsistancyData from .models import VSyntheseValidation @@ -61,6 +62,7 @@ def get_synthese_data(info_role): else: result_limit = blueprint.config["NB_MAX_OBS_MAP"] + join = VSyntheseValidation.__table__.join(VConsistancyData, VSyntheseValidation.id_synthese == VConsistancyData.id_synthese) query = ( select( [ @@ -83,15 +85,18 @@ def get_synthese_data(info_role): VSyntheseValidation.altitude_max, VSyntheseValidation.unique_id_sinp, VSyntheseValidation.meta_update_date, + VConsistancyData.score ] ) + # .select_from(join) .where(VSyntheseValidation.the_geom_4326.isnot(None)) .order_by(VSyntheseValidation.date_min.desc()) ) validation_query_class = SyntheseQuery(VSyntheseValidation, query, filters) validation_query_class.filter_query_all_filters(info_role) result = DB.engine.execute( - validation_query_class.query.limit(result_limit)) + validation_query_class.query.limit(result_limit) + ) nb_total = 0 @@ -117,6 +122,7 @@ def get_synthese_data(info_role): "cd_nom": r["cd_nom"], "unique_id_sinp": str(r["unique_id_sinp"]), "meta_update_date": str(r["meta_update_date"]), + "score": r["score"] } geojson = ast.literal_eval(r["geojson"]) geojson["properties"] = properties diff --git a/contrib/gn_module_validation/frontend/app/components/validation-synthese-list/validation-synthese-list.component.html b/contrib/gn_module_validation/frontend/app/components/validation-synthese-list/validation-synthese-list.component.html index 274f8af52e..9fe3a8361b 100644 --- a/contrib/gn_module_validation/frontend/app/components/validation-synthese-list/validation-synthese-list.component.html +++ b/contrib/gn_module_validation/frontend/app/components/validation-synthese-list/validation-synthese-list.component.html @@ -127,6 +127,38 @@ + + + Score + + +
+ close + check + warning +
+ +
+
+ diff --git a/frontend/src/app/shared/syntheseSharedModule/synthese-info-obs/synthese-info-obs.component.ts b/frontend/src/app/shared/syntheseSharedModule/synthese-info-obs/synthese-info-obs.component.ts index adff92ab9e..1de6bb56e0 100644 --- a/frontend/src/app/shared/syntheseSharedModule/synthese-info-obs/synthese-info-obs.component.ts +++ b/frontend/src/app/shared/syntheseSharedModule/synthese-info-obs/synthese-info-obs.component.ts @@ -7,7 +7,7 @@ import { AppConfig } from '@geonature_config/app.config'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { MediaService } from '@geonature_common/service/media.service'; import { finalize } from 'rxjs/operators'; -import { Color, BaseChartDirective, Label } from "ng2-charts"; +import { Color, BaseChartDirective } from "ng2-charts"; import { ChartDataSets, ChartOptions, ChartType } from 'chart.js'; @Component({ diff --git a/frontend/src/styles.scss b/frontend/src/styles.scss index 024c9398cd..ce236cf5f7 100644 --- a/frontend/src/styles.scss +++ b/frontend/src/styles.scss @@ -177,6 +177,14 @@ footer { color: red; } +.warning { + color: orange; +} + +.success { + color:green; +} + .btn-no-padding { padding: 0px !important; }