Browse Source

提交数也可以排序

master
richie 5 years ago
parent
commit
5acd674a09
  1. 2
      modules/user.js
  2. 2
      views/ranklist.ejs

2
modules/user.js

@ -9,7 +9,7 @@ app.get('/ranklist', async (req, res) => {
try { try {
const sort = req.query.sort || syzoj.config.sorting.ranklist.field; const sort = req.query.sort || syzoj.config.sorting.ranklist.field;
const order = req.query.order || syzoj.config.sorting.ranklist.order; const order = req.query.order || syzoj.config.sorting.ranklist.order;
if (!['ac_num', 'rating', 'id', 'username'].includes(sort) || !['asc', 'desc'].includes(order)) { if (!['ac_num', 'submit_num', 'rating', 'id', 'username'].includes(sort) || !['asc', 'desc'].includes(order)) {
throw new ErrorMessage('错误的排序参数。'); throw new ErrorMessage('错误的排序参数。');
} }
let paginate = syzoj.utils.paginate(await User.countForPagination({ is_show: true }), req.query.page, syzoj.config.page.ranklist); let paginate = syzoj.utils.paginate(await User.countForPagination({ is_show: true }), req.query.page, syzoj.config.page.ranklist);

2
views/ranklist.ejs

@ -15,7 +15,7 @@
<th style="width: 150px; "><%- createSortableTitle('username', '用户名', true) %></th> <th style="width: 150px; "><%- createSortableTitle('username', '用户名', true) %></th>
<th style="width: 100px; "><%- createSortableTitle('ac_num', '通过数量', false) %></th> <th style="width: 100px; "><%- createSortableTitle('ac_num', '通过数量', false) %></th>
<th style="width: 150px; "><%- createSortableTitle('submit_num', '提交数量', true) %></th> <th style="width: 150px; "><%- createSortableTitle('submit_num', '提交数量', true) %></th>
<th style="width: 150px; "><%- createSortableTitle('percent', '通过率', true) %></th> <th style="width: 150px; ">通过率</th>
<th style="width: 100px; "><%- createSortableTitle('rating', '积分', false) %></th> <th style="width: 100px; "><%- createSortableTitle('rating', '积分', false) %></th>
</tr> </tr>
</thead> </thead>

Loading…
Cancel
Save