Compare commits

..

No commits in common. "be7262bbdf4a19f7a3d3b21359b2917856134f11" and "0b09d098fd3b41f58419d107b652ffe097638781" have entirely different histories.

2 changed files with 12 additions and 9 deletions

View File

@ -8,9 +8,9 @@ export async function userPresence(_, { search, onlyServants }) {
where: {
wifiDevices: { some: { lastSeen: { not: null } } }
},
orderBy: { displayName: 'asc' },
include: {
wifiDevices: {
orderBy: [{ lastSeen: 'desc' }],
include: { accessPoint: true }
}
}
@ -50,7 +50,7 @@ export async function userPresence(_, { search, onlyServants }) {
}
const sortedUsers = filteredUsers
.sort((a, b) => a.displayName.localeCompare(b.displayName))
.sort((a, b) => b.displayName.localeCompare(a.displayName))
.sort((a, b) => {
const [aStatus, bStatus] = [
a.wifiDevices[0].status,
@ -69,7 +69,7 @@ export async function userPresence(_, { search, onlyServants }) {
)
return 1
return 0
return a.wifiDevices[0].lastSeen < b.wifiDevices[0].lastSeen ? 1 : -1
})
const userPresence = sortedUsers

View File

@ -269,6 +269,7 @@
<script>
import gql from 'graphql-tag'
import Avatar from '@/components/Avatar'
import { debounce } from '../utils/debounce'
export default {
name: 'UserPresence',
@ -362,12 +363,14 @@ export default {
}[status]
},
updateQuery() {
this.$router.replace({
query: {
search: this.search || undefined,
onlyServants: this.onlyServants || undefined
}
})
debounce(() =>
this.$router.replace({
query: {
search: this.search || undefined,
onlyServants: this.onlyServants || undefined
}
})
)()
}
}
}