Commit graph

432 commits

Author SHA1 Message Date
Daniel Friesel
c70280a935 Merge HAFAS XML fix from DBF 2020-10-25 16:35:43 +01:00
Daniel Friesel
dc7bc5a5f4 work: Fix travelynx->Traewelling sync when several users are checked in
I made a derp
2020-10-19 19:33:40 +02:00
Daniel Friesel
8123797cf1 Traewelling: use the recently added login token expiry field 2020-10-17 11:03:47 +02:00
Daniel Friesel
e61550f751 Move remaining journeys queries to journeys model class 2020-10-11 21:08:22 +02:00
Daniel Friesel
8abb8206ce maintenance: delete webhooks and traewelling entries 2020-10-11 20:10:14 +02:00
Daniel Friesel
b1348c7d4a move in_transit queries to an InTransit model class 2020-10-11 19:38:01 +02:00
Daniel Friesel
b6330217f0 calculate tripid from trainsearch.exe.
Removes the need for an additional transport.rest request.
2020-10-11 12:04:33 +02:00
Daniel Friesel
fffe8dcdfa Switch to transport.rest v5 for polyline requests 2020-10-11 11:34:39 +02:00
Daniel Friesel
4575beb6ff HAFAS: Turn backend warnings into info messages
We can't do anything about them, after all
2020-10-08 20:05:31 +02:00
Daniel Friesel
3ca18af9b6 make unknown stations warning more helpful 2020-10-08 20:04:25 +02:00
Daniel Friesel
e8ff730320 Stats: Fix handling of negative cumulative arrival/departure delays 2020-10-06 19:28:00 +02:00
Daniel Friesel
9acc9822e4 also allow regionalExpress, just to be safe 2020-10-04 13:09:47 +02:00
Daniel Friesel
9ad3b3c9e8 Traewelling can't seem to decide on date formats 2020-10-04 13:05:06 +02:00
Daniel Friesel
ce88fe440c HAFAS "national" trips are also trains 2020-10-04 13:04:52 +02:00
Daniel Friesel
c56d126d89 Traewelling: Add missing "Accept: application/json" header to API requests 2020-10-04 12:59:08 +02:00
Daniel Friesel
e13b5afe4f Traewelling checkin: Handle invalid / revoked bearer tokens 2020-10-04 12:47:09 +02:00
Daniel Friesel
562dd7ccae add toot and tweet settings to traewelling checkin 2020-10-04 12:27:20 +02:00
Daniel Friesel
80b02a47b4 Traewelling: Warn when bearer token is about to expire 2020-10-04 10:38:09 +02:00
Daniel Friesel
5e2813e36e Traewelling: note that traewelling.de doesn't yet return statusId on checkin 2020-10-04 10:35:04 +02:00
Daniel Friesel
2cc31422b7 sync travelynx -> Träwelling: add comment 2020-10-03 14:33:56 +02:00
Daniel Friesel
b0de6628b3 ooopsie 2020-10-01 19:55:06 +02:00
Daniel Friesel
8d53f7f5c8 log error when trip_id is missing 2020-10-01 19:52:11 +02:00
Daniel Friesel
64c9b5b160 traewelling checkin: the time limitation isn't needed 2020-10-01 19:48:18 +02:00
Daniel Friesel
07e0f89706 allow checking into traewelling 2020-10-01 19:36:35 +02:00
Daniel Friesel
89e709d8d5 Allow linking a Träwelling account, auto-sync Träwelling→travelynx
travelynx→Träwelling is still work-in-progress

Squashed commit of the following:

commit 97faa6e2e6c8d20fba30f2d0f6e78187ceeb72e6
Author: Daniel Friesel <derf@finalrewind.org>
Date:   Wed Sep 30 18:50:05 2020 +0200

    improve traewelling log and tx handling

commit 487d7dd728b9d45b731bdc7098cf3358ea2e206e
Author: Daniel Friesel <derf@finalrewind.org>
Date:   Wed Sep 30 18:02:41 2020 +0200

    add missing traewelling template

commit 0148da2f48d9a52dcddc0ab81f83d8f8ac3062ab
Author: Daniel Friesel <derf@finalrewind.org>
Date:   Wed Sep 30 18:02:35 2020 +0200

    improve traewelling pull sync

commit 4861a9750f9f2d7621043361d0af6b0a8869a0df
Author: Daniel Friesel <derf@finalrewind.org>
Date:   Tue Sep 29 22:14:24 2020 +0200

    wip checkin from traewelling

