Commit 40ee3b96c32990c7862103257f9230c96c69a675
1 parent
a9da4d68
Exists in
dev
adding sunelevation front
Showing
3 changed files
with
24 additions
and
11 deletions
Show diff stats
simulators/config/grammar.json
... | ... | @@ -4,17 +4,24 @@ |
4 | 4 | { |
5 | 5 | "name": "SPEED", |
6 | 6 | "nb_param": [2, 3], |
7 | - "param_type": "float" | |
7 | + "param_type": "float", | |
8 | + "desc": "description", | |
9 | + "desc": "description", | |
10 | + "help": "help" | |
8 | 11 | }, |
9 | 12 | { |
10 | 13 | "name": "COORDS", |
11 | 14 | "nb_param": [2, 3], |
12 | - "param_type": "float" | |
15 | + "param_type": "float", | |
16 | + "desc": "description", | |
17 | + "help": "help" | |
13 | 18 | }, |
14 | 19 | { |
15 | 20 | "name": "TRACKING_SPEED", |
16 | 21 | "nb_param": [2, 3], |
17 | - "param_type": "float" | |
22 | + "param_type": "float", | |
23 | + "desc": "description", | |
24 | + "help": "help" | |
18 | 25 | }, |
19 | 26 | { |
20 | 27 | "name": "ACCEL", | ... | ... |
src/dashboard/views.py
... | ... | @@ -15,6 +15,7 @@ from django.utils.decorators import method_decorator |
15 | 15 | from django.urls import reverse_lazy, reverse |
16 | 16 | from django.http import Http404 |
17 | 17 | import json |
18 | +from random import randint | |
18 | 19 | from devices.Telescope import TelescopeController |
19 | 20 | from devices.TelescopeRemoteControl import TelescopeRemoteControl |
20 | 21 | |
... | ... | @@ -39,7 +40,7 @@ def retrieve_env(request): |
39 | 40 | isDay = False |
40 | 41 | if t.hour > 5 and t.hour < 20: |
41 | 42 | isDay = True |
42 | - return render(request, 'dashboard/observation_status_env.html', ) | |
43 | + return render(request, 'dashboard/observation_status_env.html', locals()) | |
43 | 44 | except WeatherWatch.DoesNotExist: |
44 | 45 | raise Http404("No WeatherWatch matches the given query.") |
45 | 46 | |
... | ... | @@ -48,7 +49,9 @@ def retrieve_env_navbar(request): |
48 | 49 | try: |
49 | 50 | weather_status = WeatherWatch.objects.latest('updated') |
50 | 51 | weather = serializers.serialize('json', [weather_status]) |
51 | - return HttpResponse(weather, content_type="application/json") | |
52 | + weather = json.loads(weather) | |
53 | + weather[0]['sunelev'] = randint(-30, 30) | |
54 | + return HttpResponse(json.dumps(weather), content_type="application/json") | |
52 | 55 | except WeatherWatch.DoesNotExist: |
53 | 56 | raise Http404("No WeatherWatch matches the given query.") |
54 | 57 | ... | ... |
src/misc/templates/base.html
... | ... | @@ -112,7 +112,7 @@ a { |
112 | 112 | <li><a href="#">Images</a></li> |
113 | 113 | </ul> |
114 | 114 | <ul class="nav navbar-nav navbar-right navbar-user"> |
115 | - <li><a id="hour">lol</a></li> | |
115 | + <li><a id="hour">Sun elevation :</a></li> | |
116 | 116 | <li><a id="day_night" href="{% url "weather" %}"><img id="day_night_img"></a></li> |
117 | 117 | <li><a id="wind" href="{% url "weather" %}"><img id="wind_img"></a></li> |
118 | 118 | <li><a id="weather" href="{% url "weather" %}"><img id="weather_img"></a></li> |
... | ... | @@ -130,16 +130,16 @@ a { |
130 | 130 | <script> |
131 | 131 | var TOO_STRONG_WIND = 60; //Totally arbitrary values, just for demonstration |
132 | 132 | var MAX_CLOUD_VALUE = 1; |
133 | - var REFRESH_ICONS_FREQUENCE_MILLISECONDS = 60000; | |
133 | + var REFRESH_ICONS_FREQUENCE_MILLISECONDS = 1000; | |
134 | 134 | var MAX_RAIN_RATE = 10; |
135 | 135 | |
136 | 136 | $( document ).ready(function() { |
137 | - get_hour(); | |
138 | - setInterval(function() {get_hour();}, 900); | |
137 | + //get_hour(); | |
138 | + //setInterval(function() {get_hour();}, 900); | |
139 | 139 | |
140 | - function get_hour() | |
140 | + function set_elev(sun_elev) | |
141 | 141 | { |
142 | - $("#hour").text("Site time: " + moment().tz("America/Tijuana").format('LTS (Z UTC)')); | |
142 | + $("#hour").text("Sun elevation : " + sun_elev); | |
143 | 143 | } |
144 | 144 | |
145 | 145 | ajax_request(); |
... | ... | @@ -189,6 +189,9 @@ a { |
189 | 189 | else |
190 | 190 | _im.src= "{% static 'media/white_windsock_nowind_new.png' %}"; |
191 | 191 | $("#wind_img").replaceWith(_im); |
192 | + | |
193 | + set_elev(weather_status[0]['sunelev']); | |
194 | + console.log(weather_status); | |
192 | 195 | } |
193 | 196 | }, 'json') |
194 | 197 | .fail(function () { | ... | ... |