Skip to content

Commit

Permalink
[merge common code] Fixed action/get
Browse files Browse the repository at this point in the history
  • Loading branch information
m431m committed Dec 7, 2020
1 parent 21d216d commit 1c0b997
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions ckan/logic/action/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -1974,38 +1974,45 @@ def package_search(context, data_dict):
for key_, value_ in value.items():
new_facet_dict = {}
new_facet_dict['name'] = key_

if key in ('groups', 'organization'):
display_name = group_titles_by_name.get(key_, key_)
display_name = display_name if display_name and display_name.strip() else key_
new_facet_dict['display_name'] = display_name

elif key == 'license_id':
license = model.Package.get_license_register().get(key_)
if license:
new_facet_dict['display_name'] = license.title
else:
new_facet_dict['display_name'] = key_

elif key == 'support':
# ADAPTER EN FONCTION DE LA PLATEFORME
if key_ == 'region-paca':
display_name = u"Région Sud"
elif key_ == 'crige-paca':
display_name = "CRIGE PACA"
else:
display_name = key_
new_facet_dict['display_name'] = display_name

elif key == 'datatype':
if key_ == 'donnees-intelligentes':
# ADAPTER EN FONCTION DE LA PLATEFORME
if key_ == 'donnees-moissonnees':
display_name = u"Données moissonnées"
elif key_ == 'donnees-intelligentes':
display_name = u"Données intelligentes"
elif key_ == 'donnees-ouvertes':
display_name = u"Données ouvertes"
elif key_ == 'donnees-geographiques':
display_name = u"Données géographiques"
elif key_ == 'donnees-moissonnees':
display_name = u"Données moissonnées"
else:
display_name = key_
new_facet_dict['display_name'] = display_name

elif key == 'frequency':
# ADAPTER EN FONCTION DE LA PLATEFORME
if key_ == 'asneeded':
display_name = u"Lorsque nécessaire"
elif key_ == 'never':
Expand All @@ -2032,25 +2039,30 @@ def package_search(context, data_dict):
display_name = u"Bi-annuelle"
elif key_ == 'unknown':
display_name = u"Inconnue"
else:
display_name = key_
new_facet_dict['display_name'] = display_name

elif key == 'granularity':
# ADAPTER EN FONCTION DE LA PLATEFORME
if key_ == 'indefinie':
display_name = u"Indéfinie"
if key_ == 'region':
elif key_ == 'region':
display_name = u"Région"
if key_ == 'departement':
elif key_ == 'departement':
display_name = u"Département"
if key_ == 'epci':
elif key_ == 'epci':
display_name = u"Intercommunalité (EPCI)"
if key_ == 'commune':
elif key_ == 'commune':
display_name = u"Commune"
if key_ == 'iris':
elif key_ == 'iris':
display_name = u"IRIS (quartiers INSEE)"
if key_ == 'parcelle-cadastrale':
elif key_ == 'parcelle-cadastrale':
display_name = u"Parcelle cadastrale"
if key_ == 'poi':
elif key_ == 'poi':
display_name = u"Point d’interêt (POI)"
else:
display_name = key_
new_facet_dict['display_name'] = display_name

else:
Expand Down

0 comments on commit 1c0b997

Please sign in to comment.