Bug #1228
crash export stat avec les "vieux" formdata
Statut:
Fermé
Priorité:
Normal
Assigné à:
-
Version cible:
-
Début:
18 janvier 2012
Echéance:
% réalisé:
90%
Temps estimé:
Patch proposed:
Planning:
Description
Si on est sur un site avec des formdata "anciens" qui n'ont pas de champ "Evolution", il y a un crash sur la page statistiques :
Exception: type = '<type 'exceptions.TypeError'>', value = ''NoneType' object is unsubscriptable' Stack trace (most recent call first): File "/usr/lib/pymodules/python2.6/wcs/backoffice/root.ptl", line 446, in stats_resolution_time 444 res_time_forms = [ 445 (time.mktime(x.evolution[-1].time) - time.mktime(x.receipt_time)) \ > 446 for x in values if x.status == status] 447 if not res_time_forms: 448 continue locals: status = <htmltext 'wf-1'> status_id = '1' self = <wcs.backoffice.root.FormPage object at 0x3ee7f10> possible_status_id = ['1', '2', '3', '4', '5', '6'] _q_output = <TemplateIO object at 0x1edac70> $list0 = [] values = [<wcs.formdef.Demande-De-Travaux-Communication object at 0x2d51550>, <wcs.formdef.Demande-De-Travaux-Communication object at 0x201cc10>] possible_status = [<htmltext 'wf-1'>, <htmltext 'wf-2'>, <htmltext 'wf-3'>, <htmltext 'wf-4'>, <htmltext 'wf-5'>, <htmltext 'wf-6'>] x = <wcs.formdef.Demande-De-Travaux-Communication object at 0x201cc10>
(note : cela n'arrivera pas sur les nouveaux sites, car dans les nouvelles version de wcs tous les formdata ont un champ "evolution" par défaut)
Révisions associées
Historique
Mis à jour par Thomas Noël il y a plus de 12 ans
après un temps de reflexion trop long (c'est mercredi), je me dis que ça sert à rien du tout de faire des calculs pour les formdata qui n'ont pas eu d'évolution, donc :
--- wcs/backoffice/root.ptl (révision 2240) +++ wcs/backoffice/root.ptl (copie de travail) @@ -443,7 +443,7 @@ for status, status_id in zip(possible_status, possible_status_id): res_time_forms = [ (time.mktime(x.evolution[-1].time) - time.mktime(x.receipt_time)) \ - for x in values if x.status == status] + for x in values if x.status == status and x.evolution] if not res_time_forms: continue res_time_forms.sort()
Mis à jour par Thomas Noël il y a plus de 12 ans
- % réalisé changé de 0 à 90
Appliqué par commit r2243.
Mis à jour par Thomas Noël il y a plus de 12 ans
- Statut changé de Solution déployée à Résolu (à déployer)
Mis à jour par Thomas Noël il y a plus de 12 ans
hotfix posé sur la production (via un patch manuel)
Mis à jour par Frédéric Péters il y a plus de 10 ans
- Statut changé de Résolu (à déployer) à Fermé
fix crash on stats_resolution_time for formdata without evolution
fix #1228 http://dev.entrouvert.org/issues/1228