def METHOD_NAME(self):
    """Generate timeline."""
    completed_task_states = (
        TaskState.objects.filter(workflow_state=self.workflow_state)
        .exclude(finished_at__isnull=True)
        .exclude(status=TaskState.STATUS_CANCELLED)
    )
    METHOD_NAME = [
        {
            "time": self.workflow_state.created_at,
            "action": "workflow_started",
            "workflow_state": self.workflow_state,
        }
    ]
    if self.workflow_state.status not in (
        WorkflowState.STATUS_IN_PROGRESS,
        WorkflowState.STATUS_NEEDS_CHANGES,
    ):
        last_task = completed_task_states.order_by("finished_at").last()
        if last_task:
            METHOD_NAME.append(
                {
                    "time": last_task.finished_at + timedelta(milliseconds=1),
                    "action": "workflow_completed",
                    "workflow_state": self.workflow_state,
                }
            )
    for revision in self.revisions:
        METHOD_NAME.append(
            {
                "time": revision.created_at,
                "action": "edited",
                "revision": revision,
            }
        )
    for task_state in completed_task_states:
        METHOD_NAME.append(
            {
                "time": task_state.finished_at,
                "action": "task_completed",
                "task_state": task_state,
            }
        )
    METHOD_NAME.sort(key=lambda t: t["time"])
    METHOD_NAME.reverse()
    return METHOD_NAME