commit f6aeb6f06998a2a7a80f63a7b1b688b1a26b66bd
Author: Daniel Friesel <derf@finalrewind.org>
Date:   Tue Sep 29 18:37:53 2020 +0200

    refactor traewelling integration. login and logout are less of a hack now.

    checkin and checkout are not supported at the moment.
2020-09-30 19:12:29 +02:00
Daniel Friesel
952740969c add opengraph metadata output 2020-09-21 20:31:08 +02:00
Daniel Friesel
362db912fa add twitter card to public journey view 2020-09-21 20:15:01 +02:00
Daniel Friesel
870e4333a8 improve promise->reject error messages 2020-09-21 19:47:54 +02:00
Daniel Friesel
e27e37190e add explicit empty return statements to promise handlers 2020-09-20 10:01:03 +02:00
Daniel Friesel
2788f97f32 get_stationinfo_p: cache negative replies 2020-09-20 09:55:28 +02:00
Daniel Friesel
874de11298 handle rejected promises; do not accidentally duplicate rejections 2020-09-10 21:20:26 +02:00
Daniel Friesel
eb93ee40c9 passengerrights: fix a typo 2020-09-08 21:15:46 +02:00
Daniel Friesel
4171fe22ca add DBDB helper for wagonorder and stationinfo 2020-09-06 12:55:25 +02:00
Daniel Friesel
a3149adddd Fix checkin via API. Broken by 717cc18a40
Closes #44
2020-09-05 21:51:52 +02:00
Daniel Friesel
7eb5f967f2 profile: limit history to four weeks by default 2020-09-04 18:38:35 +02:00
Daniel Friesel
482fa975b5 add public profile page and public journey details 2020-09-03 22:27:50 +02:00
Daniel Friesel
47b957361e Move most journey code to newly introduced Journey model 2020-08-16 21:20:23 +02:00
Daniel Friesel
d9624ee308 Remove now-useless include 2020-08-15 08:25:24 +02:00
Daniel Friesel
717cc18a40 Move get_departures to a separate IRIS helper 2020-08-06 16:04:12 +02:00
Daniel Friesel
adaf65dc63 HAFAS: Error handling, perltidy 2020-07-28 14:19:55 +02:00
Daniel Friesel
56c275875c Move HAFAS helpers to a separate Helper module 2020-07-28 13:01:44 +02:00
Daniel Friesel
f08bdaca5c Move user model to a separate module 2020-07-27 18:53:22 +02:00
Daniel Friesel
f5fd6d42e1 Add CSV Export 2020-04-19 18:26:20 +02:00
Daniel Friesel
346f1474bb commute stats: attempt to weed out non-work stations for auto-fill 2020-04-19 17:49:14 +02:00
Daniel Friesel
5ce4bc6995 improve commute station heuristic
Select top station on work days (Mo .. Fr) with arrival < 13:00 or
departure >= 13:00.
2020-04-19 17:40:39 +02:00
Daniel Friesel
a3cfa598a6 use german locale in epoch_to_dt helper 2020-04-19 17:09:02 +02:00
Daniel Friesel
94ea5a089f Commute stats: count days, not journeys 2020-04-19 17:03:02 +02:00
Daniel Friesel
0a87135e35 get_top_destinations: order by count desc
order is ascending by default, resulting in flop instead of top destinations.
2020-04-19 16:50:50 +02:00
Daniel Friesel
94932c4102 add commute stats. not linked from nav yet. 2020-04-19 16:49:31 +02:00
Daniel Friesel
a3ea4fde95 fix a typo 2020-04-16 16:52:19 +02:00
Daniel Friesel
da05a0e981 maintenance: backpropagate polylines to route entries using pre-1.9.4 format 2020-04-16 16:29:34 +02:00
Daniel Friesel
ac2a23c3fa Fix occasionally incorrect TripIDs (and thus incorrect polylines)
Until now, tripIDs were cached based on station and departure timestamp.
These are identical for any two trains departing at the same time at the same
station, leading to one of those getting being assigned a wrong tripID.

From now on, only the JSON reported by transport.rest is cached -- tripIDs
are always recomputed based on it.
2020-04-16 09:47:31 +02:00
Daniel Friesel
d66cf00d9d log train number when encountering a timestamp error 2020-04-16 04:55:04 +02:00
Daniel Friesel
e5f273ced3 ignore missing timestamps when performing a force checkout 2020-04-16 04:54:41 +02:00
Daniel Friesel
4cc510d710 use polyline when computing monthly/yearly distance travelled
Closes #40
2020-04-14 18:22:49 +02:00
Daniel Friesel
6826c03386 show select past departures in checkin suggestion list
Previously, for each destination, up to two departures between now and
now + 40 minutes were shown.

