### Apache Airflow version

2.6.2

### What happened

All tasks were run 1 time. The try number is 2 for all tasks

### What you think should happen instead

Try number should be 1 if only tried 1 time

### How to reproduce

Run a task and use the UI to look up try number

### Operating System

centos

### Versions of Apache Airflow Providers

_No response_

### Deployment

Virtualenv installation

### Deployment details

_No response_

### Anything else

_No response_

### Are you willing to submit PR?

- [ ] Yes I am willing to submit a PR!

### Code of Conduct

- [X] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)

elif arg_status_filter == "paused":
                current_dags = paused_dags
                num_of_all_dags = status_count_paused
            elif arg_status_filter == "running":
                current_dags = running_dags
                num_of_all_dags = status_count_running
            elif arg_status_filter == "failed":
                current_dags = failed_dags
                num_of_all_dags = status_count_failed
            else:
                current_dags = all_dags
                num_of_all_dags = all_dags_count
            if arg_sorting_key == "last_dagrun":
                dag_run_subquery = (
                    session.query(
                        DagRun.dag_id,
                        sqla.func.max(DagRun.execution_date).label("max_execution_date"),
                    )
                    .group_by(DagRun.dag_id)
                    .subquery()
                )
                current_dags = current_dags.outerjoin(
                    dag_run_subquery, and_(dag_run_subquery.c.dag_id == DagModel.dag_id)
                )
                null_case = case((dag_run_subquery.c.max_execution_date.is_(None), 1), else_=0)
                if arg_sorting_direction == "desc":
                    current_dags = current_dags.order_by(
                        null_case, dag_run_subquery.c.max_execution_date.desc()
                    )
                else: