Compare commits
2 Commits
0b09d098fd
...
be7262bbdf
Author | SHA1 | Date | |
---|---|---|---|
|
be7262bbdf | ||
|
9829092229 |
|
@ -8,9 +8,9 @@ export async function userPresence(_, { search, onlyServants }) {
|
||||||
where: {
|
where: {
|
||||||
wifiDevices: { some: { lastSeen: { not: null } } }
|
wifiDevices: { some: { lastSeen: { not: null } } }
|
||||||
},
|
},
|
||||||
|
orderBy: { displayName: 'asc' },
|
||||||
include: {
|
include: {
|
||||||
wifiDevices: {
|
wifiDevices: {
|
||||||
orderBy: [{ lastSeen: 'desc' }],
|
|
||||||
include: { accessPoint: true }
|
include: { accessPoint: true }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ export async function userPresence(_, { search, onlyServants }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const sortedUsers = filteredUsers
|
const sortedUsers = filteredUsers
|
||||||
.sort((a, b) => b.displayName.localeCompare(a.displayName))
|
.sort((a, b) => a.displayName.localeCompare(b.displayName))
|
||||||
.sort((a, b) => {
|
.sort((a, b) => {
|
||||||
const [aStatus, bStatus] = [
|
const [aStatus, bStatus] = [
|
||||||
a.wifiDevices[0].status,
|
a.wifiDevices[0].status,
|
||||||
|
@ -69,7 +69,7 @@ export async function userPresence(_, { search, onlyServants }) {
|
||||||
)
|
)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
return a.wifiDevices[0].lastSeen < b.wifiDevices[0].lastSeen ? 1 : -1
|
return 0
|
||||||
})
|
})
|
||||||
|
|
||||||
const userPresence = sortedUsers
|
const userPresence = sortedUsers
|
||||||
|
|
|
@ -269,7 +269,6 @@
|
||||||
<script>
|
<script>
|
||||||
import gql from 'graphql-tag'
|
import gql from 'graphql-tag'
|
||||||
import Avatar from '@/components/Avatar'
|
import Avatar from '@/components/Avatar'
|
||||||
import { debounce } from '../utils/debounce'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'UserPresence',
|
name: 'UserPresence',
|
||||||
|
@ -363,14 +362,12 @@ export default {
|
||||||
}[status]
|
}[status]
|
||||||
},
|
},
|
||||||
updateQuery() {
|
updateQuery() {
|
||||||
debounce(() =>
|
this.$router.replace({
|
||||||
this.$router.replace({
|
query: {
|
||||||
query: {
|
search: this.search || undefined,
|
||||||
search: this.search || undefined,
|
onlyServants: this.onlyServants || undefined
|
||||||
onlyServants: this.onlyServants || undefined
|
}
|
||||||
}
|
})
|
||||||
})
|
|
||||||
)()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user