Browse Source

Fix bugs.

pull/6/head
t123yh 7 years ago
parent
commit
38375e3807
  1. 6
      modules/user.js
  2. 8
      static/style.css
  3. 2
      views/user.ejs

6
modules/user.js

@ -109,15 +109,14 @@ app.get('/user/:id', async (req, res) => {
const ratingHistoryValues = await RatingHistory.query(null, { user_id: user.id }, [['rating_calculation_id', 'asc']]);
const ratingHistories = [{
name: "初始积分",
contestName: "初始积分",
value: syzoj.config.default.user.rating,
delta: null,
rank: null
}];
ratingHistories.reverse();
for (const history of ratingHistoryValues) {
const contest = await Contest.fromId((await RatingCalculation.fromID(history.rating_calculation_id)).contest_id);
const contest = await Contest.fromID((await RatingCalculation.fromID(history.rating_calculation_id)).contest_id);
ratingHistories.push({
contestName: contest.title,
value: history.rating_after,
@ -126,6 +125,7 @@ app.get('/user/:id', async (req, res) => {
participants: await ContestPlayer.count({ contest_id: contest.id })
});
}
ratingHistories.reverse();
res.render('user', {
show_user: user,

8
static/style.css

@ -499,6 +499,14 @@ body > .ui.page.dimmer {
text-shadow: 0 0 0.1px;
}
.rating_up {
color: #dd4b39;
}
.rating_down {
color: #3d9400;
}
/* code tag */
:not(pre) > code {
background-color: rgba(0, 0, 0, 0.08);

2
views/user.ejs

@ -137,7 +137,7 @@
<td><%= history.rank != null ? history.rank + " / " + history.participants : '' %></td>
<td><%= history.value %>
<% if(history.delta != null) { %>
<span class="<%= history.delta >= 0 ? 'red' : 'green' %>">
<span class="<%= history.delta >= 0 ? 'rating_up' : 'rating_down' %>">
(<%= (history.delta < 0 ? '' : '+') + history.delta %>)
<% } %>
</td>

Loading…
Cancel
Save