Skip to content

Commit

Permalink
Add score column in validation #1105
Browse files Browse the repository at this point in the history
  • Loading branch information
TheoLechemia committed Oct 30, 2020
1 parent 8eed380 commit b88bd86
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 2 deletions.
8 changes: 7 additions & 1 deletion contrib/gn_module_validation/backend/blueprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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(
[
Expand All @@ -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

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,38 @@
</ng-template>
</ngx-datatable-column>

<ngx-datatable-column maxWidth="60">
<ng-template
let-column="column"
ngx-datatable-header-template
>
<span>Score</span>
</ng-template>
<ng-template
let-row="row"
ngx-datatable-cell-template
>
<div [ngSwitch]="row.score">
<mat-icon
*ngSwitchCase="'0'"
class="error"
matTooltip="Aucune information de l'observation ne concorde avec le profil du taxon"
> close </mat-icon>
<mat-icon
*ngSwitchCase="'3'"
class="success"
matTooltip="Toutes les informations de l'observation concordent avec le profil du taxon"
> check </mat-icon>
<mat-icon
*ngSwitchDefault
class="warning"
matTooltip="Toutes les informations de l'observation ne concordent pas avec le profil du taxon"
> warning </mat-icon>
</div>

</ng-template>
</ngx-datatable-column>




Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
8 changes: 8 additions & 0 deletions frontend/src/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,14 @@ footer {
color: red;
}

.warning {
color: orange;
}

.success {
color:green;
}

.btn-no-padding {
padding: 0px !important;
}
Expand Down

2 comments on commit b88bd86

@camillemonchicourt
Copy link
Member

Choose a reason for hiding this comment

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

Que si le paramètre d'activation des profils est activé ?

@DonovanMaillard
Copy link
Contributor

Choose a reason for hiding this comment

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

Pas encore, quand on aura tout qui marche on fera les paramètres ;)

Please sign in to comment.