Add stats and beautify stations page
parent
0e35aa4783
commit
6b77df6252
|
@ -126,6 +126,11 @@ class Station(models.Model):
|
|||
else:
|
||||
return False
|
||||
|
||||
@property
|
||||
def observations_count(self):
|
||||
count = self.observations.all().count()
|
||||
return count
|
||||
|
||||
@property
|
||||
def apikey(self):
|
||||
return get_apikey(user=self.owner)
|
||||
|
|
|
@ -301,6 +301,10 @@ span.datetime-time {
|
|||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.station-antennas .label-info {
|
||||
margin: 2px;
|
||||
}
|
||||
|
||||
/* Observations
|
||||
==================== */
|
||||
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
$(document).ready(function() {
|
||||
'use strict';
|
||||
|
||||
// Render Station success rate
|
||||
var success_rate = $('.gs.progress-bar-success').data('success-rate');
|
||||
var percentagerest = $('.gs.progress-bar-danger').data('percentagerest');
|
||||
$('.gs.progress-bar-success').css('width', success_rate + '%');
|
||||
$('.gs.progress-bar-danger').css('width', percentagerest + '%');
|
||||
});
|
|
@ -19,7 +19,8 @@
|
|||
<th>ID</th>
|
||||
<th>Name</th>
|
||||
<th>Location</th>
|
||||
<th>Altitude</th>
|
||||
<th>Last seen</th>
|
||||
<th>Observations</th>
|
||||
<th>Antennas</th>
|
||||
<th>Owner</th>
|
||||
</thead>
|
||||
|
@ -53,12 +54,32 @@
|
|||
{% if station.qthlocator %}
|
||||
- {{ station.qthlocator }}
|
||||
{% endif %}
|
||||
@{{ station.alt}}m
|
||||
</td>
|
||||
{% endif %}
|
||||
<td>{{ station.alt}} m</td>
|
||||
<td>
|
||||
{% if station.last_seen %}
|
||||
{{ station.last_seen|timesince }} ago
|
||||
{% else %}
|
||||
Never seen
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{% if station.success_rate %}
|
||||
<span class="badge" data-toggle="tooltip" data-placement="bottom"
|
||||
title="{{ station.success_rate }}% Success">
|
||||
{{ station.observations_count }}
|
||||
</span>
|
||||
{% else %}
|
||||
No stats
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="station-antennas">
|
||||
{% for antenna in station.antenna.all %}
|
||||
{{ antenna.band}} {{ antenna.get_antenna_type_display }} | {{ antenna.frequency|frq }} - {{ antenna.frequency_max|frq }}<br>
|
||||
<span class="label label-info" data-toggle="tooltip" data-placement="bottom"
|
||||
title="{{ antenna.frequency|frq }} - {{ antenna.frequency_max|frq }}">
|
||||
{{ antenna.band}} {{ antenna.get_antenna_type_display }}
|
||||
</span>
|
||||
{% endfor %}
|
||||
</td>
|
||||
<td>
|
||||
|
@ -79,4 +100,5 @@
|
|||
|
||||
{% block javascript %}
|
||||
<script src="{% static 'js/gridsquare.js' %}"></script>
|
||||
<script src="{% static 'js/stations.js' %}"></script>
|
||||
{% endblock javascript %}
|
||||
|
|
Loading…
Reference in New Issue