last_seen für den baruser hinzugefügt. so werden nur die leute im gerücht angezegit, welche in den letzten 72 stunden vom bardienst schulden hinzugefügt bekommen haben.

This commit is contained in:
Tim Gröger 2020-06-07 23:29:38 +02:00
parent 2061dfddec
commit b97acbef14
3 changed files with 27 additions and 10 deletions

View File

@ -6,7 +6,9 @@
Willst du wirklich?? Willst du wirklich??
</v-card-title> </v-card-title>
<v-card-text v-if="stornoMessage"> <v-card-text v-if="stornoMessage">
Willst du wirklich den Betrag {{(stornoMessage.amount/100).toFixed(2)}} von {{stornoMessage.user.firstname}} Willst du wirklich den Betrag
{{ (stornoMessage.amount / 100).toFixed(2) }} von
{{ stornoMessage.user.firstname }}
{{ stornoMessage.user.lastname }} stornieren? {{ stornoMessage.user.lastname }} stornieren?
</v-card-text> </v-card-text>
<v-card-actions> <v-card-actions>
@ -69,7 +71,7 @@
</v-list-item-group> </v-list-item-group>
</v-navigation-drawer> </v-navigation-drawer>
<div v-for="user in users" :key="users.indexOf(user)"> <div v-for="user in users" :key="users.indexOf(user)">
<div v-if="isFiltered(user)"> <div v-if="isFiltered(user) && calcLastSeen(user)">
<v-container> <v-container>
<v-card :loading="user.loading"> <v-card :loading="user.loading">
<v-card-title> <v-card-title>
@ -357,6 +359,15 @@ export default {
' hinzugefügt.' ' hinzugefügt.'
} }
return text 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: { computed: {

View File

@ -1,6 +1,6 @@
//const main = 'https://192.168.5.128:5000/' //const main = 'https://192.168.5.128:5000/'
//const main = 'http://localhost:5000/' const main = 'http://localhost:5000/'
const main = 'http://192.168.5.118:5000/' //const main = 'http://192.168.5.118:5000/'
//const main = 'https://groeger-clan.duckdns.org:5000/' //const main = 'https://groeger-clan.duckdns.org:5000/'
const url = { const url = {

View File

@ -28,7 +28,9 @@ const mutations = {
let existuser = state.users.find(a => { let existuser = state.users.find(a => {
return user === a.username 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) { if (existuser) {
existuser.sername = users[user].username existuser.sername = users[user].username
existuser.firstname = users[user].firstname existuser.firstname = users[user].firstname
@ -37,6 +39,7 @@ const mutations = {
existuser.amount = users[user].amount existuser.amount = users[user].amount
existuser.type = users[user].type existuser.type = users[user].type
existuser.limit = users[user].limit existuser.limit = users[user].limit
existuser.last_seen = users[user].last_seen
} else { } else {
state.users.push({ state.users.push({
username: users[user].username, username: users[user].username,
@ -46,7 +49,8 @@ const mutations = {
amount: users[user].amount, amount: users[user].amount,
type: users[user].type, type: users[user].type,
loading: false, 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.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 => { sortUsers: state => {
state.users = state.users.sort((a, b) => { state.users = state.users.sort((a, b) => {
@ -206,7 +212,7 @@ const actions = {
} }
} }
try { try {
commit('updateUser', { username: data.username, loading: false }) commit('updateUser', { username: data.username, loading: false, last_seen: new Date() })
} catch { } catch {
// error // error
} }