Merge pull request #116 from satnogs/datetime
Several datetime and observation fixesmerge-requests/118/head
commit
7a0a046e3a
|
@ -2,7 +2,7 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
import datetime
|
||||
from django.utils.timezone import now
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -15,7 +15,7 @@ class Migration(migrations.Migration):
|
|||
migrations.AddField(
|
||||
model_name='satellite',
|
||||
name='updated',
|
||||
field=models.DateTimeField(default=datetime.date(2014, 10, 24), auto_now_add=True),
|
||||
field=models.DateTimeField(default=now(), auto_now_add=True),
|
||||
preserve_default=False,
|
||||
),
|
||||
]
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
import datetime
|
||||
from django.utils.timezone import utc
|
||||
from django.utils.timezone import now
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -16,7 +15,7 @@ class Migration(migrations.Migration):
|
|||
migrations.AddField(
|
||||
model_name='station',
|
||||
name='created',
|
||||
field=models.DateTimeField(default=datetime.datetime(2014, 12, 1, 19, 31, 18, 716421, tzinfo=utc), auto_now_add=True),
|
||||
field=models.DateTimeField(default=now(), auto_now_add=True),
|
||||
preserve_default=False,
|
||||
),
|
||||
]
|
||||
|
|
|
@ -6,7 +6,7 @@ from django.contrib import messages
|
|||
from django.views.decorators.http import require_POST
|
||||
from django.shortcuts import get_object_or_404, render, redirect
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.utils.timezone import now
|
||||
from django.utils.timezone import now, make_aware, utc
|
||||
from django.http import JsonResponse
|
||||
from django.contrib.auth.decorators import login_required
|
||||
|
||||
|
@ -45,33 +45,51 @@ def observation_new(request):
|
|||
if request.method == 'POST':
|
||||
sat_id = request.POST.get('satellite')
|
||||
trans_id = request.POST.get('transponder')
|
||||
start = request.POST.get('start-time')
|
||||
end = request.POST.get('end-time')
|
||||
start_time = datetime.strptime(request.POST.get('start-time'), '%Y-%m-%d %H:%M')
|
||||
start = make_aware(start_time, utc)
|
||||
end_time = datetime.strptime(request.POST.get('end-time'), '%Y-%m-%d %H:%M')
|
||||
end = make_aware(end_time, utc)
|
||||
sat = Satellite.objects.get(norad_cat_id=sat_id)
|
||||
trans = Transponder.objects.get(id=trans_id)
|
||||
obs = Observation(satellite=sat, transponder=trans,
|
||||
author=me, start=start, end=end)
|
||||
obs.save()
|
||||
|
||||
total = int(request.POST.get('total'))
|
||||
|
||||
for item in range(total):
|
||||
start = request.POST.get('{}-starting_time'.format(item))
|
||||
end = request.POST.get('{}-ending_time'.format(item))
|
||||
start = datetime.strptime(
|
||||
request.POST.get('{0}-starting_time'.format(item)), '%Y-%m-%d %H:%M:%S.%f'
|
||||
)
|
||||
end = datetime.strptime(
|
||||
request.POST.get('{}-ending_time'.format(item)), '%Y-%m-%d %H:%M:%S.%f'
|
||||
)
|
||||
station_id = request.POST.get('{}-station'.format(item))
|
||||
ground_station = Station.objects.get(id=station_id)
|
||||
Data.objects.create(start=start, end=end, ground_station=ground_station,
|
||||
observation=obs)
|
||||
Data.objects.create(start=make_aware(start, utc), end=make_aware(end, utc),
|
||||
ground_station=ground_station, observation=obs)
|
||||
|
||||
return redirect(reverse('base:observation_view', kwargs={'id': obs.id}))
|
||||
|
||||
satellites = Satellite.objects.filter(transponder__alive=True)
|
||||
transponders = Transponder.objects.filter(alive=True)
|
||||
|
||||
return render(request, 'base/observation_new.html', {'satellites': satellites,
|
||||
'transponders': transponders})
|
||||
|
||||
return render(request, 'base/observation_new.html',
|
||||
{'satellites': satellites,
|
||||
'transponders': transponders,
|
||||
'date_min_start': settings.DATE_MIN_START,
|
||||
'date_max_range': settings.DATE_MAX_RANGE})
|
||||
|
||||
|
||||
def prediction_windows(request, sat_id, start_date, end_date):
|
||||
sat = get_object_or_404(Satellite, norad_cat_id=sat_id)
|
||||
try:
|
||||
sat = Satellite.objects.filter(transponder__alive=True).filter(norad_cat_id=sat_id).get()
|
||||
except:
|
||||
data = {
|
||||
'error': 'You should select a Satellite first.'
|
||||
}
|
||||
return JsonResponse(data, safe=False)
|
||||
satellite = ephem.readtle(str(sat.tle0), str(sat.tle1), str(sat.tle2))
|
||||
|
||||
end_date = datetime.strptime(end_date, '%Y-%m-%d %H:%M')
|
||||
|
@ -88,7 +106,13 @@ def prediction_windows(request, sat_id, start_date, end_date):
|
|||
station_match = False
|
||||
keep_digging = True
|
||||
while keep_digging:
|
||||
tr, azr, tt, altt, ts, azs = observer.next_pass(satellite)
|
||||
try:
|
||||
tr, azr, tt, altt, ts, azs = observer.next_pass(satellite)
|
||||
except ValueError:
|
||||
data = {
|
||||
'error': 'That satellite seems to stay always below your horizon.'
|
||||
}
|
||||
break
|
||||
|
||||
if ephem.Date(tr).datetime() < end_date:
|
||||
if not station_match:
|
||||
|
|
|
@ -170,3 +170,7 @@ REST_FRAMEWORK = {
|
|||
MAPBOX_GEOCODE_URL = 'https://api.tiles.mapbox.com/v4/geocode/mapbox.places/'
|
||||
MAPBOX_MAP_ID = getenv('MAPBOX_MAP_ID', '')
|
||||
MAPBOX_TOKEN = getenv('MAPBOX_TOKEN', '')
|
||||
|
||||
# Observations datetimes in minutes
|
||||
DATE_MIN_START = '60'
|
||||
DATE_MAX_RANGE = '480'
|
||||
|
|
|
@ -1,5 +1,366 @@
|
|||
/*!
|
||||
* Datetimepicker for Bootstrap v3
|
||||
//! version : 3.1.3
|
||||
* Datetimepicker for Bootstrap 3
|
||||
* ! version : 4.7.14
|
||||
* https://github.com/Eonasdan/bootstrap-datetimepicker/
|
||||
*/.bootstrap-datetimepicker-widget{top:0;left:0;width:250px;padding:4px;margin-top:1px;z-index:99999!important;border-radius:4px}.bootstrap-datetimepicker-widget.timepicker-sbs{width:600px}.bootstrap-datetimepicker-widget.bottom:before{content:'';display:inline-block;border-left:7px solid transparent;border-right:7px solid transparent;border-bottom:7px solid #ccc;border-bottom-color:rgba(0,0,0,.2);position:absolute;top:-7px;left:7px}.bootstrap-datetimepicker-widget.bottom:after{content:'';display:inline-block;border-left:6px solid transparent;border-right:6px solid transparent;border-bottom:6px solid #fff;position:absolute;top:-6px;left:8px}.bootstrap-datetimepicker-widget.top:before{content:'';display:inline-block;border-left:7px solid transparent;border-right:7px solid transparent;border-top:7px solid #ccc;border-top-color:rgba(0,0,0,.2);position:absolute;bottom:-7px;left:6px}.bootstrap-datetimepicker-widget.top:after{content:'';display:inline-block;border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid #fff;position:absolute;bottom:-6px;left:7px}.bootstrap-datetimepicker-widget .dow{width:14.2857%}.bootstrap-datetimepicker-widget.pull-right:before{left:auto;right:6px}.bootstrap-datetimepicker-widget.pull-right:after{left:auto;right:7px}.bootstrap-datetimepicker-widget>ul{list-style-type:none;margin:0}.bootstrap-datetimepicker-widget a[data-action]{padding:6px 0}.bootstrap-datetimepicker-widget a[data-action]:active{box-shadow:none}.bootstrap-datetimepicker-widget .timepicker-hour,.bootstrap-datetimepicker-widget .timepicker-minute,.bootstrap-datetimepicker-widget .timepicker-second{width:54px;font-weight:700;font-size:1.2em;margin:0}.bootstrap-datetimepicker-widget button[data-action]{padding:6px}.bootstrap-datetimepicker-widget table[data-hour-format="12"] .separator{width:4px;padding:0;margin:0}.bootstrap-datetimepicker-widget .datepicker>div{display:none}.bootstrap-datetimepicker-widget .picker-switch{text-align:center}.bootstrap-datetimepicker-widget table{width:100%;margin:0}.bootstrap-datetimepicker-widget td,.bootstrap-datetimepicker-widget th{text-align:center;border-radius:4px}.bootstrap-datetimepicker-widget td{height:54px;line-height:54px;width:54px}.bootstrap-datetimepicker-widget td.cw{font-size:10px;height:20px;line-height:20px;color:#777}.bootstrap-datetimepicker-widget td.day{height:20px;line-height:20px;width:20px}.bootstrap-datetimepicker-widget td.day:hover,.bootstrap-datetimepicker-widget td.hour:hover,.bootstrap-datetimepicker-widget td.minute:hover,.bootstrap-datetimepicker-widget td.second:hover{background:#eee;cursor:pointer}.bootstrap-datetimepicker-widget td.old,.bootstrap-datetimepicker-widget td.new{color:#777}.bootstrap-datetimepicker-widget td.today{position:relative}.bootstrap-datetimepicker-widget td.today:before{content:'';display:inline-block;border-left:7px solid transparent;border-bottom:7px solid #428bca;border-top-color:rgba(0,0,0,.2);position:absolute;bottom:4px;right:4px}.bootstrap-datetimepicker-widget td.active,.bootstrap-datetimepicker-widget td.active:hover{background-color:#428bca;color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25)}.bootstrap-datetimepicker-widget td.active.today:before{border-bottom-color:#fff}.bootstrap-datetimepicker-widget td.disabled,.bootstrap-datetimepicker-widget td.disabled:hover{background:0 0;color:#777;cursor:not-allowed}.bootstrap-datetimepicker-widget td span{display:inline-block;width:54px;height:54px;line-height:54px;margin:2px 1.5px;cursor:pointer;border-radius:4px}.bootstrap-datetimepicker-widget td span:hover{background:#eee}.bootstrap-datetimepicker-widget td span.active{background-color:#428bca;color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25)}.bootstrap-datetimepicker-widget td span.old{color:#777}.bootstrap-datetimepicker-widget td span.disabled,.bootstrap-datetimepicker-widget td span.disabled:hover{background:0 0;color:#777;cursor:not-allowed}.bootstrap-datetimepicker-widget th{height:20px;line-height:20px;width:20px}.bootstrap-datetimepicker-widget th.picker-switch{width:145px}.bootstrap-datetimepicker-widget th.next,.bootstrap-datetimepicker-widget th.prev{font-size:21px}.bootstrap-datetimepicker-widget th.disabled,.bootstrap-datetimepicker-widget th.disabled:hover{background:0 0;color:#777;cursor:not-allowed}.bootstrap-datetimepicker-widget thead tr:first-child th{cursor:pointer}.bootstrap-datetimepicker-widget thead tr:first-child th:hover{background:#eee}.input-group.date .input-group-addon span{display:block;cursor:pointer;width:16px;height:16px}.bootstrap-datetimepicker-widget.left-oriented:before{left:auto;right:6px}.bootstrap-datetimepicker-widget.left-oriented:after{left:auto;right:7px}.bootstrap-datetimepicker-widget ul.list-unstyled li div.timepicker div.timepicker-picker table.table-condensed tbody>tr>td{padding:0!important}@media screen and (max-width:767px){.bootstrap-datetimepicker-widget.timepicker-sbs{width:283px}}
|
||||
*/
|
||||
.bootstrap-datetimepicker-widget {
|
||||
list-style: none;
|
||||
}
|
||||
.bootstrap-datetimepicker-widget.dropdown-menu {
|
||||
margin: 2px 0;
|
||||
padding: 4px;
|
||||
width: 19em;
|
||||
}
|
||||
@media (min-width: 768px) {
|
||||
.bootstrap-datetimepicker-widget.dropdown-menu.timepicker-sbs {
|
||||
width: 38em;
|
||||
}
|
||||
}
|
||||
@media (min-width: 992px) {
|
||||
.bootstrap-datetimepicker-widget.dropdown-menu.timepicker-sbs {
|
||||
width: 38em;
|
||||
}
|
||||
}
|
||||
@media (min-width: 1200px) {
|
||||
.bootstrap-datetimepicker-widget.dropdown-menu.timepicker-sbs {
|
||||
width: 38em;
|
||||
}
|
||||
}
|
||||
.bootstrap-datetimepicker-widget.dropdown-menu:before,
|
||||
.bootstrap-datetimepicker-widget.dropdown-menu:after {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
}
|
||||
.bootstrap-datetimepicker-widget.dropdown-menu.bottom:before {
|
||||
border-left: 7px solid transparent;
|
||||
border-right: 7px solid transparent;
|
||||
border-bottom: 7px solid #cccccc;
|
||||
border-bottom-color: rgba(0, 0, 0, 0.2);
|
||||
top: -7px;
|
||||
left: 7px;
|
||||
}
|
||||
.bootstrap-datetimepicker-widget.dropdown-menu.bottom:after {
|
||||
border-left: 6px solid transparent;
|
||||
border-right: 6px solid transparent;
|
||||
border-bottom: 6px solid white;
|
||||
top: -6px;
|
||||
left: 8px;
|
||||
}
|
||||
.bootstrap-datetimepicker-widget.dropdown-menu.top:before {
|
||||
border-left: 7px solid transparent;
|
||||
border-right: 7px solid transparent;
|
||||
border-top: 7px solid #cccccc;
|
||||
border-top-color: rgba(0, 0, 0, 0.2);
|
||||
bottom: -7px;
|
||||
left: 6px;
|
||||
}
|
||||
.bootstrap-datetimepicker-widget.dropdown-menu.top:after {
|
||||
border-left: 6px solid transparent;
|
||||
border-right: 6px solid transparent;
|
||||
border-top: 6px solid white;
|
||||
bottom: -6px;
|
||||
left: 7px;
|
||||
}
|
||||
.bootstrap-datetimepicker-widget.dropdown-menu.pull-right:before {
|
||||
left: auto;
|
||||
right: 6px;
|
||||
}
|
||||
.bootstrap-datetimepicker-widget.dropdown-menu.pull-right:after {
|
||||
left: auto;
|
||||
right: 7px;
|
||||
}
|
||||
.bootstrap-datetimepicker-widget .list-unstyled {
|
||||
margin: 0;
|
||||
}
|
||||
.bootstrap-datetimepicker-widget a[data-action] {
|
||||
padding: 6px 0;
|
||||
}
|
||||
.bootstrap-datetimepicker-widget a[data-action]:active {
|
||||
box-shadow: none;
|
||||
}
|
||||
.bootstrap-datetimepicker-widget .timepicker-hour,
|
||||
.bootstrap-datetimepicker-widget .timepicker-minute,
|
||||
.bootstrap-datetimepicker-widget .timepicker-second {
|
||||
width: 54px;
|
||||
font-weight: bold;
|
||||
font-size: 1.2em;
|
||||
margin: 0;
|
||||
}
|
||||
.bootstrap-datetimepicker-widget button[data-action] {
|
||||
padding: 6px;
|
||||
}
|
||||
.bootstrap-datetimepicker-widget .btn[data-action="incrementHours"]::after {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
margin: -1px;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
border: 0;
|
||||
content: "Increment Hours";
|
||||
}
|
||||
.bootstrap-datetimepicker-widget .btn[data-action="incrementMinutes"]::after {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
margin: -1px;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
border: 0;
|
||||
content: "Increment Minutes";
|
||||
}
|
||||
.bootstrap-datetimepicker-widget .btn[data-action="decrementHours"]::after {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
margin: -1px;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
border: 0;
|
||||
content: "Decrement Hours";
|
||||
}
|
||||
.bootstrap-datetimepicker-widget .btn[data-action="decrementMinutes"]::after {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
margin: -1px;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
border: 0;
|
||||
content: "Decrement Minutes";
|
||||
}
|
||||
.bootstrap-datetimepicker-widget .btn[data-action="showHours"]::after {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
margin: -1px;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
border: 0;
|
||||
content: "Show Hours";
|
||||
}
|
||||
.bootstrap-datetimepicker-widget .btn[data-action="showMinutes"]::after {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
margin: -1px;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
border: 0;
|
||||
content: "Show Minutes";
|
||||
}
|
||||
.bootstrap-datetimepicker-widget .btn[data-action="togglePeriod"]::after {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
margin: -1px;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
border: 0;
|
||||
content: "Toggle AM/PM";
|
||||
}
|
||||
.bootstrap-datetimepicker-widget .btn[data-action="clear"]::after {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
margin: -1px;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
border: 0;
|
||||
content: "Clear the picker";
|
||||
}
|
||||
.bootstrap-datetimepicker-widget .btn[data-action="today"]::after {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
margin: -1px;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
border: 0;
|
||||
content: "Set the date to today";
|
||||
}
|
||||
.bootstrap-datetimepicker-widget .picker-switch {
|
||||
text-align: center;
|
||||
}
|
||||
.bootstrap-datetimepicker-widget .picker-switch::after {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
margin: -1px;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
border: 0;
|
||||
content: "Toggle Date and Time Screens";
|
||||
}
|
||||
.bootstrap-datetimepicker-widget .picker-switch td {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
height: auto;
|
||||
width: auto;
|
||||
line-height: inherit;
|
||||
}
|
||||
.bootstrap-datetimepicker-widget .picker-switch td span {
|
||||
line-height: 2.5;
|
||||
height: 2.5em;
|
||||
width: 100%;
|
||||
}
|
||||
.bootstrap-datetimepicker-widget table {
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
.bootstrap-datetimepicker-widget table td,
|
||||
.bootstrap-datetimepicker-widget table th {
|
||||
text-align: center;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.bootstrap-datetimepicker-widget table th {
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
width: 20px;
|
||||
}
|
||||
.bootstrap-datetimepicker-widget table th.picker-switch {
|
||||
width: 145px;
|
||||
}
|
||||
.bootstrap-datetimepicker-widget table th.disabled,
|
||||
.bootstrap-datetimepicker-widget table th.disabled:hover {
|
||||
background: none;
|
||||
color: #777777;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.bootstrap-datetimepicker-widget table th.prev::after {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
margin: -1px;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
border: 0;
|
||||
content: "Previous Month";
|
||||
}
|
||||
.bootstrap-datetimepicker-widget table th.next::after {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
margin: -1px;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
border: 0;
|
||||
content: "Next Month";
|
||||
}
|
||||
.bootstrap-datetimepicker-widget table thead tr:first-child th {
|
||||
cursor: pointer;
|
||||
}
|
||||
.bootstrap-datetimepicker-widget table thead tr:first-child th:hover {
|
||||
background: #eeeeee;
|
||||
}
|
||||
.bootstrap-datetimepicker-widget table td {
|
||||
height: 54px;
|
||||
line-height: 54px;
|
||||
width: 54px;
|
||||
}
|
||||
.bootstrap-datetimepicker-widget table td.cw {
|
||||
font-size: .8em;
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
color: #777777;
|
||||
}
|
||||
.bootstrap-datetimepicker-widget table td.day {
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
width: 20px;
|
||||
}
|
||||
.bootstrap-datetimepicker-widget table td.day:hover,
|
||||
.bootstrap-datetimepicker-widget table td.hour:hover,
|
||||
.bootstrap-datetimepicker-widget table td.minute:hover,
|
||||
.bootstrap-datetimepicker-widget table td.second:hover {
|
||||
background: #eeeeee;
|
||||
cursor: pointer;
|
||||
}
|
||||
.bootstrap-datetimepicker-widget table td.old,
|
||||
.bootstrap-datetimepicker-widget table td.new {
|
||||
color: #777777;
|
||||
}
|
||||
.bootstrap-datetimepicker-widget table td.today {
|
||||
position: relative;
|
||||
}
|
||||
.bootstrap-datetimepicker-widget table td.today:before {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
border: 0 0 7px 7px solid transparent;
|
||||
border-bottom-color: #337ab7;
|
||||
border-top-color: rgba(0, 0, 0, 0.2);
|
||||
position: absolute;
|
||||
bottom: 4px;
|
||||
right: 4px;
|
||||
}
|
||||
.bootstrap-datetimepicker-widget table td.active,
|
||||
.bootstrap-datetimepicker-widget table td.active:hover {
|
||||
background-color: #337ab7;
|
||||
color: #ffffff;
|
||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
.bootstrap-datetimepicker-widget table td.active.today:before {
|
||||
border-bottom-color: #fff;
|
||||
}
|
||||
.bootstrap-datetimepicker-widget table td.disabled,
|
||||
.bootstrap-datetimepicker-widget table td.disabled:hover {
|
||||
background: none;
|
||||
color: #777777;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.bootstrap-datetimepicker-widget table td span {
|
||||
display: inline-block;
|
||||
width: 54px;
|
||||
height: 54px;
|
||||
line-height: 54px;
|
||||
margin: 2px 1.5px;
|
||||
cursor: pointer;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.bootstrap-datetimepicker-widget table td span:hover {
|
||||
background: #eeeeee;
|
||||
}
|
||||
.bootstrap-datetimepicker-widget table td span.active {
|
||||
background-color: #337ab7;
|
||||
color: #ffffff;
|
||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
.bootstrap-datetimepicker-widget table td span.old {
|
||||
color: #777777;
|
||||
}
|
||||
.bootstrap-datetimepicker-widget table td span.disabled,
|
||||
.bootstrap-datetimepicker-widget table td span.disabled:hover {
|
||||
background: none;
|
||||
color: #777777;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.bootstrap-datetimepicker-widget.usetwentyfour td.hour {
|
||||
height: 27px;
|
||||
line-height: 27px;
|
||||
}
|
||||
.input-group.date .input-group-addon {
|
||||
cursor: pointer;
|
||||
}
|
||||
.sr-only {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
margin: -1px;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
border: 0;
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,11 +1,15 @@
|
|||
$(function () {
|
||||
var minstart = $('#datetimepicker-start').data('date-minstart');
|
||||
var maxrange = $('#datetimepicker-end').data('date-maxrange');
|
||||
$('#datetimepicker-start').datetimepicker();
|
||||
$('#datetimepicker-start').data('DateTimePicker').setMinDate(moment().add(1,'h'));
|
||||
$('#datetimepicker-start').data('DateTimePicker').minDate(moment.utc().add(minstart,'m'));
|
||||
$('#datetimepicker-end').datetimepicker();
|
||||
$('#datetimepicker-end').data('DateTimePicker').minDate(moment.utc().add(minstart,'m'));
|
||||
$("#datetimepicker-start").on('dp.change',function (e) {
|
||||
//Setting minimum and maximum for end
|
||||
$('#datetimepicker-end').data('DateTimePicker').setMinDate(e.date);
|
||||
$('#datetimepicker-end').data('DateTimePicker').setMaxDate(moment(e.date).add(24, 'h'));
|
||||
//Setting default, minimum and maximum for end
|
||||
$('#datetimepicker-end').data('DateTimePicker').defaultDate(moment.utc(e.date).add(60, 'm'));
|
||||
$('#datetimepicker-end').data('DateTimePicker').minDate(e.date);
|
||||
$('#datetimepicker-end').data('DateTimePicker').maxDate(moment.utc(e.date).add(maxrange, 'm'));
|
||||
});
|
||||
|
||||
$('#satellite-selection').change( function() {
|
||||
|
@ -30,32 +34,40 @@ $( document ).ready( function(){
|
|||
$.ajax({
|
||||
url: '/prediction_windows/' + satellite + '/' + start_time + '/' + end_time + '/'
|
||||
}).done(function(data) {
|
||||
var dc = 0; //Data counter
|
||||
var suggested_data = [];
|
||||
$.each(data, function( i,k ){
|
||||
label = k.id + ' - ' + k.name;
|
||||
var times = [];
|
||||
$.each(k.window, function( m,n ){
|
||||
var starting_time = moment(n.start).valueOf();
|
||||
var ending_time = moment(n.end).valueOf();
|
||||
$('#windows-data').append('<input type="hidden" name="'+dc+'-starting_time" value="'+n.start+'">');
|
||||
$('#windows-data').append('<input type="hidden" name="'+dc+'-ending_time" value="'+n.end+'">');
|
||||
$('#windows-data').append('<input type="hidden" name="'+dc+'-station" value="'+k.id+'">');
|
||||
times.push({starting_time: starting_time, ending_time: ending_time})
|
||||
dc = dc +1;
|
||||
if (data['error']) {
|
||||
var error_msg = data['error'];
|
||||
$('#timeline').empty();
|
||||
$('#windows-data').html('<span class="text-danger">' + error_msg + '</span>');
|
||||
} else {
|
||||
var dc = 0; //Data counter
|
||||
var suggested_data = [];
|
||||
$('#windows-data').empty();
|
||||
$.each(data, function( i,k ){
|
||||
label = k.id + ' - ' + k.name;
|
||||
var times = [];
|
||||
$.each(k.window, function( m,n ){
|
||||
var starting_time = moment.utc(n.start).valueOf();
|
||||
var ending_time = moment.utc(n.end).valueOf();
|
||||
console.log(starting_time + '-' + ending_time);
|
||||
$('#windows-data').append('<input type="hidden" name="'+dc+'-starting_time" value="'+n.start+'">');
|
||||
$('#windows-data').append('<input type="hidden" name="'+dc+'-ending_time" value="'+n.end+'">');
|
||||
$('#windows-data').append('<input type="hidden" name="'+dc+'-station" value="'+k.id+'">');
|
||||
times.push({starting_time: starting_time, ending_time: ending_time})
|
||||
dc = dc +1;
|
||||
});
|
||||
suggested_data.push({label : label, times : times});
|
||||
});
|
||||
suggested_data.push({label : label, times : times});
|
||||
});
|
||||
|
||||
$('#windows-data').append('<input type="hidden" name="total" value="'+dc+'">');
|
||||
timeline_init(start_time, end_time, suggested_data);
|
||||
$('#windows-data').append('<input type="hidden" name="total" value="'+dc+'">');
|
||||
timeline_init(start_time, end_time, suggested_data);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function timeline_init( start, end, payload ){
|
||||
var start_time_timeline = moment(start).valueOf();
|
||||
var end_time_timeline = moment(end).valueOf();
|
||||
var start_time_timeline = moment.utc(start).valueOf();
|
||||
var end_time_timeline = moment.utc(end).valueOf();
|
||||
|
||||
$('#timeline').empty();
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
<span class="label label-info">Owner</span>
|
||||
<span class="gs-front-data">
|
||||
<a href="{% url 'users:view_user' username=featured_station.owner.username %}">
|
||||
{{ featured_station.owner.get_full_name }}
|
||||
{{ featured_station.owner.displayname }}
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
|
@ -134,7 +134,7 @@
|
|||
</td>
|
||||
<td>
|
||||
<a href="{% url 'users:view_user' username=observation.author.username %}">
|
||||
{{ observation.author.get_full_name }}
|
||||
{{ observation.author.displayname }}
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -166,7 +166,7 @@
|
|||
<td>{% frq observation.transponder.downlink_low %}</td>
|
||||
<td>{{ observation.transponder.mode }}</td>
|
||||
<td>{{ observation.start|date:"Y-m-d H:i:s" }}</br>{{ observation.end|date:"Y-m-d H:i:s" }}</td>
|
||||
<td>{{ observation.author.get_full_name }}</td>
|
||||
<td>{{ observation.author.displayname }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">Transponder</label>
|
||||
<div class="col-sm-9">
|
||||
<select id="transponder-selection" class="form-control" disabled name="transponder" >
|
||||
<select id="transponder-selection" class="form-control" disabled name="transponder">
|
||||
<option id="no-transponder" value="" disabled selected>No transponder available</option>
|
||||
{% for transponder in transponders %}
|
||||
<option data-satellite="{{ transponder.satellite.norad_cat_id }}"
|
||||
|
@ -52,12 +52,15 @@
|
|||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">Start Time</label>
|
||||
<div class="col-sm-9">
|
||||
<div class='input-group date' id='datetimepicker-start'>
|
||||
<div class='input-group date' id="datetimepicker-start"
|
||||
data-date-minstart="{{ date_min_start }}">
|
||||
<input type="text"
|
||||
class="form-control"
|
||||
name="start-time"
|
||||
data-date-format="YYYY-MM-DD HH:mm" />
|
||||
<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span>
|
||||
data-date-format="YYYY-MM-DD HH:mm"
|
||||
autocomplete="off">
|
||||
<span class="input-group-addon">
|
||||
<span class="glyphicon glyphicon-calendar"></span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -65,14 +68,21 @@
|
|||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">End Time</label>
|
||||
<div class="col-sm-9">
|
||||
<div class='input-group date' id='datetimepicker-end'>
|
||||
<div class='input-group date' id="datetimepicker-end"
|
||||
data-date-maxrange="{{ date_max_range }}">
|
||||
<input type="text"
|
||||
class="form-control"
|
||||
name="end-time"
|
||||
data-date-format="YYYY-MM-DD HH:mm" />
|
||||
<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span>
|
||||
data-date-format="YYYY-MM-DD HH:mm"
|
||||
autocomplete="off">
|
||||
<span class="input-group-addon">
|
||||
<span class="glyphicon glyphicon-calendar"></span>
|
||||
</span>
|
||||
</div>
|
||||
<small class="pull-right">
|
||||
<strong>IMPORTANT:</strong>
|
||||
Timeframe is considered to be in UTC timezone.
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
<td>{{ observation.start|date:"Y-m-d H:i:s" }}</br>{{ observation.end|date:"Y-m-d H:i:s" }}</td>
|
||||
<td>
|
||||
<a href="{% url 'users:view_user' username=observation.author.username %}">
|
||||
{{ observation.author.get_full_name }}
|
||||
{{ observation.author.displayname }}
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
<td>{{ observation.start|date:"Y-m-d H:i:s" }}</br>{{ observation.end|date:"Y-m-d H:i:s" }}</td>
|
||||
<td>
|
||||
<a href="{% url 'users:view_user' username=observation.author.username %}">
|
||||
{{ observation.author.get_full_name }}
|
||||
{{ observation.author.displayname }}
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -80,7 +80,7 @@
|
|||
{% else %}
|
||||
<div class="row">
|
||||
<div class="col-md-12 notice">
|
||||
<p>{{ user.get_full_name }} is not an owner of any ground stations.</p>
|
||||
<p>{{ user.displayname }} is not an owner of any ground stations.</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
@ -95,6 +95,11 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<h3>Observations</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if observations %}
|
||||
<div class="row">
|
||||
|
@ -106,7 +111,6 @@
|
|||
<th>Frequency</th>
|
||||
<th>Encoding</th>
|
||||
<th>Timeframe</th>
|
||||
<th>Observer</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for observation in observations.all %}
|
||||
|
@ -127,7 +131,6 @@
|
|||
<td>{% frq observation.transponder.downlink_low %}</td>
|
||||
<td>{{ observation.transponder.mode }}</td>
|
||||
<td>{{ observation.start|date:"Y-m-d H:i:s" }}</br>{{ observation.end|date:"Y-m-d H:i:s" }}</td>
|
||||
<td>{{ observation.author.get_full_name }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
@ -137,7 +140,7 @@
|
|||
{% else %}
|
||||
<div class="row">
|
||||
<div class="col-md-12 notice">
|
||||
<p>{{ user.get_full_name }} is not an author of any observations.</p>
|
||||
<p>{{ user.displayname }} is not an author of any observations.</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
|
Loading…
Reference in New Issue