{# Categorize decks into different scenarios #} {% set new_decks = [] %} {% set merged_same_name = [] %} {% set merged_different_name = [] %} {% for i in range(ankihub_deck_names|length) %} {% if not import_results[i].merged_with_existing_deck %} {% set _ = new_decks.append(ankihub_deck_names[i]) %} {% elif ankihub_deck_names[i] == anki_deck_names[i] %} {% set _ = merged_same_name.append(ankihub_deck_names[i]) %} {% else %} {% set _ = merged_different_name.append({'ankihub': ankihub_deck_names[i], 'anki': anki_deck_names[i]}) %} {% endif %} {% endfor %} {#------------------------------- Shared list‑style helpers -------------------------------#} {% set outer_ul_style = "-qt-list-indent:1; margin:0 0 10px -18px; padding-left:0; list-style-position:inside;" %} {% set inner_ul_style = "-qt-list-indent:1; margin:5px 0 10px 30px; padding:0; list-style-position:inside;" %} {% set single_ul_style = "-qt-list-indent:1; margin:0 0 0 -18px; padding-left:0; list-style-position:inside;" %} {# Handle single‑deck scenarios #} {% if ankihub_deck_names|length == 1 %} {% if new_decks %}

The deck {{ new_decks[0] }} is ready to study.

{% elif merged_same_name %}

You already have the deck {{ merged_same_name[0] }}! We've merged the new deck into the existing one.

{% elif merged_different_name %}

{{ merged_different_name[0].ankihub }} was merged into {{ merged_different_name[0].anki }} due to overlapping content.  All your notes are now in one place.

{% endif %} {% else %} {#--------------------------- Multiple‑deck scenarios ---------------------------#} {% if new_decks|length == ankihub_deck_names|length %}

The following decks are ready to study:

{% elif merged_same_name|length == ankihub_deck_names|length %}

New decks were merged into existing decks with matching names:

{% elif merged_different_name|length == ankihub_deck_names|length %}

Some of the decks you subscribed to matched ones you already had.
We've merged them to avoid duplicates:

{% else %}

Success! Your decks are ready:

{% endif %} {% endif %} {# Handle skipped‑notes warnings #} {% for ankihub_deck_name, import_result in zip(ankihub_deck_names, import_results) %} {% if import_result.skipped_nids %}

⚠️ Some notes{% if ankihub_deck_names|length > 1 %} in {{ ankihub_deck_name }}{% endif %} were skipped because they share the same ID as notes in another AnkiHub deck.
For more details, see this topic. .

{% endif %} {% endfor %} {# AnkiWeb sync warning – appears at the end for all scenarios #} {% if logged_to_ankiweb %}

⚠️ To access decks on other devices, go to those devices, sync, and choose Download from AnkiWeb if prompted.

{% endif %}