From b97acbef142ffd437ec454f1037d3fe978e08a3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Sun, 7 Jun 2020 23:29:38 +0200 Subject: [PATCH] =?UTF-8?q?last=5Fseen=20f=C3=BCr=20den=20baruser=20hinzug?= =?UTF-8?q?ef=C3=BCgt.=20so=20werden=20nur=20die=20leute=20im=20ger=C3=BCc?= =?UTF-8?q?ht=20angezegit,=20welche=20in=20den=20letzten=2072=20stunden=20?= =?UTF-8?q?vom=20bardienst=20schulden=20hinzugef=C3=BCgt=20bekommen=20habe?= =?UTF-8?q?n.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/baruser/CreditLists.vue | 21 ++++++++++++++++----- src/plugins/routes.js | 4 ++-- src/store/modules/barUsers.js | 12 +++++++++--- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/src/components/baruser/CreditLists.vue b/src/components/baruser/CreditLists.vue index 170d539..21dd77d 100644 --- a/src/components/baruser/CreditLists.vue +++ b/src/components/baruser/CreditLists.vue @@ -6,11 +6,13 @@ Willst du wirklich?? - Willst du wirklich den Betrag {{(stornoMessage.amount/100).toFixed(2)}}€ von {{stornoMessage.user.firstname}} - {{stornoMessage.user.lastname}} stornieren? + Willst du wirklich den Betrag + {{ (stornoMessage.amount / 100).toFixed(2) }}€ von + {{ stornoMessage.user.firstname }} + {{ stornoMessage.user.lastname }} stornieren? - + Abbrechen Stornieren @@ -19,7 +21,7 @@ Transaktion ist länger als 1 Minute her!Transaktion ist länger als 1 Minute her! Da die Transaktion länger als 1 Minuter her ist, kann eine Stornierung @@ -69,7 +71,7 @@
-
+
@@ -357,6 +359,15 @@ export default { ' hinzugefügt.' } return text + }, + calcLastSeen(user) { + if (user.last_seen) { + let date = new Date() + if (((date - user.last_seen)/1000/60/60) < 72) { + return true + } + } + return false } }, computed: { diff --git a/src/plugins/routes.js b/src/plugins/routes.js index 8aab36d..0e716ce 100644 --- a/src/plugins/routes.js +++ b/src/plugins/routes.js @@ -1,6 +1,6 @@ //const main = 'https://192.168.5.128:5000/' -//const main = 'http://localhost:5000/' -const main = 'http://192.168.5.118:5000/' +const main = 'http://localhost:5000/' +//const main = 'http://192.168.5.118:5000/' //const main = 'https://groeger-clan.duckdns.org:5000/' const url = { diff --git a/src/store/modules/barUsers.js b/src/store/modules/barUsers.js index 92e7788..8365e25 100644 --- a/src/store/modules/barUsers.js +++ b/src/store/modules/barUsers.js @@ -28,7 +28,9 @@ const mutations = { let existuser = state.users.find(a => { return user === a.username }) - + if (users[user].last_seen != null || users[user].last_seen != undefined) { + users[user].last_seen = new Date(users[user].last_seen.year, users[user].last_seen.month -1, users[user].last_seen.day, users[user].last_seen.hour, users[user].last_seen.minute, users[user].last_seen.second) + } if (existuser) { existuser.sername = users[user].username existuser.firstname = users[user].firstname @@ -37,6 +39,7 @@ const mutations = { existuser.amount = users[user].amount existuser.type = users[user].type existuser.limit = users[user].limit + existuser.last_seen = users[user].last_seen } else { state.users.push({ username: users[user].username, @@ -46,7 +49,8 @@ const mutations = { amount: users[user].amount, type: users[user].type, loading: false, - limit: users[user].limit + limit: users[user].limit, + last_seen: users[user].last_seen }) } } @@ -59,6 +63,8 @@ const mutations = { }) ) if (data.loading !== undefined) state.users[index].loading = data.loading + if (data.last_seen !== undefined) state.users[index].last_seen = data.last_seen + console.log('user', state.users[index]) }, sortUsers: state => { state.users = state.users.sort((a, b) => { @@ -206,7 +212,7 @@ const actions = { } } try { - commit('updateUser', { username: data.username, loading: false }) + commit('updateUser', { username: data.username, loading: false, last_seen: new Date() }) } catch { // error }