set avatar

This commit is contained in:
Flummi 2022-03-29 14:34:00 +02:00
parent 982ddce087
commit 4fff49ff5d
2 changed files with 14 additions and 11 deletions

View File

@ -64,9 +64,10 @@ export default (router, tpl) => {
router.get(/^\/ranking$/, async (req, res) => { router.get(/^\/ranking$/, async (req, res) => {
try { try {
const list = await sql('tags_assign') const list = await sql('tags_assign')
.select('user.user') .select('user.user', sql.raw('coalesce(user_options.avatar, 47319) as avatar'))
.leftJoin('user', 'user.id', 'tags_assign.user_id') .leftJoin('user', 'user.id', 'tags_assign.user_id')
.groupBy('user.user') .leftJoin('user_options', 'user_options.user_id', 'user.id')
.groupBy('user.user', 'user_options.avatar')
.orderBy('count', 'desc') .orderBy('count', 'desc')
.countDistinct('tag_id', 'item_id', { as: 'count' }); .countDistinct('tag_id', 'item_id', { as: 'count' });

View File

@ -26,23 +26,25 @@
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
<th></th>
<th>id</th>
<th>created_at</th>
<th>last_used</th>
<th>last_action</th>
<th>&nbsp;</th> <th>&nbsp;</th>
<th>id</th>
<th>&nbsp;</th>
<th>last action</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@each(sessions as sess) @each(sessions as sess)
<tr@if(sess.id === session.sess_id) style="background-color: rgb(0, 89, 0)"@endif> <tr@if(sess.id === session.sess_id) style="background-color: rgb(0, 89, 0)"@endif>
<td>{{ sess.kmsi ? '&#9875;' : '' }}</td> <td>{{ sess.kmsi ? '&#9875;' : '' }}</td>
<td tooltip="{{ sess.browser }}" flow="right">{{ sess.id }}</td> <td tooltip="{{ sess.browser }}" flow="right">
<td>{{ new Date(sess.created_at * 1e3).toLocaleString("de-DE") }}</td> <p>{{ sess.id }}</p>
<td>{{ new Date(sess.last_used * 1e3).toLocaleString("de-DE") }}</td> <p><a href="#" onclick="alert('not yet implemented!');">logout</a></p>
</td>
<td>
<p>last_used: {{ new Date(sess.last_used * 1e3).toLocaleString("de-DE") }}</p>
<p>created_at: {{ new Date(sess.created_at * 1e3).toLocaleString("de-DE") }}</p>
</td>
<td><a href="{{ sess.last_action }}" target="_blank">{{ sess.last_action }}</a></td> <td><a href="{{ sess.last_action }}" target="_blank">{{ sess.last_action }}</a></td>
<td><a href="#" onclick="alert('not yet implemented!');">logout</a></td>
</tr> </tr>
@endeach @endeach
</tbody> </tbody>