1
0
Fork 0

Merge branch 'performance-improvements' into 'master'

Hot fix for scheduling permission and automatic calculation

See merge request librespacefoundation/satnogs/satnogs-network!796
merge-requests/796/merge
Alfredos-Panagiotis Damkalis 2019-11-28 22:31:32 +00:00
commit 33d143ce19
3 changed files with 13 additions and 4 deletions

View File

@ -70,7 +70,11 @@ def schedule_stations_perms(user, stations):
# User has online station (status=2) and station is online
try:
if user.ground_stations.filter(status=2).exists():
return {station.id: station.status == 2 for station in stations}
return {
s.id: s.status == 2 or (s.owner == user and s.status == 1)
for s in stations
}
except ObjectDoesNotExist:
pass
# If the station is testing (status=1) and user is its owner

View File

@ -42,7 +42,7 @@ $(document).ready( function(){
`;
}
function select_proper_stations(filters){
function select_proper_stations(filters, callback){
var url = '/scheduling_stations/';
var data = {'transmitter': filters.transmitter};
if (filters.station) {
@ -88,6 +88,9 @@ $(document).ready( function(){
</option>`).prop('disabled', true);
$('#station-selection').selectpicker('refresh');
}
if (callback) {
callback();
}
$('#station-field-loading').hide();
$('#station-field').show();
});
@ -195,7 +198,9 @@ $(document).ready( function(){
$('#transmitter-selection').selectpicker('refresh');
}
if (callback) {
callback();
select_proper_stations(filters,callback);
} else {
select_proper_stations(filters);
}
$('#transmitter-field-loading').hide();
$('#transmitter-field').show();

View File

@ -80,7 +80,7 @@ dev =
[flake8]
max-complexity = 25
max-line-length = 99
ignore = F403,W504
ignore = F403,W504,W503
exclude = network/_version.py,versioneer.py,*/migrations,docs,build,.tox,node_modules
[yapf]