Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev-cobiodiv-organisms #330

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
22626ff
first implementation of organism without materialized view yet
Jul 21, 2021
d09fc15
correction d'une faute
Jul 22, 2021
d97fd99
specie.sheet button replacement
Jul 22, 2021
647da44
change badge for specie.sheet button
Jul 22, 2021
20cd405
route modification in .gitignore
corentinlange Jul 23, 2021
1418a2b
changes in .gitignore
corentinlange Jul 23, 2021
ea028c4
Squashed commit of the following:
corentinlange Jul 23, 2021
7345536
Last changement
Jul 23, 2021
b400376
Merge branch 'dev-cobiodiv-specie-improve' into dev-cobiodiv
Aug 2, 2021
c706f03
First add for organisms sheets
Aug 2, 2021
cb82886
Added new values to orgnisms pages + translations + config.py infos
Aug 3, 2021
30b09d7
adding graph on organismSheets + modifications
Aug 4, 2021
147cd45
Amélioration icones organismes fiche espèce,
corentinlange Aug 5, 2021
f305bf0
Correction glossaire et traductions
corentinlange Aug 5, 2021
8609e76
Updated charts
corentinlange Aug 5, 2021
3d777cf
Deactivated mapObs in organismSheet
corentinlange Aug 5, 2021
61e19fd
ORGANISM_MODULE activable or not with config.py
corentinlange Aug 5, 2021
9d630f9
move listEspece to the good place
Aug 5, 2021
f260ce7
move listEspece.js in the good folder
corentinlange Aug 5, 2021
df74c33
modifying color on chart_organisms
corentinlange Aug 5, 2021
52ef286
Update layout.html
Adrien-Pajot Aug 5, 2021
8eb679f
Update VM_observation SQL
Adrien-Pajot Aug 5, 2021
b31dd65
t_subdivided_territory minor orthograph correction
Adrien-Pajot Aug 5, 2021
e7a068c
atlas.vm_observations minor changes
Adrien-Pajot Aug 5, 2021
7a25ed9
Merge branch 'dev-cobiodiv-organisms' of https://github.com/corentinl…
corentinlange Aug 6, 2021
8cb8c6b
Merge remote-tracking branch 'upstream/dev-cobiodiv'
corentinlange Aug 6, 2021
1be6ae2
fix : topSpecie -> topSpecies
corentinlange Aug 6, 2021
2cc960d
fix(DB) : Back to old sql scripts
corentinlange Aug 6, 2021
e8e1cf8
fix : .gitignore problem
corentinlange Aug 6, 2021
c78ed62
fix : HTML better format
corentinlange Aug 6, 2021
f2e5a94
fix : all organisms variables are now in english
corentinlange Aug 6, 2021
42926a2
fix : change 'organisme' files to 'organism'
corentinlange Aug 6, 2021
8a254e3
fix : some more fixes about empty lines
corentinlange Aug 6, 2021
91ddea1
fix (DB) : corrected problems with SQL scripts
corentinlange Aug 6, 2021
f63f3a1
fix(lang) : added some translations
corentinlange Aug 6, 2021
ac5b0f6
fix(lang) : added some translations
corentinlange Aug 6, 2021
940d0b7
fix(lang) : added some translations
corentinlange Aug 6, 2021
0520bb8
fix(lang) : added some translations
corentinlange Aug 6, 2021
ad61e25
fix(DB): go back to sql scripts from develop branch with organisms VM
corentinlange Aug 6, 2021
65ba604
Merge branch 'dev-cobiodiv-organisms' of https://github.com/corentinl…
Aug 6, 2021
8c5069c
organisme and not organism
Adrien-Pajot Aug 9, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
log/*
atlas/static/conf/custom.js
atlas/debug.py

robots.txt
.htaccess
venv/*
Expand All @@ -11,6 +10,9 @@ venv3/*
atlas/configuration/config.py
atlas/configuration/settings.ini

atlas/static/conf/custom.js
atlas/static/territoire.json
atlas/static/images/ancien
atlas/static/node_modules
atlas/static/territoire.json
atlas/static/images/ancie
Expand Down
56 changes: 54 additions & 2 deletions atlas/atlasRoutes.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from atlas.configuration import config
from atlas.modeles.entities import vmTaxons, vmCommunes
from atlas.modeles.repositories import (
vmOrganismsRepository,
vmTaxonsRepository,
vmObservationsRepository,
vmAltitudesRepository,
Expand Down Expand Up @@ -77,6 +78,50 @@ def especeMedias(image):
+ image
)

# Activating organisms sheets routes
if config.ORGANISM_MODULE:
@main.route("/organism/<int:id_organism>", methods=["GET", "POST"])
def ficheOrganism(id_organism):
db_session = utils.loadSession()
connection = utils.engine.connect()

infos_organism = vmOrganismsRepository.statOrganism(connection, id_organism)

stat = vmObservationsRepository.statIndex(connection)

mostObsTaxs=vmOrganismsRepository.topObsOrganism(connection, id_organism)

top_taxons=list()
photos=list()

for taxons in mostObsTaxs:
top_taxons.append(vmTaxrefRepository.searchEspece(connection, taxons['cd_ref']))
photos.append(vmMedias.getFirstPhoto(connection, taxons['cd_ref'], current_app.config["ATTR_MAIN_PHOTO"]))

stats_group=vmOrganismsRepository.getTaxonRepartitionOrganism(connection, id_organism)

connection.close()
db_session.close()

return render_template(
"templates/organismSheet/_main.html",
nom_organism = infos_organism['nom_organism'],
adresse_organism = infos_organism['adresse_organism'],
cp_organism = infos_organism['cp_organism'],
ville_organism = infos_organism['ville_organism'],
tel_organism = infos_organism['tel_organism'],
url_organism = infos_organism['url_organism'],
url_logo = infos_organism['url_logo'],
nb_taxons = infos_organism['nb_taxons'],
nb_obs = infos_organism['nb_obs'],

stat = stat,
mostObsTaxs = mostObsTaxs,
top_taxons = top_taxons,
photos = photos,
stats_group = stats_group
)


@main.route(
"/commune/" + current_app.config["REMOTE_MEDIAS_PATH"] + "<image>",
Expand Down Expand Up @@ -134,15 +179,15 @@ def index():
current_app.logger.debug("start AFFICHAGE_MAILLE")
observations = vmObservationsMaillesRepository.lastObservationsMailles(
connection,
current_app.config["NB_DAY_LAST_OBS"],
str(current_app.config["NB_DAY_LAST_OBS"]) + ' day',
current_app.config["ATTR_MAIN_PHOTO"],
)
current_app.logger.debug("end AFFICHAGE_MAILLE")
else:
current_app.logger.debug("start AFFICHAGE_PRECIS")
observations = vmObservationsRepository.lastObservations(
connection,
current_app.config["NB_DAY_LAST_OBS"],
str(current_app.config["NB_DAY_LAST_OBS"]) + ' day',
current_app.config["ATTR_MAIN_PHOTO"],
)
current_app.logger.debug("end AFFICHAGE_PRECIS")
Expand All @@ -169,6 +214,8 @@ def index():
customStat = []
customStatMedias = []

lastDiscoveries=vmObservationsRepository.getLastDiscoveries(connection)

connection.close()
session.close()

Expand All @@ -179,6 +226,7 @@ def index():
stat=stat,
customStat=customStat,
customStatMedias=customStatMedias,
lastDiscoveries=lastDiscoveries,
)


Expand Down Expand Up @@ -225,6 +273,9 @@ def ficheEspece(cd_ref):
)
observers = vmObservationsRepository.getObservers(connection, cd_ref)

organisms = vmOrganismsRepository.getListOrganism(connection, cd_ref)


connection.close()
db_session.close()

Expand All @@ -245,6 +296,7 @@ def ficheEspece(cd_ref):
articles=articles,
taxonDescription=taxonDescription,
observers=observers,
organisms=organisms
)


Expand Down
8 changes: 8 additions & 0 deletions atlas/configuration/config.py.example
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ NOM_APPLICATION = "Nom de l application"
# ex "/atlas" pour une URL: http://mon-domaine/atlas OU "" si l'application est accessible à la racine du domaine
URL_APPLICATION = ""

#################################
#################################
###### Modules activation #######
#################################
#################################

# Organism module : organism's sheet + organism participation on specie sheet
ORGANISM_MODULE = False

###########################
###### Multilingual #######
Expand Down
12 changes: 11 additions & 1 deletion atlas/configuration/config.py.sample
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ NOM_APPLICATION = "Nom de l application"
# ex "/atlas" pour une URL: http://mon-domaine/atlas OU "" si l'application est accessible à la racine du domaine
URL_APPLICATION = "/atlas"

#################################
#################################
###### Modules activation #######
#################################
#################################

# Organism module : organism's sheet + organism participation on specie sheet
ORGANISM_MODULE = False

###########################
###### Multilingual #######
Expand All @@ -35,7 +43,9 @@ MULTILINGUAL = True
###########################
# If multilingual is activated configure under

# Available languages
# Available languages
# Don't delete even if you uninstall MULTILINGUAL
# You need to add your own default language(BABEL_DEFAULT_LOCALE) here if it's not present
# Check documentation for adding another language
LANGUAGES = {
'en': {
Expand Down
1 change: 1 addition & 0 deletions atlas/configuration/config_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class AtlasConfig(Schema):
BABEL_DEFAULT_LOCALE = fields.String(missing="")
MULTILINGUAL = fields.Boolean(missing=True)
ID_GOOGLE_ANALYTICS = fields.String(missing="UA-xxxxxxx-xx")
ORGANISM_MODULE = fields.Boolean(missing="False")
GLOSSAIRE = fields.Boolean(missing=False)
IGNAPIKEY = fields.String(missing="")
AFFICHAGE_INTRODUCTION = fields.Boolean(missing=True)
Expand Down
99 changes: 82 additions & 17 deletions atlas/messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2021-07-30 16:52+0200\n"
"POT-Creation-Date: 2021-08-06 15:08+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand All @@ -17,6 +17,19 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.9.1\n"

#: static/custom/templates/introduction.html:6
msgid "welcome.message"
msgstr ""

#: static/custom/templates/introduction.html:8
msgid "home.introduction.message"
msgstr ""

#: static/custom/templates/introduction.html:11
#: templates/specieSheet/blocInfos.html:17
msgid "read.more"
msgstr ""

#: static/custom/templates/presentation.html:11
msgid "My custom presentation"
msgstr ""
Expand All @@ -25,11 +38,11 @@ msgstr ""
msgid "municipality.of"
msgstr ""

#: templates/areaSheet/_main.html:76
#: templates/areaSheet/_main.html:71
msgid "last.obs.municipality"
msgstr ""

#: templates/areaSheet/_main.html:79
#: templates/areaSheet/_main.html:74
msgid "last.obs.zone"
msgstr ""

Expand All @@ -55,13 +68,15 @@ msgstr ""

#: templates/core/listTaxons.html:80 templates/core/statHierarchy.html:5
#: templates/home/globalStats.html:13 templates/home/lastObs.html:7
#: templates/specieSheet/map.html:15
#: templates/organismSheet/topSpecies.html:60 templates/specieSheet/map.html:15
msgid "observation"
msgstr ""

#: templates/core/listTaxons.html:81 templates/core/statHierarchy.html:5
#: templates/core/tabTaxons.html:19 templates/home/globalStats.html:13
#: templates/home/lastObs.html:7 templates/specieSheet/identityCard.html:131
#: templates/home/lastObs.html:7 templates/organismSheet/statsInfos.html:11
#: templates/organismSheet/topSpecies.html:60
#: templates/specieSheet/identityCard.html:131
#: templates/specieSheet/map.html:15
msgid "observations"
msgstr ""
Expand All @@ -71,12 +86,14 @@ msgid "last.obs.in"
msgstr ""

#: templates/core/listTaxons.html:86 templates/core/tabTaxons.html:85
#: templates/home/lastObs.html:42 templates/specieSheet/identityCard.html:173
#: templates/home/lastObs.html:42 templates/organismSheet/topSpecies.html:65
#: templates/specieSheet/identityCard.html:173
msgid "check.specie.sheet"
msgstr ""

#: templates/core/listTaxons.html:87 templates/home/lastObs.html:43
#: templates/home/mostViewNow.html:31 templates/home/taxoRank.html:57
#: templates/organismSheet/topSpecies.html:66
msgid "specie.sheet"
msgstr ""

Expand All @@ -103,7 +120,7 @@ msgid "gallery.title"
msgstr ""

#: templates/core/statHierarchy.html:9 templates/home/globalStats.html:22
#: templates/home/taxoRank.html:28
#: templates/home/taxoRank.html:28 templates/organismSheet/statsInfos.html:21
msgid "species"
msgstr ""

Expand All @@ -112,12 +129,12 @@ msgid "specie"
msgstr ""

#: templates/core/statHierarchy.html:12 templates/specieSheet/map.html:25
#: templates/specieSheet/otherInformations.html:19
#: templates/specieSheet/otherInformations.html:29
msgid "observers"
msgstr ""

#: templates/core/statHierarchy.html:12 templates/specieSheet/map.html:25
#: templates/specieSheet/otherInformations.html:19
#: templates/specieSheet/otherInformations.html:29
msgid "observer"
msgstr ""

Expand Down Expand Up @@ -202,6 +219,42 @@ msgstr ""
msgid "species.to.discover"
msgstr ""

#: templates/organismSheet/blocInfos.html:4
msgid "other.informations"
msgstr ""

#: templates/organismSheet/groupChart.html:3
msgid "part.graph"
msgstr ""

#: templates/organismSheet/identityCard.html:19
msgid "Région/département rattaché"
msgstr ""

#: templates/organismSheet/identityCard.html:20
msgid "Téléphone"
msgstr ""

#: templates/organismSheet/mapObs.html:5
msgid "map.observations"
msgstr ""

#: templates/organismSheet/statsInfos.html:4
msgid "organism.stats"
msgstr ""

#: templates/organismSheet/statsInfos.html:16
msgid "atlas.participation"
msgstr ""

#: templates/organismSheet/topSpecies.html:5
msgid "top.specie"
msgstr ""

#: templates/organismSheet/topSpecies.html:61
msgid "from.organism.observations"
msgstr ""

#: templates/photoGalery/_main.html:64
msgid "all.groups.tooltip"
msgstr ""
Expand All @@ -220,14 +273,10 @@ msgstr ""

#: templates/specieSheet/blocInfos.html:14
#: templates/specieSheet/descriptionMedia.html:16
#: templates/specieSheet/otherInformations.html:57
#: templates/specieSheet/otherInformations.html:69
msgid "description"
msgstr ""

#: templates/specieSheet/blocInfos.html:17
msgid "read.more"
msgstr ""

#: templates/specieSheet/blocInfos.html:19
msgid "environment"
msgstr ""
Expand Down Expand Up @@ -259,7 +308,7 @@ msgid "monthly.obs"
msgstr ""

#: templates/specieSheet/descriptionMedia.html:12
#: templates/specieSheet/otherInformations.html:30
#: templates/specieSheet/otherInformations.html:42
msgid "author"
msgstr ""

Expand All @@ -275,14 +324,30 @@ msgstr ""
msgid "first.obs"
msgstr ""

#: templates/specieSheet/otherInformations.html:29
#: templates/specieSheet/otherInformations.html:22
msgid "organisms"
msgstr ""

#: templates/specieSheet/otherInformations.html:22
msgid "organism"
msgstr ""

#: templates/specieSheet/otherInformations.html:41
msgid "title"
msgstr ""

#: templates/specieSheet/otherInformations.html:59
#: templates/specieSheet/otherInformations.html:71
msgid "date"
msgstr ""

#: templates/specieSheet/otherInformations.html:144
msgid "check.organism.sheet"
msgstr ""

#: templates/specieSheet/otherInformations.html:145
msgid "organism.sheet"
msgstr ""

#: templates/taxoRankSheet/_main.html:47
msgid "specie.obs.for.tax"
msgstr ""
Expand Down
Loading