Skip to content

Commit

Permalink
linter
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Corny authored and edelclaux committed Aug 22, 2024
1 parent c988742 commit 5e91eff
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 24 deletions.
8 changes: 7 additions & 1 deletion backend/gn_module_zh/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,13 @@ def update_corine_biotopes(id_zh, corine_biotopes):

def post_corine_biotopes(id_zh, corine_biotopes):
for corine_biotope in corine_biotopes:
DB.session.add(CorZhCb(id_zh=id_zh, lb_code=corine_biotope["corinBio"]["CB_code"], cb_cover=corine_biotope["cbCover"]))
DB.session.add(
CorZhCb(
id_zh=id_zh,
lb_code=corine_biotope["corinBio"]["CB_code"],
cb_cover=corine_biotope["cbCover"],
)
)
DB.session.flush()


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,25 @@
Create Date: 2024-07-04 15:42:25.691119
"""

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '9ff769188d93'
down_revision = '76e89c793961'
revision = "9ff769188d93"
down_revision = "76e89c793961"
branch_labels = None
depends_on = None


def upgrade():
op.add_column(table_name="cor_zh_cb", column=sa.Column("cb_cover", sa.Integer, nullable=True), schema='pr_zh')
op.add_column(
table_name="cor_zh_cb",
column=sa.Column("cb_cover", sa.Integer, nullable=True),
schema="pr_zh",
)


def downgrade():
op.drop_column(table_name="cor_zh_cb", column_name="cb_cover", schema='pr_zh')
op.drop_column(table_name="cor_zh_cb", column_name="cb_cover", schema="pr_zh")
6 changes: 3 additions & 3 deletions backend/gn_module_zh/model/cards.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,9 +536,9 @@ def __str__(self):
"code": cb["lb_code"],
"label": CorineBiotope(cb["lb_code"]).__str__()["label"],
"Humidité": CorineBiotope(cb["lb_code"]).__str__()["Humidité"],
"recouvrement": cb["cb_cover"]
}
for cb in self.cb_codes_corine_biotope
"recouvrement": cb["cb_cover"],
}
for cb in self.cb_codes_corine_biotope
],
"remarques": Utils.get_string(self.remark_pres),
"ef_area": self.ef_area,
Expand Down
9 changes: 5 additions & 4 deletions backend/gn_module_zh/model/zh.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@ def get_id_references(self):

def get_cb_codes(self):
corine_biotopes = ZH.get_data_by_id(CorZhCb, self.zh.id_zh)
return {"cb_codes_corine_biotope": [
{"lb_code": cb.lb_code,
"cb_cover":cb.cb_cover}
for cb in corine_biotopes]}
return {
"cb_codes_corine_biotope": [
{"lb_code": cb.lb_code, "cb_cover": cb.cb_cover} for cb in corine_biotopes
]
}

def get_corine_landcovers(self):
landcovers = ZH.get_data_by_id(CorZhCorineCover, self.zh.id_zh)
Expand Down
23 changes: 11 additions & 12 deletions frontend/app/zh-forms/tabs/tab3/zh-form-tab3.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ export class ZhFormTab3Component implements OnInit {
public currentZh: any;
corinBioMetaData: any;
corinTableCol = [
{ name: 'corinBio', label: 'Code Corine biotopes', subcell: { name: 'CB_code' }},
{ name: 'corinBio', label: 'Libellé Corine biotopes', subcell: { name: 'CB_label' }},
{ name: 'corinBio', label: 'Humidité', size: '5%', subcell: { name: 'CB_humidity' }},
{ name: 'corinBio', label: 'Code Corine biotopes', subcell: { name: 'CB_code' } },
{ name: 'corinBio', label: 'Libellé Corine biotopes', subcell: { name: 'CB_label' } },
{ name: 'corinBio', label: 'Humidité', size: '5%', subcell: { name: 'CB_humidity' } },
{ name: 'cbCover', label: 'Recouvrement sur la ZH (%)', size: '5%' },
];
// subcell : if the data contain a list inside the data list
Expand Down Expand Up @@ -146,10 +146,10 @@ export class ZhFormTab3Component implements OnInit {
this.currentZh.properties.cb_codes_corine_biotope.forEach((cb) => {
this.corinBioMetaData.find((item) => {
if (item.CB_code == cb.lb_code) {
this.listCorinBio.push({ "corinBio": item, "cbCover": cb.cb_cover })
this.listCorinBio.push({ corinBio: item, cbCover: cb.cb_cover });
}
})
})
});
});
}
this.currentZh.properties.activities.forEach((activity) => {
let impacts = [];
Expand Down Expand Up @@ -268,7 +268,7 @@ export class ZhFormTab3Component implements OnInit {
this.canChangeTab.emit(false);
this.patchCorinBio = false;
this.addModalBtnLabel = 'Ajouter';

this.modalTitle = "Ajout d'un habitat Corine Biotopes";
event.stopPropagation();
this.ngbModal.open(modal, {
Expand Down Expand Up @@ -449,11 +449,10 @@ export class ZhFormTab3Component implements OnInit {
this.patchCorinBio = false;
this.formCorinSubmitted = true;
if (this.corinBioForm.valid) {
this.listCorinBio.push(
{
"corinBio": this.corinBioForm.value.corinBio,
"cbCover": this.corinBioForm.value.cbCover
});
this.listCorinBio.push({
corinBio: this.corinBioForm.value.corinBio,
cbCover: this.corinBioForm.value.cbCover,
});
this.ngbModal.dismissAll();
this.corinBioForm.reset();
this.canChangeTab.emit(false);
Expand Down

0 comments on commit 5e91eff

Please sign in to comment.