Projet

Général

Profil

Development #75793

Mis à jour par Lauréline Guérin il y a environ un an

Actuellement on ajoute toujours une evol, mais sur statut qui boucle sur lui-même ça crée beaucoup trop d'evolutions vides.

Le code:
<pre>
with get_publisher().substitutions.freeze():
# record a workflow event with a link to current workflow & action
target_data.record_workflow_event(
'workflow-edited',
external_workflow_id=self.parent.parent.id,
external_status_id=self.parent.id,
external_item_id=self.id,
)
evo = Evolution()
evo.time = time.localtime()
evo.status = target_data.status
target_data.evolution.append(evo)
ContentSnapshotPart.take(formdata=target_data, old_data=old_data)
target_data.store()
</pre>

Faire un peu comme dans la méthode @jump_status@ de @FormData@ ?
<pre>
elif (
self.status == status
and self.evolution[-1].status == status
and not self.evolution[-1].comment
and not [x for x in self.evolution[-1].parts or [] if not isinstance(x, ContentSnapshotPart)]
):
# if status do not change and last evolution is empty,
# just update last jump time on last evolution, do not add one
self.evolution[-1].last_jump_datetime = datetime.datetime.now()
self.store()
return
</pre>

=> si old_data==new_data et que la dernière évol ne contient pas de ni commentaire et pas autre chose qu'un ni snapshot, ne rien faire ?

Retour