When performing a fresh checkin (i.e., the has not logged a journey in the
past few minutes and is not currently checked in), the departure list now
additionally contains all departures between now - 5 minutes and now.

When checking in from a train (i.e., the user has recently checked out at
the station or is still checked in), it additionally contains all departures
between arrival time and now.

Closes #33
2020-04-14 17:45:09 +02:00
Daniel Friesel
56f355741c Well, that was stupid 2020-03-14 14:57:30 +01:00
Daniel Friesel
e7a6cfa931 Correctly encode non-ASCII e-mail content. Fixes spamfilter issues.
New dependency: MIME::Entity
2020-03-14 14:56:02 +01:00
Daniel Friesel
871a44f15e Do not hardcode From mail address 2020-03-13 18:28:13 +01:00
Daniel Friesel
e6b74ef087 show QoS pictograms in connection list 2020-03-03 18:29:37 +01:00
Daniel Friesel
d7f251e51f public user status: show polyline if available 2020-02-26 18:43:34 +01:00
Daniel Friesel
3c897ad62a polyline sanity check: Handle border stations and incomplete IRIS routes 2020-02-25 21:25:53 +01:00
Daniel Friesel
1d2b37f849 Ignore polylines which do not agree with IRIS route 2020-02-25 17:55:19 +01:00
Daniel Friesel
5c05ed609f journey details: show route on map if available 2020-02-23 19:04:05 +01:00
Daniel Friesel
82f043e734 Move map data generation to a global helper function 2020-02-23 18:35:56 +01:00
Daniel Friesel
a15dc1791c calculate journey distance using polyline, if available 2020-02-21 23:31:50 +01:00
Daniel Friesel
0011e4a18d user_status: Improve TS lookup performance 2020-02-20 20:58:58 +01:00
Daniel Friesel
57f686b688 allow showing past journeys on shared status page 2020-02-19 20:58:38 +01:00
Daniel Friesel
2652ea6bab auto-checkout for cancelled departure: guard against destination changes 2020-02-18 17:38:53 +01:00
Daniel Friesel
cc7439dd5e handle departure cancellation after checkin 2020-02-17 21:13:07 +01:00
Daniel Friesel
a1865fa69e add privacy setting for showing history and latest arrival timestamp 2020-02-14 16:29:44 +01:00
Daniel Friesel
6cbbc2b16f avoid stale data when marking cancelled arrivals 2020-02-13 18:35:42 +01:00
Daniel Friesel
a830acc698 Handle cancelled arrival at checkout when departure at checkin is not cancelled 2020-02-12 20:38:24 +01:00
Daniel Friesel
ee38d48a55 Add another fix for invalid HAFAS XML 2020-02-12 20:35:27 +01:00
Daniel Friesel
7564ec34db munin: Add polyline compression ratio 2020-02-10 20:06:55 +01:00
Daniel Friesel
3ddd1a1cf4 Improve map performance by passing actual polylines for train routes 2020-02-07 23:19:01 +01:00
Daniel Friesel
c2e0f377be maintenance: consider station renames whan backpropagating polylines 2020-02-06 17:54:23 +01:00
Daniel Friesel
0457a53f65 maintenance: only fetch polylines from journeys which were not edited 2020-02-04 21:23:22 +01:00
Daniel Friesel
eb3f4aed05 allow checkin and checkout station to be edited 2020-02-01 16:15:20 +01:00
Daniel Friesel
5439dbad34 Fix cancellation line in journey view.
Broken by 993f6be6c9
2020-02-01 14:28:10 +01:00
Daniel Friesel
a29568711f fix uninitialized value warning when handling odd trains (trains without type) 2020-02-01 10:59:46 +01:00
Daniel Friesel
aa7a7db2bc map: show polylines by default 2020-01-31 18:16:00 +01:00
Daniel Friesel
7e92e6b5d4 retroactively add polylines to non-polyline journeys 2020-01-30 18:06:04 +01:00
Daniel Friesel
dadb0f6637 map: improve polyline duplicate detection 2020-01-29 19:54:32 +01:00
Daniel Friesel
993f6be6c9 map: set bounds on stations; move polyline feature to staging 2020-01-29 18:48:58 +01:00
Daniel Friesel
fca6a5df6c journey_sanity_check: handle duration == 0 2020-01-28 20:01:00 +01:00
Daniel Friesel
297718603c munin: return number of stored polylines 2020-01-27 20:33:35 +01:00
Daniel Friesel
b47a29d484 Store journey polylines in DB
Squashed commit of the following:

