Skip to content
This repository has been archived by the owner on Feb 5, 2024. It is now read-only.

Commit

Permalink
Merge pull request #69 from gedorinku/fix-standings-score-time
Browse files Browse the repository at this point in the history
ランキングの時間はレスポンスのscoreTimeを見るようにした。
  • Loading branch information
Fukusan64 committed Jul 20, 2018
2 parents ad2a06e + 98b8bf8 commit f10b0ca
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
25 changes: 16 additions & 9 deletions src/components/contest/Contest.vue
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,18 @@
>
{{detail.point}}<br>
<span v-if="detail.point > 0">
{{getElapsedTime(detail.updatedAt)}}<br>
{{ detail.scoreTime | formatDuration }}<br>
</span>
<span class="has-text-danger" v-if="detail.wrongCount !== 0">
(-{{detail.wrongCount}})
</span>
</td>
<td v-else>-</td>
<td>{{column.totalPoint}}</td>
<td>
{{column.totalPoint}}<br>
<span v-if="column.totalPoint > 0">
{{ column.scoreTime | formatDuration }}<br>
</span></td>
</tr>
</tbody>
</table>
Expand Down Expand Up @@ -331,17 +335,20 @@ export default {
.format(format || 'YYYY/MM/DD(ddd) HH:mm')
;
},
getElapsedTime(data) {
const diff = moment(data).diff(this.startAt);
const HH = `${Math.floor(diff / 1000 / 60 / 60)}`;
const mm = `00${Math.floor(diff / 1000 / 60) % 60}`.slice(-2);
const ss = `00${Math.floor(diff / 1000) % 60}`.slice(-2);
return `${HH}:${mm}:${ss}`;
},
submitCode(value) {
this.submit({ value, problemIndex: this.activeTab });
},
},
filters: {
formatDuration(duration) {
const sec = Math.floor(duration / 1000000000);
const min = Math.floor(sec / 60);
const hour = Math.floor(min / 60);
const mm = `00${min % 60}`.slice(-2);
const ss = `00${sec % 60}`.slice(-2);
return `${hour}:${mm}:${ss}`;
},
},
components: {
Tag,
Modal,
Expand Down
1 change: 1 addition & 0 deletions src/store/modules/contests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ export default {
totalPoint: v.point,
displayName: usersMap.get(v.userID),
details: getDetailsArray(v.details, problemsMap, state.problems.length),
scoreTime: v.scoreTime,
}))
;
commit('setStandings', standings);
Expand Down

0 comments on commit f10b0ca

Please sign in to comment.