{% extends "base.html" %} {% load static %} {% block title %}{{ object.name }} - Analytics Metrics{% endblock %} {% block content %}

{{ object.name }} {{ object.get_category_display }} Metric

Metric Information

Edit
Name: {{ object.name }}
Description: {{ object.description|default:"No description" }}
Category: {{ object.get_category_display }}
Current Value: {% if object.current_value is not None %} {{ object.current_value }}{% if object.unit %} {{ object.unit }}{% endif %} {% else %} No data available {% endif %}
Target: {% if object.target_value is not None %} {% if object.target_direction == 'HIGHER' %}↑{% else %}↓{% endif %} {{ object.target_value }}{% if object.unit %} {{ object.unit }}{% endif %} {% else %} No target set {% endif %}
Status: {{ object.get_status_display }}
Frequency: {{ object.get_update_frequency_display }}
Last Updated: {% if object.last_updated %} {{ object.last_updated|date:"M d, Y H:i" }}
{{ object.last_updated|timesince }} ago {% else %} Never updated {% endif %}
Created: {{ object.created_at|date:"M d, Y" }}
Created By: {{ object.created_by.get_full_name|default:"System" }}
{% if object.target_value is not None and object.current_value is not None %}
Target Performance
{% with performance=object.target_performance %}
{{ performance|floatformat:1 }}%
{% endwith %}
Current: {{ object.current_value }}{% if object.unit %} {{ object.unit }}{% endif %} Target: {{ object.target_value }}{% if object.unit %} {{ object.unit }}{% endif %}
{% endif %} {% if object.sql_query %}
Calculation Query
{{ object.sql_query }}
{% endif %}

Historical Data

Recent Updates

{% if recent_updates %}
{% for update in recent_updates %} {% endfor %}
Date Value Change Updated By
{{ update.created_at|date:"M d, Y H:i:s" }} {{ update.value }}{% if object.unit %} {{ object.unit }}{% endif %} {% if update.change %} {% if update.change > 0 %}+{% endif %}{{ update.change|floatformat:2 }} {% else %} - {% endif %} {{ update.updated_by.get_full_name|default:"System" }}
{% else %}

No update history found for this metric.

{% endif %}

Quick Actions

Edit Metric
{% if object.status == 'ACTIVE' %} {% else %} {% endif %} Delete Metric

Metric Statistics

{{ object.update_count }}
Total Updates
{{ object.avg_value|floatformat:2 }}
Average Value
{{ object.min_value|floatformat:2 }}
Minimum
{{ object.max_value|floatformat:2 }}
Maximum

Alert Configuration

{% if object.alerts.exists %}
{% for alert in object.alerts.all %}
{{ alert.name }}
{{ alert.get_condition_display }}: {{ alert.threshold_value }}
{{ alert.is_active|yesno:'Active,Inactive' }}
{% endfor %}
{% else %}

No alerts configured.

{% endif %}
{% endblock %} {% block js %} {% endblock %}