commit d60c7d3c98d88a8f5b0e3ced6c11b56053e1e44b
Author: Daniel Friesel <derf@finalrewind.org>
Date:   Mon Jan 27 20:22:46 2020 +0100

    fix bugs related to users without past journeys

commit 707fcc937ac7f6bc3dc29024273f5e74963f7f15
Author: Daniel Friesel <derf@finalrewind.org>
Date:   Mon Jan 27 20:19:14 2020 +0100

    work around Cache::file turning floats into strings

commit 55831121eb30bc30ed20134bbb48e4bee9772feb
Author: Daniel Friesel <derf@finalrewind.org>
Date:   Mon Jan 27 19:43:29 2020 +0100

    store journey polylines for later use

commit 1971d511037ff2b8fbc9699cb98e4f8fd51261e5
Author: Daniel Friesel <derf@finalrewind.org>
Date:   Sat Jan 25 16:49:48 2020 +0100

    set preliminary database schema for polyline storage.

    deduplication will follow at a later stage
2020-01-27 20:32:15 +01:00
Daniel Friesel
47171500b7 fix bugs related to users without past journeys 2020-01-27 20:25:02 +01:00
Daniel Friesel
cc25a56864 Api: Import: Set correct route key for add_journey 2020-01-26 16:04:08 +01:00
Daniel Friesel
21234707fc add_journey: allow up to 99 journeys per 24 hours 2020-01-26 15:31:01 +01:00
Daniel Friesel
d7c69acf41 import API: route -> intermediateStops 2020-01-26 10:50:21 +01:00
Daniel Friesel
ba62df34ea validate_journey: handle 0 timestamps 2020-01-26 10:48:14 +01:00
Daniel Friesel
c31254e996 import API: Add deprecated field, remove development check 2020-01-26 10:47:51 +01:00
Daniel Friesel
1723f8c1fb import API: invalidate stats cache after adding a journey 2020-01-26 10:08:46 +01:00
Daniel Friesel
ce6237b9fb status API: nextStops -> intermediateStops; documentation 2020-01-26 09:59:45 +01:00
Daniel Friesel
3e9807b393 map, journey view: handle renamed stations 2020-01-25 15:46:42 +01:00
Daniel Friesel
1028e47a35 map: list skipped journeys 2020-01-25 14:55:51 +01:00
Daniel Friesel
ee1285e8fa map: support multiple polyline groups with different colors 2020-01-25 14:41:33 +01:00
Daniel Friesel
8157f38854 JSON Status API: Add experimental and undocumented nextStops key 2020-01-23 18:18:50 +01:00
Daniel Friesel
75363c35cc work: Fix race condition
When a user changes their destination station or checks into a new train
while work is updating data for their in_transit entry, values for no longer
valid database entrie would be entered.
2020-01-23 17:14:01 +01:00
Daniel Friesel
cda8e53b34 has_wagonorder: Fix promise result mixup 2020-01-22 20:18:37 +01:00
Daniel Friesel
9232cdaa5f Return HTTP 404 for unknown journeys 2020-01-19 19:21:14 +01:00
Daniel Friesel
2764826da0 /journey/🆔 verify that id is numeric
As a side effect, this turns the response of GET /journey/edit (which should
never happen in the first place) from an exception into a 404 error (#36)
2020-01-19 19:15:53 +01:00
Daniel Friesel
243302b9bb Fix IOLoop crashes caused by using log->warning instead of log->warn
The issue manifested itself by the ioloop using 100%cpu without making any
progress.
2020-01-15 22:13:20 +01:00
Daniel Friesel
263fe6da63 do not store wagonorder error results in database 2020-01-15 21:48:50 +01:00
Daniel Friesel
e8b610f3e6 fetch trip ID when checked in 2020-01-08 18:42:17 +01:00
Daniel Friesel
172c8a3d00 move old station names to external JSON as well 2020-01-06 18:24:28 +01:00
Daniel Friesel
8a73a65656 Switch back to JSON::XS for decoding 2020-01-06 18:03:50 +01:00
Daniel Friesel
f99e069928 Move ICE names to a separate JSON file 2020-01-06 17:59:40 +01:00
Markus Heinrich
d1c005606c
remove unnecessary whitespace 2020-01-06 11:22:03 +01:00
Daniel Friesel
62b68b5010 map ICE train numbers to names where possible 2020-01-04 18:48:46 +01:00
Daniel Friesel
a9a7fa4492 Release Travel API 2019-12-31 13:27:14 +01:00
Daniel Friesel
61889603f7 Checkin API: error out if fromStation / toStation are ambiguous 2019-12-30 01:31:26 +01:00
Daniel Friesel
5435f34aa1 Set travelynx UserAgent for webhook requests 2019-12-29 23:06:51 +01:00
Daniel Friesel
6fde013585 Strip newline from version string 2019-12-29 23:06:39 +01:00
Daniel Friesel
f8436b9b4b perltidy 2019-12-28 15:01:21 +01:00
Knuspel
d8b46dff89 Added links for old/new station names. 2019-12-28 14:35:07 +01:00
Daniel Friesel
d9126b927f fix connections display 2019-12-26 22:48:50 +01:00
Daniel Friesel
fe6340abeb Handle undefined user data in conncetion suggestion with no previous journey
Closes #30
2019-12-26 21:39:24 +01:00
Daniel Friesel
f9f1eec499 Use EVA IDs instead of travelynx-internal station IDs. Not 100% tested yet. 2019-12-23 22:57:45 +01:00
Daniel Friesel
c6634b4097 maintenance: remove checkins which were entered more than 48 hours ago 2019-12-20 18:56:57 +01:00
Daniel Friesel
e7f278574f more travel API documentation 2019-12-20 18:33:59 +01:00
Daniel Friesel
11a2e94a04 travel API: more helpful errors on invalid input 2019-12-20 16:39:15 +01:00
Daniel Friesel
bd372d57e2 Travel API: Add "deprecated" field 2019-12-20 16:23:41 +01:00
Daniel Friesel
ebb7c22a4b checkin api: only set comment if checkin was successful 2019-12-20 16:18:32 +01:00
Daniel Friesel
e0a2b9aa26 save all the wagon orders we can get 2019-12-19 20:16:10 +01:00
Daniel Friesel
b0ddada5d1 munin: Add 'currently checked in' counter 2019-12-19 19:22:56 +01:00
Daniel Friesel
69f961a23c disable import and checkin API endpoints in production mode 2019-12-19 19:20:06 +01:00
Daniel Friesel
f895d34f31 undo: pass UID to invalidate_stats_cache 2019-12-19 18:18:26 +01:00
Daniel Friesel
c8695ecb1c travel, import API: Verify that payload is a hash 2019-12-17 20:41:36 +01:00
Daniel Friesel
934a9ac21a api/import: More helpful errors, fix "lax" support 2019-12-17 20:09:02 +01:00
Daniel Friesel
ae21896982 API: Add lax option 2019-12-17 20:01:39 +01:00
Daniel Friesel
9adec3ee8d remove debug output 2019-12-16 22:17:40 +01:00
Daniel Friesel
bb22915fc3 Fix has_wagonorder_p logic. request success ≠ result success! 2019-12-16 22:15:37 +01:00
Daniel Friesel
cabf159f46 Handle Berlin Ringbahn and other transfer-at-destination trains
Requires Travel::Status::DE::IRIS v1.38 (not released yet)
2019-12-15 13:42:11 +01:00
Daniel Friesel
7ae60f2ea4 Travel API: comment support 2019-12-14 23:46:36 +01:00
Daniel Friesel
46fc64de48 Add travel (checkin/checkout/undo) API 2019-12-14 21:53:23 +01:00
Daniel Friesel
5fe4174feb Add API entry point for journey import 2019-12-14 20:46:02 +01:00
Daniel Friesel
ba97fd2a3c do not insert duplicate wagongroups 2019-12-13 20:37:51 +01:00
Daniel Friesel
f6bff01f76 save wagongroups if available 2019-12-13 17:28:52 +01:00
Daniel Friesel
b211e0842a permanently store wagon numbers and types when available 2019-12-12 19:21:39 +01:00
Daniel Friesel
e6160d75de show wagon order for regional trains too, if available 2019-12-11 21:36:41 +01:00
Daniel Friesel
315a94affe allow a journey's cancellation status to be edited
Closes #27
2019-12-08 19:46:45 +01:00
Daniel Friesel
561ff4574b Allow status visibility to be limited to travelynx users 2019-12-08 11:06:17 +01:00
Daniel Friesel
402a5597f5 Account: unset public_comment when public_status is disabled 2019-12-08 10:32:22 +01:00
Daniel Friesel
07ee4d216a add hash tables for is_public and journey edited bitmasks 2019-12-08 10:29:25 +01:00
Daniel Friesel
fb126c6928 optionally show journey comment in public user status
Closes #19
2019-12-06 21:44:31 +01:00
Daniel Friesel
094c536eb4 Allow comments to be entered while still in transit 2019-12-06 21:40:51 +01:00
Daniel Friesel
119f0a6b7d Do not show cancelled journeys without substitute in passengerrights list 2019-11-27 21:09:49 +01:00