Skip to content
Extraits de code Groupes Projets
Valider 184819a8 rédigé par Nicolas Joyard's avatar Nicolas Joyard
Parcourir les fichiers

Give a title to untitled recommendations

parent 233f7349
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -24,9 +24,9 @@ class RecommendationImporter: ...@@ -24,9 +24,9 @@ class RecommendationImporter:
if dossier is None: if dossier is None:
ref = dossier_mappings.get(title, None) ref = dossier_mappings.get(title, None)
if ref is not None: if ref is not None:
query = { 'reference':ref } query = {'reference': ref}
else: else:
query = { 'title__iexact': title } query = {'title__iexact': title}
try: try:
dossier = Dossier.objects.get(**query) dossier = Dossier.objects.get(**query)
...@@ -67,6 +67,9 @@ class RecommendationImporter: ...@@ -67,6 +67,9 @@ class RecommendationImporter:
return False return False
weight = int(row['weight']) * int(row['ponderation']) weight = int(row['weight']) * int(row['ponderation'])
descr = row['description'].strip()
if len(descr) == 0:
descr = '%s on %s' % (row['part'], dossier.reference)
try: try:
recom = Recommendation.objects.get(proposal=proposal) recom = Recommendation.objects.get(proposal=proposal)
...@@ -74,7 +77,7 @@ class RecommendationImporter: ...@@ -74,7 +77,7 @@ class RecommendationImporter:
recom = Recommendation( recom = Recommendation(
proposal=proposal, proposal=proposal,
recommendation=row['recommendation'], recommendation=row['recommendation'],
title=row['description'], title=descr,
weight=weight weight=weight
) )
recom.save() recom.save()
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter