@@ -82,9 +82,7 @@ def ficheOrganism(id_organism):
8282 update_most_obs_taxons = []
8383 for taxon in mostObsTaxs :
8484 taxon_info = vmTaxrefRepository .searchEspece (taxon ["cd_ref" ])
85- photo = vmMedias .getFirstPhoto (
86- taxon ["cd_ref" ], current_app .config ["ATTR_MAIN_PHOTO" ]
87- )
85+ photo = vmMedias .getFirstPhoto (taxon ["cd_ref" ], current_app .config ["ATTR_MAIN_PHOTO" ])
8886 taxon = {** taxon , ** taxon_info ["taxonSearch" ]}
8987 taxon ["photo" ] = photo
9088 update_most_obs_taxons .append (taxon )
@@ -112,25 +110,40 @@ def ficheOrganism(id_organism):
112110@main .route ("/" , methods = ["GET" , "POST" ])
113111def index ():
114112
113+ nb_taxons = None
114+ listTaxons = []
115115 if current_app .config ["AFFICHAGE_TERRITOIRE_OBS" ]:
116- listTaxons = vmTaxonsRepository .getTaxonsTerritory ()
117- else :
118- listTaxons = []
116+ nb_taxons = vmTaxonsRepository .get_nb_taxons ()
117+ listTaxons = vmTaxonsRepository .getListTaxon (
118+ params = {
119+ "page" : 0
120+ }
121+ )
122+
119123
120124 # si AFFICHAGE_TERRITOIRE_OBS on charge les données en AJAX
121125 # si AFFICHAGE_DERNIERES_OBS = False, on ne charge pas les obs
122- if current_app .config ["AFFICHAGE_TERRITOIRE_OBS" ] or not current_app .config ["AFFICHAGE_DERNIERES_OBS" ]:
126+ if (
127+ current_app .config ["AFFICHAGE_TERRITOIRE_OBS" ]
128+ or not current_app .config ["AFFICHAGE_DERNIERES_OBS" ]
129+ ):
123130 observations = []
124- elif current_app .config ["AFFICHAGE_DERNIERES_OBS" ]:
131+ observations_mailles = None
132+ if current_app .config ["AFFICHAGE_DERNIERES_OBS" ]:
133+ # on charge les observations point meme si on est en mode maille pour afficher
134+ # la liste des dernières obs
135+ observations = vmObservationsRepository .getObservationsChilds (
136+ params = {
137+ "last_obs" : str (current_app .config ["NB_DAY_LAST_OBS" ]) + " day" ,
138+ "fields" : "taxons,medias"
139+ },
140+ )
125141 if current_app .config ["AFFICHAGE_MAILLE" ]:
126- observations = vmObservationsMaillesRepository .lastObservationsMailles (
127- str (current_app .config ["NB_DAY_LAST_OBS" ]) + " day" ,
128- current_app .config ["ATTR_MAIN_PHOTO" ],
129- )
130- else :
131- observations = vmObservationsRepository .lastObservations (
132- str (current_app .config ["NB_DAY_LAST_OBS" ]) + " day" ,
133- current_app .config ["ATTR_MAIN_PHOTO" ],
142+ observations_mailles = vmObservationsMaillesRepository .getObservationsMaillesChilds (
143+ params = {
144+ "last_obs" : str (current_app .config ["NB_DAY_LAST_OBS" ]) + " day" ,
145+ "fields" : "taxons,ids_obs"
146+ }
134147 )
135148
136149 if current_app .config ["AFFICHAGE_EN_CE_MOMENT" ]:
@@ -149,20 +162,23 @@ def index():
149162 lastDiscoveries = vmObservationsRepository .getLastDiscoveries ()
150163 else :
151164 lastDiscoveries = []
152-
165+ group2_inpn = vmTaxonsRepository . get_group_inpn ( "group2_inpn" )
153166 personal_data = False
154167 args_personal_data = request .args .get ("personal_data" )
155168 if args_personal_data and args_personal_data .lower () == "true" :
156169 personal_data = True
157170
158171 return render_template (
159172 "templates/home/_main.html" ,
160- listTaxons = listTaxons ,
161173 observations = observations ,
174+ observations_mailles = observations_mailles ,
162175 mostViewTaxon = mostViewTaxon ,
163176 customStatMedias = customStatMedias ,
164177 lastDiscoveries = lastDiscoveries ,
165178 personal_data = personal_data ,
179+ group2_inpn = group2_inpn ,
180+ listTaxons = listTaxons ,
181+ nb_taxons = nb_taxons
166182 )
167183
168184
@@ -185,9 +201,7 @@ def ficheEspece(cd_nom):
185201 areas = vmAreasRepository .getAreasObservationsChilds (cd_ref )
186202 taxonomyHierarchy = vmTaxrefRepository .getAllTaxonomy (cd_ref )
187203 firstPhoto = vmMedias .getFirstPhoto (cd_ref , current_app .config ["ATTR_MAIN_PHOTO" ])
188- photoCarousel = vmMedias .getPhotoCarousel (
189- cd_ref , current_app .config ["ATTR_OTHER_PHOTO" ]
190- )
204+ photoCarousel = vmMedias .getPhotoCarousel (cd_ref , current_app .config ["ATTR_OTHER_PHOTO" ])
191205 videoAudio = vmMedias .getVideo_and_audio (
192206 cd_ref ,
193207 current_app .config ["ATTR_AUDIO" ],
@@ -299,29 +313,43 @@ def is_statut_in_groupe(statut, groupe):
299313@main .route ("/<lang_code>/area/<int:id_area>" , methods = ["GET" , "POST" ])
300314@main .route ("/area/<int:id_area>" , methods = ["GET" , "POST" ])
301315def ficheArea (id_area ):
302- listTaxons = vmTaxonsRepository .getTaxonsAreas (id_area )
303316 area = vmAreasRepository .getAreaFromIdArea (id_area )
304317 stats_area = vmAreasRepository .getStatsByArea (id_area )
318+ listTaxons = vmTaxonsRepository .getListTaxon (
319+ id_area = id_area ,
320+ params = {
321+ "page" : 0
322+ }
323+ )
324+ group2_inpn = vmTaxonsRepository .get_group_inpn ("group2_inpn" )
305325 return render_template (
306326 "templates/areaSheet/_main.html" ,
307- listTaxons = listTaxons ,
308327 stats_area = stats_area ,
309328 areaInfos = area ,
310329 id_area = id_area ,
330+ listTaxons = listTaxons ,
331+ group2_inpn = group2_inpn
311332 )
312333
313334
314335@main .route ("/<lang_code>/liste/<int(signed=True):cd_ref>" , methods = ["GET" , "POST" ])
315336@main .route ("/liste/<int(signed=True):cd_ref>" , methods = ["GET" , "POST" ])
316- def ficheRangTaxonomie (cd_ref ):
317- listTaxons = vmTaxonsRepository .getTaxonsChildsList ( cd_ref )
337+ def ficheRangTaxonomie (cd_ref = None ):
338+ nb_taxons = vmTaxonsRepository .get_nb_taxons ( cd_ref = cd_ref )
318339 referenciel = vmTaxrefRepository .getInfoFromCd_ref (cd_ref )
319340 taxonomyHierarchy = vmTaxrefRepository .getAllTaxonomy (cd_ref )
320341 observers = vmObservationsRepository .getObservers (cd_ref )
342+ listTaxons = vmTaxonsRepository .getListTaxon (
343+ cd_ref = cd_ref ,
344+ params = {
345+ "page" : 0
346+ }
347+ )
321348
322349 return render_template (
323350 "templates/taxoRankSheet/_main.html" ,
324351 listTaxons = listTaxons ,
352+ nb_taxons = nb_taxons ,
325353 referenciel = referenciel ,
326354 taxonomyHierarchy = taxonomyHierarchy ,
327355 observers = observers ,
@@ -332,12 +360,19 @@ def ficheRangTaxonomie(cd_ref):
332360@main .route ("/groupe/<groupe>" , methods = ["GET" , "POST" ])
333361def ficheGroupe (groupe ):
334362 groups = vmTaxonsRepository .getAllINPNgroup ()
335- listTaxons = vmTaxonsRepository .getTaxonsGroup ( groupe )
363+ nb_taxons = vmTaxonsRepository .get_nb_taxons ( group_name = groupe )
336364 observers = vmObservationsRepository .getGroupeObservers (groupe )
365+ listTaxons = vmTaxonsRepository .getListTaxon (
366+ group_name = groupe ,
367+ params = {
368+ "page" : 0
369+ }
370+ )
337371
338372 return render_template (
339373 "templates/groupSheet/_main.html" ,
340374 listTaxons = listTaxons ,
375+ nb_taxons = nb_taxons ,
341376 referenciel = groupe ,
342377 groups = groups ,
343378 observers = observers ,
@@ -351,8 +386,6 @@ def photos():
351386 return render_template ("templates/photoGalery/_main.html" , groups = groups )
352387
353388
354-
355-
356389@main .route ("/<lang_code>/static/<page>" , methods = ["GET" , "POST" ])
357390@main .route ("/static_pages/<page>" , methods = ["GET" , "POST" ])
358391def get_staticpages (page ):
0 commit comments