diff --git a/infoscreen/hsl_fetcher.py b/infoscreen/hsl_fetcher.py
index 6c75797..ce169b4 100644
--- a/infoscreen/hsl_fetcher.py
+++ b/infoscreen/hsl_fetcher.py
@@ -9,7 +9,6 @@ class HSLFetcher:
last_fetched = datetime.fromtimestamp(0) # epoch
INTERVAL = 1 # minutes
-
logging.info("Set up scheduled HSL API fetch every {} minutes".format(INTERVAL))
def fetch_if_needed(self):
@@ -26,10 +25,13 @@ class HSLFetcher:
data = json.loads(src)
arr = []
+
+ time=datetime.now()+timedelta(minutes = settings.HSL_DEPARTURE_THRESHOLD)
+ time="{}{}".format(time.hour,time.minute)
for element in data:
src = urllib.request.urlopen(
- "http://api.reittiopas.fi/hsl/prod/?userhash={}&request=stop&code={}"
- .format(settings.HSL_USERHASH, element['code'])).read().decode("utf-8")
+ "http://api.reittiopas.fi/hsl/prod/?userhash={}&request=stop&code={}&dep_limit=20&time={}"
+ .format(settings.HSL_USERHASH, element['code'],time)).read().decode("utf-8")
parsed = json.loads(src)[0]
arr.append({"name": parsed['name_fi'], "lines": parsed['lines'],
diff --git a/infoscreen/static/html/hsl.html b/infoscreen/static/html/hsl.html
index 58f40e0..f237ab5 100644
--- a/infoscreen/static/html/hsl.html
+++ b/infoscreen/static/html/hsl.html
@@ -8,7 +8,7 @@
Aika
- Bussin numero
+ Numero
|
Pysäkki
@@ -23,7 +23,7 @@
|
{{x.time}}
|
-
+ |
{{x.bus}}
|
diff --git a/infoscreen/static/js/infoscreen_controllers.js b/infoscreen/static/js/infoscreen_controllers.js
index 922c230..daadf7b 100644
--- a/infoscreen/static/js/infoscreen_controllers.js
+++ b/infoscreen/static/js/infoscreen_controllers.js
@@ -114,20 +114,27 @@ app.controller('timetableCtrl',
"bus":code,
"date":date,
"time":pad(hours,2)+":"+pad(minutes,2),
- "laststop":dict[line['code']].split(",")[0].split(" l.")[0],
+ "laststop":dict[line['code']].split(",")[0].split(" l.")[0], //
"hurry":false
};
+ //We don't want busses to Otaniemi
+ if(temp['laststop']=='Otaniemi')
+ break;
+ if(temp['stop']=='Alvar Aallon puisto')
+ temp['stop']="A. A. puisto"
var trigger=true;
- for(var objectIndex= $scope.arr.length-1;objectIndex>=0;objectIndex--)
- if( $scope.arr[objectIndex]['bus']==temp['bus'] && $scope.arr[objectIndex]['laststop']==temp['laststop']){
- if( $scope.arr[objectIndex]['dist']==temp['dist']){
+ for(var objIndex= $scope.arr.length-1;objIndex>=0;objIndex--){
+ var temp2 = $scope.arr[objIndex];
+ if( temp2['bus']==temp['bus'] && temp2['laststop']==temp['laststop']){
+ if( temp2['dist']==temp['dist']){
break;
}
- else if( $scope.arr[objectIndex]['dist'] > temp['dist']){
- $scope.arr.splice(objectIndex,1);
+ else if( temp2['dist'] > temp['dist']){
+ $scope.arr.splice(objIndex,1);
}
else
trigger=false;
+ }
}
if(trigger){
$scope.arr.push(temp);
diff --git a/sikweb/settings-sample.py b/sikweb/settings-sample.py
index f274030..6dfd78f 100644
--- a/sikweb/settings-sample.py
+++ b/sikweb/settings-sample.py
@@ -137,7 +137,7 @@ LOGPATH = "logs/debug.log"
LANGUAGE_CODE = 'en-us'
-TIME_ZONE = 'UTC'
+TIME_ZONE = 'Europe/Helsinki'
USE_I18N = True
|