Extract logic from view to helper or controller

The following discussion from !162833 (merged) should be addressed:

  • @ddieulivol started a discussion: (+2 comments)

    note (non-blocking): Ideally, we would have this logic in a helper method or in the controller instead of directly in the view:

    # Before
    @last_elasticsearch_reindexing_task.subtasks.order_by_alias_name_asc.each do |subtask|
    
    # After
    @last_task_subtasks.each do |subtask|

    We could then get rid of this mock altogether.

          assign(:last_task_subtasks, task)

    I didn't do this refactoring, as I didn't want to change too many things.