Improve tasks and backdate insights

This commit is contained in:
2026-03-03 17:21:06 +00:00
parent 9c14e51b43
commit 2898d9e832
18 changed files with 1617 additions and 264 deletions

View File

@@ -23,102 +23,45 @@
<button class="button is-link is-small" type="submit">Save</button>
</form>
<form method="get" class="box">
<h2 class="title is-6">Timeline Filters</h2>
<div class="columns is-multiline">
<div class="column is-3">
<label class="label is-size-7">Person</label>
<div class="select is-small is-fullwidth">
<select name="person">
<option value="">All</option>
{% for person in people %}
<option value="{{ person.id }}" {% if filters.person == person.id|stringformat:"s" %}selected{% endif %}>{{ person.name }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="column is-2">
<label class="label is-size-7">Service</label>
<div class="select is-small is-fullwidth">
<select name="service">
<option value="">All</option>
{% for item in service_choices %}
<option value="{{ item }}" {% if filters.service == item %}selected{% endif %}>{{ item }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="column is-2">
<label class="label is-size-7">State</label>
<div class="select is-small is-fullwidth">
<select name="state">
<option value="">All</option>
{% for item in state_choices %}
<option value="{{ item }}" {% if filters.state == item %}selected{% endif %}>{{ item }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="column is-2">
<label class="label is-size-7">Source</label>
<div class="select is-small is-fullwidth">
<select name="source_kind">
<option value="">All</option>
{% for item in source_kind_choices %}
<option value="{{ item }}" {% if filters.source_kind == item %}selected{% endif %}>{{ item }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="column is-2">
<label class="label is-size-7">Start (ISO)</label>
<input class="input is-small" type="datetime-local" name="start" value="{{ filters.start }}">
</div>
<div class="column is-2">
<label class="label is-size-7">End (ISO)</label>
<input class="input is-small" type="datetime-local" name="end" value="{{ filters.end }}">
</div>
</div>
<button class="button is-light is-small" type="submit">Apply</button>
</form>
<div class="box">
<h2 class="title is-6">Availability Events</h2>
<h2 class="title is-6">Availability Event Statistics Per Contact</h2>
<table class="table is-fullwidth is-striped is-size-7">
<thead><tr><th>ts</th><th>person</th><th>service</th><th>source</th><th>state</th><th>confidence</th></tr></thead>
<thead>
<tr>
<th>Contact</th>
<th>Service</th>
<th>Total</th>
<th>Available</th>
<th>Fading</th>
<th>Unavailable</th>
<th>Unknown</th>
<th>Native</th>
<th>Read</th>
<th>Typing</th>
<th>Msg Activity</th>
<th>Timeout</th>
<th>Last Event TS</th>
</tr>
</thead>
<tbody>
{% for row in events %}
{% for row in contact_stats %}
<tr>
<td>{{ row.ts }}</td>
<td>{{ row.person.name }}</td>
<td>{{ row.person__name }}</td>
<td>{{ row.service }}</td>
<td>{{ row.source_kind }}</td>
<td>{{ row.availability_state }}</td>
<td>{{ row.confidence|floatformat:2 }}</td>
<td>{{ row.total_events }}</td>
<td>{{ row.available_events }}</td>
<td>{{ row.fading_events }}</td>
<td>{{ row.unavailable_events }}</td>
<td>{{ row.unknown_events }}</td>
<td>{{ row.native_presence_events }}</td>
<td>{{ row.read_receipt_events }}</td>
<td>{{ row.typing_events }}</td>
<td>{{ row.message_activity_events }}</td>
<td>{{ row.inferred_timeout_events }}</td>
<td>{{ row.last_event_ts }}</td>
</tr>
{% empty %}
<tr><td colspan="6">No events in range.</td></tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="box">
<h2 class="title is-6">Availability Spans</h2>
<table class="table is-fullwidth is-striped is-size-7">
<thead><tr><th>person</th><th>service</th><th>state</th><th>start</th><th>end</th><th>confidence</th></tr></thead>
<tbody>
{% for row in spans %}
<tr>
<td>{{ row.person.name }}</td>
<td>{{ row.service }}</td>
<td>{{ row.state }}</td>
<td>{{ row.start_ts }}</td>
<td>{{ row.end_ts }}</td>
<td>{{ row.confidence_start|floatformat:2 }} -> {{ row.confidence_end|floatformat:2 }}</td>
</tr>
{% empty %}
<tr><td colspan="6">No spans in range.</td></tr>
<tr><td colspan="13">No availability events found.</td></tr>
{% endfor %}
</tbody>
</table>