{% extends "base.html" %} {% block title %}Import Ratings{% endblock %} {% block content %}
arrow_back

{{ _("Import Reviews") }}

{% trans %}Select all reviews on the Addons page, copy, and paste below. Star ratings are captured automatically.{% endtrans %}

{# New format — rich paste intercepts clipboard for plain text + star ratings #}
star {{ _("New format") }} ★ {{ _("rich paste") }} {{ _("Current Addons review system") }}
{# plain text sent to server for parsing; star ratings extracted from clipboard HTML by JS #}
{# Old format #}
star_outline {{ _("Old format") }} {{ _("Legacy Addons review system") }}
{{ _("Reviews will be matched to products but not saved yet.") }}
{% if parse_error %}

{{ _("Parse error") }}

{{ parse_error }}

{% endif %} {% if parsed_old %}
star_outline {% trans count=parsed_old|length %}Old format parsed — {{ count }} review{% pluralize %}Old format parsed — {{ count }} reviews{% endtrans %} {{ _("locale:") }} {{ parsed_old[0].locale }}
{% for r in parsed_old %} {% set products = r.matched_products if r.matched_products is defined else [] %} {% endfor %}
{{ _("Order") }} {{ _("Product(s)") }} {{ _("Purchased") }} {{ _("Reviewed") }} {{ _("Mod") }} {{ _("Docs") }} {{ _("Install") }} {{ _("Avg") }} {{ _("Skill") }} {{ _("Comment") }}
#{{ r.order_id }} {% if products %} {% for p in products %}
{{ p.product_name | truncate(35, True, '…') }}
{% endfor %} {% if products|length > 1 %}
{% trans count=products|length %}⚠ {{ count }} product{% pluralize %}⚠ {{ count }} products{% endtrans %}
{% endif %} {% else %} {{ _("not found") }} {% endif %}
{{ r.purchase_date or '—' }} {{ r.review_date or '—' }} {{ r.score_module or '—' }} {{ r.score_docs or '—' }} {{ r.score_install or '—' }} {{ r.score_average or '—' }} {{ r.skill_level or '—' }} {% if r.comment_text %} {{ r.comment_text[:80] }}{% if r.comment_text|length > 80 %}…{% endif %} {% else %} {{ _("no comment") }} {% endif %}
{% endif %} {% if parsed_new %}
star {% trans count=parsed_new|length %}New format parsed — {{ count }} review{% pluralize %}New format parsed — {{ count }} reviews{% endtrans %} {% if parsed_new and parsed_new[0].star_rating is none %} warning {{ _("No stars — paste HTML source for ratings") }} {% endif %} {{ _("locale:") }} {{ parsed_new[0].locale }}
{% for r in parsed_new %} {% set products = r.matched_products if r.matched_products is defined else [] %} {% endfor %}
{{ _("Order") }} {{ _("Product(s)") }} {{ _("Customer") }} {{ _("Purchased") }} {{ _("Reviewed") }} {{ _("Stars") }} {{ _("Reply") }} {{ _("Review") }}
#{{ r.order_id }} {% if products %} {% for p in products %}
{{ p.product_name | truncate(35, True, '…') }}
{% endfor %} {% if products|length > 1 %}
{% trans count=products|length %}⚠ {{ count }} product{% pluralize %}⚠ {{ count }} products{% endtrans %}
{% endif %} {% else %} {{ _("not found") }} {% endif %}
{{ r.customer_name }} {{ r.purchase_date or '—' }} {{ r.review_date or '—' }} {% if r.star_rating %} {{ r.star_rating }} {% else %} {% endif %} {% if r.has_seller_reply %} reply {{ r.seller_reply_date or '?' }} {% else %} {% endif %} {{ r.review_text[:80] }}{% if r.review_text|length > 80 %}…{% endif %}
{% endif %} {# Conflict resolution + import — only shown when there are parsed results #} {% set all_parsed = parsed_new + parsed_old %} {% set conflicts = [] %} {% set undetected = [] %} {% for r in all_parsed %} {% if r.matched_products is defined and r.matched_products|length > 1 %} {% set _ = conflicts.append(r) %} {% elif not r.matched_products is defined or r.matched_products|length == 0 %} {% set _ = undetected.append(r) %} {% endif %} {% endfor %} {% if all_parsed %}
upload {% trans %}Confirm & Import{% endtrans %} {% trans count=all_parsed|length %}{{ count }} review ready{% pluralize %}{{ count }} reviews ready{% endtrans %}
{% if conflicts %}

warning {% trans count=conflicts|length %}{{ count }} order matched multiple products — choose which to assign:{% pluralize %}{{ count }} orders matched multiple products — choose which to assign:{% endtrans %}

{% for r in conflicts %} {% set review_text = r.review_text if r.review_text is defined else r.comment_text if r.comment_text is defined else '' %}
Order #{{ r.order_id }}
{% for p in r.matched_products %} {% endfor %}
{% if review_text %}

{{ review_text }}

{% endif %}
{% endfor %}
{% endif %} {% if undetected %}

help_outline {% trans count=undetected|length %}{{ count }} order with no matching product in orders history:{% pluralize %}{{ count }} orders with no matching product in orders history:{% endtrans %}

{% for r in undetected %} #{{ r.order_id }} {% endfor %}
{% for p in products_for_picker %} {% endfor %}

{{ _("Check all modules that were part of the bundle") }}

{% endif %}
{{ _("Duplicates are skipped automatically.") }}
{# Embed parsed data as JSON for the import JS #} {% endif %}
{% endblock %}