Merge branch 'feature/alerts' into develop
This commit is contained in:
@@ -44,24 +44,7 @@ class Command(BaseCommand):
|
||||
stats = alerts.alert_get_stats(alert)
|
||||
|
||||
# explanatorytexts
|
||||
if alert.measured.condition == 'between':
|
||||
description = 'This alert measures strokes where {metric} is between {value1} and {value2}.'.format(
|
||||
metric = alert.measured.metric,
|
||||
value1 = alert.measured.value1,
|
||||
value2 = alert.measured.value2,
|
||||
)
|
||||
elif alert.measured.condition == '<':
|
||||
description = 'This alert measures strokes where {metric} is smaller than {value1}.'.format(
|
||||
metric = alert.measured.metric,
|
||||
value1 = alert.measured.value1,
|
||||
)
|
||||
else:
|
||||
description = 'This alert measures strokes where {metric} is larger than {value1}.'.format(
|
||||
metric = alert.measured.metric,
|
||||
value1 = alert.measured.value1,
|
||||
)
|
||||
|
||||
othertexts = [description]
|
||||
othertexts = [alert.description()]
|
||||
|
||||
# send email
|
||||
job = myqueue(queue,handle_send_email_alert,
|
||||
|
||||
+25
-1
@@ -1072,9 +1072,10 @@ class Alert(models.Model):
|
||||
|
||||
|
||||
def __str__(self):
|
||||
metricdict = {key:value for (key,value) in parchoicesy1}
|
||||
stri = u'Alert {name} on {metric} for {workouttype} - running on {first_name} every {period} days'.format(
|
||||
name = self.name,
|
||||
metric = self.measured.metric,
|
||||
metric = metricdict[self.measured.metric],
|
||||
workouttype = self.workouttype,
|
||||
first_name = self.rower.user.first_name,
|
||||
period = self.period,
|
||||
@@ -1082,6 +1083,29 @@ class Alert(models.Model):
|
||||
|
||||
return stri
|
||||
|
||||
def description(self):
|
||||
metricdict = {key:value for (key,value) in parchoicesy1}
|
||||
|
||||
if self.measured.condition == 'between':
|
||||
description = 'This alert measures strokes where {metric} is between {value1} and {value2}.'.format(
|
||||
metric = metricdict[self.measured.metric],
|
||||
value1 = self.measured.value1,
|
||||
value2 = self.measured.value2,
|
||||
)
|
||||
elif self.measured.condition == '<':
|
||||
description = 'This alert measures strokes where {metric} is smaller than {value1}.'.format(
|
||||
metric = metricdict[self.measured.metric],
|
||||
value1 = self.measured.value1,
|
||||
)
|
||||
else:
|
||||
description = 'This alert measures strokes where {metric} is larger than {value1}.'.format(
|
||||
metric = metricdict[self.measured.metric],
|
||||
value1 = self.measured.value1,
|
||||
)
|
||||
|
||||
return description
|
||||
|
||||
|
||||
class AlertEditForm(ModelForm):
|
||||
class Meta:
|
||||
model = Alert
|
||||
|
||||
@@ -14,9 +14,10 @@
|
||||
|
||||
<ul class="main-content">
|
||||
|
||||
<li class="grid_2">
|
||||
<li class="grid_4">
|
||||
<h2>Alert</h2>
|
||||
<p>{{ alert }}</p>
|
||||
<p>{{ alert.description }}</p>
|
||||
<p>This is a page under construction. Currently with minimal information</p>
|
||||
</li>
|
||||
{% for key, value in stats.items %}
|
||||
|
||||
@@ -38,5 +38,5 @@
|
||||
|
||||
|
||||
{% block sidebar %}
|
||||
{% include 'menu_analytics.html' %}
|
||||
{% include 'menu_profile.html' %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -10,6 +10,11 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>{% block title %}Rowsandall Rowing Data Analytics{% endblock %}</title>
|
||||
<link rel="shortcut icon" href="/static/img/favicon.ico" type="image/x-icon" />
|
||||
<link rel="icon" sizes="32x32" href="/static/img/favicon-32x32.png" type="image/png"/>
|
||||
<link rel="icon" sizes="64x64" href="/static/img/favicon-64x64.png" type="image/png"/>
|
||||
<link rel="icon" sizes="192x192" href="/static/img/favicon-192x192.png" type="image/png"/>
|
||||
<link rel="icon" sizes="16x16" href="/static/img/favicon-16x16.png" type="image/png"/>
|
||||
{% block og_image %}
|
||||
<meta property="og:image" content="https://rowsandall.com/static/img/logo_r.png" />
|
||||
<meta property="og:image:secure_url" content="https://rowsandall.com/static/img/logo_r.png" />
|
||||
|
||||
@@ -33,6 +33,11 @@
|
||||
<i class="fas fa-credit-card fa-fw"></i> Transactions
|
||||
</a>
|
||||
</li>
|
||||
<li id="manage-jobs">
|
||||
<a href="/rowers/failedjobs/">
|
||||
<i class="fas fa-tasks fa-fw"></i> Failed Tasks
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul><!-- cd-accordion-menu -->
|
||||
|
||||
|
||||
@@ -33,6 +33,11 @@
|
||||
<i class="fas fa-credit-card fa-fw"></i> Transactions
|
||||
</a>
|
||||
</li>
|
||||
<li id="manage-jobs">
|
||||
<a href="/rowers/failedjobs/">
|
||||
<i class="fas fa-tasks fa-fw"></i> Failed Tasks
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul><!-- cd-accordion-menu -->
|
||||
|
||||
|
||||
BIN
Binary file not shown.
@@ -29,9 +29,11 @@
|
||||
<script src="/static/cookielaw/js/cookielaw.js"></script>
|
||||
{% analytical_head_top %}
|
||||
|
||||
<link rel="stylesheet" href="/static/css/bokeh-0.12.3.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="/static/css/bokeh-widgets-0.12.3.min.css" type="text/css" />
|
||||
|
||||
<link rel="stylesheet" href="https://cdn.pydata.org/bokeh/release/bokeh-1.0.4.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.4.min.css" type="text/css" />
|
||||
<link rel="stylesheet" type="text/css" href="/static/admin/css/forms.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="/static/admin/css/widgets.css"/>
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" >
|
||||
<link rel="shortcut icon" href="/static/img/favicon.ico" type="image/x-icon" />
|
||||
<link rel="icon" sizes="32x32" href="/static/img/favicon-32x32.png" type="image/png"/>
|
||||
<link rel="icon" sizes="64x64" href="/static/img/favicon-64x64.png" type="image/png"/>
|
||||
|
||||
Reference in New Issue
Block a user