Browse Source

Improve submissions filtering

master
Menci 6 years ago
parent
commit
6603a2c1e2
  1. 3
      modules/admin.js
  2. 3
      modules/submission.js
  3. 11
      views/admin_rejudge.ejs
  4. 1
      views/submissions.ejs

3
modules/admin.js

@ -354,7 +354,8 @@ app.post('/admin/rejudge', async (req, res) => {
};
if (req.body.language) {
if (req.body.language === 'submit-answer') where.language = '';
if (req.body.language === 'submit-answer') where.language = { $or: [{ $eq: '', }, { $eq: null }] };
else if (req.body.language === 'non-submit-answer') where.language = { $not: '' };
else where.language = req.body.language;
}
if (req.body.status) where.status = { $like: req.body.status + '%' };

3
modules/submission.js

@ -63,7 +63,8 @@ app.get('/submissions', async (req, res) => {
}
if (req.query.language) {
if (req.query.language === 'submit-answer') where.language = '';
if (req.query.language === 'submit-answer') where.language = { $or: [{ $eq: '', }, { $eq: null }] };
else if (req.query.language === 'non-submit-answer') where.language = { $not: '' };
else where.language = req.query.language;
}
if (req.query.status) where.status = { $like: req.query.status + '%' };

11
views/admin_rejudge.ejs

@ -17,10 +17,11 @@
<i class="dropdown icon"></i>
<div class="default text"></div>
<div class="menu">
<div class="item" data-value="">不限</div>
<div class="item" data-value="submit-answer">提交答案</div>
<div class="item" data-value=""><b>不限</b></div>
<div class="item" data-value="submit-answer"><b>提交答案</b></div>
<div class="item" data-value="non-submit-answer"><b>非提交答案</b></div>
<% for (let lang of syzoj.config.filter_enabled_languages) { %>
<div class="item" data-value="<%= lang %>"><%= syzoj.languages[lang].show %></div>
<div class="item" data-value="<%= lang %>"><b><%= syzoj.languages[lang].show %></b></div>
<% } %>
</div>
</div>
@ -32,10 +33,10 @@
<i class="dropdown icon"></i>
<div class="default text"></div>
<div class="menu">
<div class="item" data-value="">不限<i class="dropdown icon" style="visibility: hidden; "></i></div>
<div class="item" data-value=""><b>不限</b><i class="dropdown icon" style="visibility: hidden; "></i></div>
<% for (let status in this.icon) { %>
<% if (this.iconHidden.includes(status)) continue; %>
<div class="item" data-value="<%= status %>"><span class="status <%= status.toLowerCase().split(' ').join('_') %>"><i class="<%= this.icon[status] %> icon"></i> <%= status %></div>
<div class="item" data-value="<%= status === 'Pending' ? 'Waiting' : status %>"><span class="status <%= status.toLowerCase().split(' ').join('_') %>"><i class="<%= this.icon[status] %> icon"></i> <b><%= status %></b></div>
<% } %>
</div>
</div>

1
views/submissions.ejs

@ -38,6 +38,7 @@
<div class="menu">
<div class="item" data-value=""><b>不限</b></div>
<div class="item" data-value="submit-answer"><b>提交答案</b></div>
<div class="item" data-value="non-submit-answer"><b>非提交答案</b></div>
<% for (let lang of syzoj.config.filter_enabled_languages) { %>
<div style="font-size: 12.5px; " class="item" data-value="<%= lang %>"><b><%= syzoj.languages[lang].show %></b></div>
<% } %>

Loading…
Cancel
Save