From 8782cb1a9031495ee0e64127c8b63c7d91a6f3b6 Mon Sep 17 00:00:00 2001 From: Spythere Date: Sat, 19 Feb 2022 18:38:21 +0100 Subject: [PATCH] =?UTF-8?q?Nowy=20filtr=20dla=20historii=20rozk=C5=82ad?= =?UTF-8?q?=C3=B3w=20jazdy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/JournalView/JournalOptions.vue | 2 +- src/locales/en.json | 3 ++- src/locales/pl.json | 3 ++- src/views/JournalView.vue | 9 +++++---- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/components/JournalView/JournalOptions.vue b/src/components/JournalView/JournalOptions.vue index 73fce7b..71bf91f 100644 --- a/src/components/JournalView/JournalOptions.vue +++ b/src/components/JournalView/JournalOptions.vue @@ -60,7 +60,7 @@ export default defineComponent({ setup() { const { t } = useI18n(); - const sorterOptions = ['date', 'distance', 'total-stops']; + const sorterOptions = ['timetableId', 'beginDate', 'distance', 'total-stops']; const translatedSorterOptions = computed(() => sorterOptions.map((id) => ({ diff --git a/src/locales/en.json b/src/locales/en.json index ae14f15..eb4bbf9 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -179,7 +179,8 @@ "option-distance": "distance", "option-total-stops": "total stops", - "option-date": "date" + "option-beginDate": "date", + "option-timetableId": "timetable ID" }, "scenery": { "users": "PLAYERS ONLINE", diff --git a/src/locales/pl.json b/src/locales/pl.json index 3e3566b..20261bd 100644 --- a/src/locales/pl.json +++ b/src/locales/pl.json @@ -180,7 +180,8 @@ "option-distance": "kilometraż", "option-total-stops": "stacje", - "option-date": "data" + "option-beginDate": "data", + "option-timetableId": "ID rozkładu" }, "scenery": { "users": "GRACZE ONLINE", diff --git a/src/views/JournalView.vue b/src/views/JournalView.vue index 6519428..327c4b6 100644 --- a/src/views/JournalView.vue +++ b/src/views/JournalView.vue @@ -207,7 +207,7 @@ export default defineComponent({ error: null, }); - const sorterActive = ref({ id: 'date', dir: -1 }); + const sorterActive = ref({ id: 'timetableId', dir: -1 }); const searchedDriver = ref(''); const searchedTrain = ref(''); @@ -266,21 +266,22 @@ export default defineComponent({ props: { searchedDriver?: string; searchedTrain?: string; - maxCount?: number; } = {} ) { this.historyDataStatus.status = DataStatus.Loading; const queries: string[] = []; - if (!props.searchedDriver && !props.searchedTrain) queries.push('count=15'); - if (props.maxCount) queries.push(`count=${props.maxCount}`); if (props.searchedDriver) queries.push(`driver=${props.searchedDriver}`); if (props.searchedTrain) queries.push(`train=${props.searchedTrain}`); // Z API: const SORT_TYPES = ['allStopsCount', 'endDate', 'beginDate', 'routeDistance']; if (this.sorterActive.id == 'distance') queries.push('sortBy=routeDistance'); else if (this.sorterActive.id == 'total-stops') queries.push('sortBy=allStopsCount'); + else if (this.sorterActive.id == 'beginDate') queries.push('sortBy=beginDate'); + else queries.push('sortBy=timetableId'); + + queries.push('countLimit=15') try { const responseData: APIResponse | null = await (await axios.get(`${API_URL}?${queries.join('&')}`)).data;