diff options
author | Daniel Friesel <derf@finalrewind.org> | 2019-04-23 18:08:07 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2019-04-23 18:08:07 +0200 |
commit | e168d9cd39c38b8e5a1994c8bf11376d26e9ea77 (patch) | |
tree | dee321d330a8fc9c106c18863db179972c9abac6 /public/static | |
parent | 812be4f0cbeb74db379a2c931ceb2c88bd9fabf7 (diff) |
Use one row per journey instead of split checkin/checkout entries
Whether a user is in transit or not is now determined by an entry in the
in_transit table instead of a dangling checkin.
All completed journeys are stored in the "journeys" table.
This does most of the work needed for automatic checkout. However, note that
the corresponding worker process is not implemented yet.
Diffstat (limited to 'public/static')
-rw-r--r-- | public/static/js/travelynx-actions.js | 18 | ||||
-rw-r--r-- | public/static/js/travelynx-actions.min.js | 2 | ||||
l--------- | public/static/v6 (renamed from public/static/v4) | 0 |
3 files changed, 10 insertions, 10 deletions
diff --git a/public/static/js/travelynx-actions.js b/public/static/js/travelynx-actions.js index 3f1eb89..583c806 100644 --- a/public/static/js/travelynx-actions.js +++ b/public/static/js/travelynx-actions.js @@ -1,11 +1,11 @@ -function tvly_run(link, req, redir, err_callback) { +function tvly_run(link, req, err_callback) { var error_icon = '<i class="material-icons">error</i>'; var progressbar = $('<div class="progress"><div class="indeterminate"></div></div>'); link.hide(); link.after(progressbar); $.post('/action', req, function(data) { if (data.success) { - $(location).attr('href', redir); + $(location).attr('href', data.redirect_to); } else { M.toast({html: error_icon + ' ' + data.error}); progressbar.remove(); @@ -25,7 +25,7 @@ $(document).ready(function() { station: link.data('station'), train: link.data('train'), }; - tvly_run(link, req, '/'); + tvly_run(link, req); }); $('.action-checkout').click(function() { var link = $(this); @@ -34,7 +34,7 @@ $(document).ready(function() { station: link.data('station'), force: link.data('force'), }; - tvly_run(link, req, '/s/' + req.station, function() { + tvly_run(link, req, function() { link.append(' – Ohne Echtzeitdaten auschecken?') link.data('force', true); }); @@ -45,7 +45,7 @@ $(document).ready(function() { action: 'undo', undo_id: link.data('id'), }; - tvly_run(link, req, '/'); + tvly_run(link, req); }); $('.action-cancelled-from').click(function() { var link = $(this); @@ -54,7 +54,7 @@ $(document).ready(function() { station: link.data('station'), train: link.data('train'), }; - tvly_run(link, req, '/'); + tvly_run(link, req); }); $('.action-cancelled-to').click(function() { var link = $(this); @@ -63,19 +63,19 @@ $(document).ready(function() { station: link.data('station'), force: true, }; - tvly_run(link, req, '/'); + tvly_run(link, req); }); $('.action-delete').click(function() { var link = $(this); var req = { action: 'delete', - ids: link.data('id'), + id: link.data('id'), checkin: link.data('checkin'), checkout: link.data('checkout'), }; really_delete = confirm("Diese Zugfahrt wirklich löschen? Der Eintrag wird sofort aus der Datenbank entfernt und kann nicht wiederhergestellt werden."); if (really_delete) { - tvly_run(link, req, '/history'); + tvly_run(link, req); } }); }); diff --git a/public/static/js/travelynx-actions.min.js b/public/static/js/travelynx-actions.min.js index 57b6284..db9fa1b 100644 --- a/public/static/js/travelynx-actions.min.js +++ b/public/static/js/travelynx-actions.min.js @@ -1 +1 @@ -function tvly_run(n,t,a,c){var i='<i class="material-icons">error</i>',e=$('<div class="progress"><div class="indeterminate"></div></div>');n.hide(),n.after(e),$.post("/action",t,function(t){t.success?$(location).attr("href",a):(M.toast({html:i+" "+t.error}),e.remove(),c&&c(),n.append(" "+i),n.show())})}$(document).ready(function(){$(".action-checkin").click(function(){var t=$(this);tvly_run(t,{action:"checkin",station:t.data("station"),train:t.data("train")},"/")}),$(".action-checkout").click(function(){var t=$(this),n={action:"checkout",station:t.data("station"),force:t.data("force")};tvly_run(t,n,"/s/"+n.station,function(){t.append(" – Ohne Echtzeitdaten auschecken?"),t.data("force",!0)})}),$(".action-undo").click(function(){var t=$(this);tvly_run(t,{action:"undo",undo_id:t.data("id")},"/")}),$(".action-cancelled-from").click(function(){var t=$(this);tvly_run(t,{action:"cancelled_from",station:t.data("station"),train:t.data("train")},"/")}),$(".action-cancelled-to").click(function(){var t=$(this);tvly_run(t,{action:"cancelled_to",station:t.data("station"),force:!0},"/")}),$(".action-delete").click(function(){var t=$(this),n={action:"delete",ids:t.data("id"),checkin:t.data("checkin"),checkout:t.data("checkout")};really_delete=confirm("Diese Zugfahrt wirklich löschen? Der Eintrag wird sofort aus der Datenbank entfernt und kann nicht wiederhergestellt werden."),really_delete&&tvly_run(t,n,"/history")})}); +function tvly_run(t,n,a){var c='<i class="material-icons">error</i>',i=$('<div class="progress"><div class="indeterminate"></div></div>');t.hide(),t.after(i),$.post("/action",n,function(n){n.success?$(location).attr("href",n.redirect_to):(M.toast({html:c+" "+n.error}),i.remove(),a&&a(),t.append(" "+c),t.show())})}$(document).ready(function(){$(".action-checkin").click(function(){var t=$(this);tvly_run(t,{action:"checkin",station:t.data("station"),train:t.data("train")})}),$(".action-checkout").click(function(){var t=$(this),n={action:"checkout",station:t.data("station"),force:t.data("force")};tvly_run(t,n,function(){t.append(" – Ohne Echtzeitdaten auschecken?"),t.data("force",!0)})}),$(".action-undo").click(function(){var t=$(this);tvly_run(t,{action:"undo",undo_id:t.data("id")})}),$(".action-cancelled-from").click(function(){var t=$(this);tvly_run(t,{action:"cancelled_from",station:t.data("station"),train:t.data("train")})}),$(".action-cancelled-to").click(function(){var t=$(this);tvly_run(t,{action:"cancelled_to",station:t.data("station"),force:!0})}),$(".action-delete").click(function(){var t=$(this),n={action:"delete",id:t.data("id"),checkin:t.data("checkin"),checkout:t.data("checkout")};really_delete=confirm("Diese Zugfahrt wirklich löschen? Der Eintrag wird sofort aus der Datenbank entfernt und kann nicht wiederhergestellt werden."),really_delete&&tvly_run(t,n)})}); diff --git a/public/static/v4 b/public/static/v6 index 945c9b4..945c9b4 120000 --- a/public/static/v4 +++ b/public/static/v6 |