Github contributors add sort order

This commit is contained in:
Linghao Zhang
2020-03-21 16:26:17 +08:00
parent 17de3a13a8
commit c4a13afcab
4 changed files with 32 additions and 33 deletions

View File

@@ -4,6 +4,7 @@ const config = require('@/config').value;
module.exports = async (ctx) => {
const user = ctx.params.user;
const repo = ctx.params.repo;
const order = ctx.params.order;
const anon = ctx.params.anon;
const host = `https://github.com/${user}/${repo}`;
@@ -53,7 +54,7 @@ module.exports = async (ctx) => {
data.forEach(function(item) {
const time = new Date();
time.setMinutes(time.getMinutes() - data.length + index);
time.setMinutes(time.getMinutes() + (order === 'asc' ? -data.length + index : -index));
index++;
if (item.type === 'Anonymous') {