diff --git a/src/components/StationsView/StationCard.vue b/src/components/StationsView/StationCard.vue
index 60885a0..559d074 100644
--- a/src/components/StationsView/StationCard.vue
+++ b/src/components/StationsView/StationCard.vue
@@ -124,9 +124,9 @@
({
+ ...stationTrain,
+ hasTimetable: this.trains.find(train => train.timetableData && train.trainNo === stationTrain.trainNo)
+ }))
+ }
+
get computedScheduledTrains() {
+ console.log(this.stationInfo.stationName, "test");
+
return this.stationInfo.scheduledTrains.sort((a, b) => {
if (a.arrivalTime > b.arrivalTime) return 1;
else if ((a.arrivalTime < b.arrivalTime)) return -1;
return a.departureTime > b.departureTime ? 1 : -1;
})
- }
- hasTimetable(trainNo: number) {
- return this.trains.find(train => train.timetableData && train.trainNo === trainNo);
}
timestampToTime(timestamp: number) {
diff --git a/src/components/StationsView/StationTable.vue b/src/components/StationsView/StationTable.vue
index 2b88da1..aa4de67 100644
--- a/src/components/StationsView/StationTable.vue
+++ b/src/components/StationsView/StationTable.vue
@@ -145,7 +145,6 @@ import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import Station from "@/scripts/interfaces/Station";
-import Train from "@/scripts/interfaces/Train";
import styleMixin from "@/mixins/styleMixin";
diff --git a/src/store/store.ts b/src/store/store.ts
index a37c30a..cdf3012 100644
--- a/src/store/store.ts
+++ b/src/store/store.ts
@@ -97,7 +97,7 @@ export default class Store extends VuexModule {
this.context.commit('setJSONData');
this.context.dispatch('fetchOnlineData');
- setInterval(() => this.context.dispatch('fetchOnlineData'), 20000);
+ setInterval(() => this.context.dispatch('fetchOnlineData'), 5000);
}
@Action({ commit: 'updateTimetableData' })
@@ -304,16 +304,14 @@ export default class Store extends VuexModule {
@Mutation
private updateOnlineTrains(updatedTrainList) {
- this.trainList =
- this.trainList.length == 0
- ? updatedTrainList
- : this.trainList.reduce((acc, train) => {
- const onlineTrainData = updatedTrainList.find(updatedTrain => train.trainNo === updatedTrain.trainNo);
+ this.trainList = updatedTrainList.reduce((acc, updatedTrain) => {
+ const trainData = this.trainList.find(train => train.trainNo === updatedTrain.trainNo);
- if (onlineTrainData) acc.push({ ...train, ...onlineTrainData });
+ if (trainData) acc.push({ ...updatedTrain, ...trainData });
+ else acc.push({ ...updatedTrain });
- return acc;
- }, [] as Train[]);
+ return acc;
+ }, [] as Train[]);
this.trainCount = this.trainList.filter(train => train.online).length;
this.dataConnectionStatus = Status.Loaded;
@@ -347,6 +345,8 @@ export default class Store extends VuexModule {
return acc;
}, []);
+ // console.log('gituwa');
+
return { ...station, scheduledTrains };
});
diff --git a/src/views/StationsView.vue b/src/views/StationsView.vue
index 95ac079..7492821 100644
--- a/src/views/StationsView.vue
+++ b/src/views/StationsView.vue
@@ -124,8 +124,6 @@ export default class StationsView extends Vue {
const dir: number = this.sorterActive.dir;
// const scheduledTrainList = this.scheduledTrains;
-
-
return this.stationList
.filter((station) => {
if (!station.reqLevel || station.reqLevel == "-1") return true;