To Do List Transfer Items Help

I combined the trigger I found here How to send notification when item added to a Todo list? - #12 by Didgeridrew with the automation here Move incomplete items between todo lists - #2 by my.spider.died to create an automation that when I mark an item as complete on my Long Term To Do list it moves to Weekly Long Term Task to do list

alias: "To-do list transfer "
description: ""
trigger:
  - platform: event
    event_type: call_service
    event_data:
      domain: todo
      service: update_item
      service_data:
        status: completed
    variables:
      list_name: >
        {{ state_attr((trigger.event.data.service_data.entity_id)[0],
        'friendly_name') }}
      item: "{{ trigger.event.data.service_data.item | title }}"
      user_name: >
        {% set uid = trigger.event.context.user_id %}

        {% set user = None %}

        {% set matching_users = states.person | selectattr('attributes.user_id',
        '==', uid) | list %}

        {% set user = matching_users | first if matching_users | length > 0 else
        "System" %}

        {{ user if user == "System" else
        state_attr(user.entity_id,"friendly_name") }}
condition: []
action:
  - if:
      - condition: template
        value_template: "{{list_name == 'Dan Long Term List'}}"
        enabled: true
    then:
      - service: todo.get_items
        data:
          status:
            - completed
        target:
          entity_id:
            - todo.long_term_to_do
        response_variable: items
      - repeat:
          for_each: >
            {% set list_name = items.keys() | list %} {{
            items[list_name[0]]['items'] }}
          sequence:
            - service: todo.add_item
              data:
                item: |
                  {{ repeat.item.summary }}
              target:
                entity_id:
                  - todo.dan_s_long_term_task_for_the_week
            - service: notify.mobile_app_pixel_5
              metadata: {}
              data:
                message: success!
      - service: todo.remove_completed_items
        metadata: {}
        data: {}
        target:
          entity_id: todo.long_term_to_do
    enabled: true
mode: single

I am able to get it to trigger but the repeat section doesn’t activate. If I make an automation of just that section it works fine. For some reason using this trigger prevents it from working.
Bonus points if I can remove the repeat all together as I only need the automation to trigger for one item at a time.

Thank you!

Update: i figured out that it has no issue grabbing items with the status of “Not Completed” but it has trouble grabbing “Completed”

I was able to use a response you provided here How to send notification when item added to a Todo list? - #21 by Ilias
to come to a solution

alias: "To-do list transfer "
description: ""
trigger:
  - platform: event
    event_type: call_service
    event_data:
      domain: todo
      service: update_item
      service_data:
        status: completed
    variables:
      list_name: >
        {{ state_attr((trigger.event.data.service_data.entity_id)[0],
        'friendly_name') }}
      task: "{{ trigger.event.data.service_data.rename }}"
condition: []
action:
  - if:
      - condition: template
        value_template: "{{list_name == 'Dan Long Term List'}}"
        enabled: true
    then:
      - service: input_text.set_value
        metadata: {}
        data:
          value: "{{task}}"
        target:
          entity_id: input_text.dan_s_weekly_long_term_task
      - service: todo.add_item
        metadata: {}
        data:
          item: "{{task}}"
        target:
          entity_id: todo.dan_s_long_term_task_for_the_week
      - service: todo.remove_completed_items
        metadata: {}
        data: {}
        target:
          entity_id: todo.long_term_to_do
        enabled: true
    enabled: true
mode: single

I don’t know if this is a concern for you with your setup, but if there isn’t a second action clause i.e. an “else”, I would put the condition you’re using in the “if” in the condition block. That way the automation’s last_triggered property will more accurately reflect when something was moved.

I thought of that but I will be having multiple Ifs depending on the list. My initial thought was to have multiple automations, one per list, but then I decided to keep things in one automation