{% extends "base.html" %} {% block content %}

Sales Sync

Which sales have reached vendorawifi.com, and what happened when they didn't.

{% if flash_msg %}
{{ flash_msg }}
{% endif %} {% if error_msg %}
{{ error_msg }}
{% endif %} {% if state.failing %}
Sales are not reaching the website right now. Failing since {{ state.failing_since | localtime }} ({{ state.fail_attempts }} attempt{{ '' if state.fail_attempts == 1 else 's' }}). {% if state.pending %} {{ state.pending }} sale{{ '' if state.pending == 1 else 's' }} waiting — nothing is lost, they send themselves once the connection is back. {% endif %} Check this vendo's internet connection.
{% endif %}
Waiting to send
{{ state.pending }}
{% if state.pending and state.oldest_pending_at %} oldest from {{ state.oldest_pending_at | localtime }} {% else %} everything is up to date {% endif %}
Sent to the website
{{ state.synced }}
sales confirmed by the server
Last successful sync
{% if state.last_ok_at %}{{ state.last_ok_at | localtime }}{% else %}never{% endif %}
{% if state.failing %}retrying automatically{% else %}reporting normally{% endif %}

Sales

{% set chips = [('all', 'All'), ('pending', 'Waiting'), ('synced', 'Sent')] %} {% for slug, label in chips %} {{ label }} {{ counts[slug] }} {% endfor %}
{% if sales %}
{% for s in sales %} {% endfor %}
Sold Voucher Type Amount Status Sent
{{ s.ts_unix | localtime }} {{ s.code }} {{ s.kind }} ₱{{ s.pesos }} {% if s.synced %} sent {% else %} waiting {% endif %} {% if s.synced %}{{ s.acked_at | localtime }} {% else %}—{% endif %}
{% if total > page_size %} {% endif %} {% else %}

No sales recorded yet.

{% endif %}

A sale is recorded here the moment it happens and sent shortly after. Waiting is normal — it just hasn't been sent yet. Sales are never dropped: if a send fails, the same ones go again next time.

Sync attempts

{% if attempts %}
{% for a in attempts %} {% endfor %}
When Result Sales sent Reason Detail
{{ a.last_at | localtime }} {% if a.attempts > 1 %}
{{ a.attempts }} tries since {{ a.first_at | localtime }}
{% endif %}
{% if a.ok %} sent {% else %} failed {% endif %} {% if a.ok and a.events_sent %} {{ a.events_acked }}{% if a.events_acked != a.events_sent %} of {{ a.events_sent }}{% endif %} {% if a.queued_after %}
{{ a.queued_after }} still waiting
{% endif %} {% else %} — {% endif %}
{{ trigger_labels.get(a.trigger, a.trigger or 'scheduled') }} {% if a.error %}{{ a.error }} {% elif a.ok and not a.events_sent %}nothing new to send {% else %}—{% endif %}

Repeated identical failures are grouped into one line with a try count, so a long outage stays readable. Only the most recent {{ max_rows }} attempts are kept.

{% else %}

No sync attempts recorded yet. This fills in as the vendo reports its sales.

{% endif %}
{% endblock %}