Skip to content

Commit 467a33f

Browse files
committed
minor fixes
1 parent ce76736 commit 467a33f

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

services/users.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ const getContestParticipantsData = async (contest) => {
382382
console.info(
383383
`users fetched: ${i + limit} (${getPercentage(
384384
Math.min(i + limit, failedRanks.length),
385-
total
385+
failedRanks.length
386386
)}%)`
387387
);
388388
}
@@ -433,6 +433,9 @@ const updateUsers = async (job) => {
433433
const failed = [];
434434
let totalSuccess = 0;
435435
const fetchUserHelper = async (user) => {
436+
if(!user){
437+
return;
438+
}
436439
const [data_region, username] = user._id.split("/");
437440
const [result, err] = await fetchUserInfo(username, data_region);
438441
if (err) {

views/index.ejs

+17-14
Original file line numberDiff line numberDiff line change
@@ -85,19 +85,22 @@
8585

8686
<script src="https://cdn.jsdelivr.net/npm/simple-datatables@latest" type="text/javascript"></script>
8787
<script>
88-
function localizeDate(page) {
89-
const startTimes = document.getElementsByClassName('startTime')
90-
for (const startTime of startTimes) {
91-
const dateString = startTime.data.trim()
92-
startTime.textContent = new Date(dateString).toLocaleString()
88+
(function () {
89+
function localizeDate(page) {
90+
const startTimes = document.getElementsByClassName('startTime')
91+
for (const startTime of startTimes) {
92+
const dateString = startTime.data.trim()
93+
startTime.textContent = new Date(dateString).toLocaleString()
94+
}
9395
}
94-
}
95-
const dataTable = new simpleDatatables.DataTable("#contest-table", {
96-
searchable: true,
97-
fixedHeight: true,
98-
sortable: false,
99-
});
96+
const dataTable = new simpleDatatables.DataTable("#contest-table", {
97+
searchable: true,
98+
fixedHeight: true,
99+
sortable: false,
100+
});
100101

101-
localizeDate()
102-
dataTable.on('datatable.page', localizeDate)
103-
</script>
102+
localizeDate()
103+
dataTable.on('datatable.page', localizeDate)
104+
dataTable.on('datatable.perpage', localizeDate)
105+
})()
106+
</script>

0 commit comments

Comments
 (0)