Skip to content

Commit

Permalink
chore: show commit rewards instead of merged rewards
Browse files Browse the repository at this point in the history
  • Loading branch information
ourai committed Aug 7, 2024
1 parent eafcc2c commit 4db33f6
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ cache
.knosys/caches
.obpmc/data/*
!.obpmc/data/metadata.*
!.obpmc/data/rewards.*
1 change: 1 addition & 0 deletions .knosys/scripts/command/pmc/count.js
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ ${generateRewardTable(groupedRewards.none)}`
function countRewards() {
const studentRewards = resolveStudentRewards();

saveData(joinPath(pmcDataRoot, 'rewards.json'), studentRewards.reduce((p, { username, ...others }) => ({ ...p, [username]: others }), {}));
saveData(joinPath(resolvePmcRootPath(), 'reward.md'), `# 任务奖励
${studentRewards.length} 人。
Expand Down
1 change: 1 addition & 0 deletions .obpmc/data/rewards.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"604137978":{"merged":2.5,"total":5},"858536121":{"merged":5,"total":5},"964674798":{"merged":5,"total":9},"1473303013":{"merged":5,"total":5},"1959035201":{"merged":5,"total":5},"0x4E33":{"merged":5,"total":5},"0xhutou":{"merged":0,"total":0},"0xorz":{"merged":5,"total":5},"0xsuxin":{"merged":0,"total":0},"321llljjjfff123":{"merged":19,"total":19},"404ll":{"merged":0,"total":0},"AceLeeWinnie":{"merged":2.5,"total":2.5},"AhDEV-free":{"merged":0,"total":0},"AlexL0ng":{"merged":0,"total":0},"Alexzhuangyao":{"merged":0,"total":0},"Arthas0v0":{"merged":5,"total":5},"Aseisman":{"merged":29,"total":43},"BBK912":{"merged":0,"total":0},"Beavnvvv":{"merged":0,"total":0},"BerylYanjie":{"merged":2.5,"total":5},"Caseyz":{"merged":2.5,"total":5},"Chen-Lun-Hao":{"merged":29,"total":43},"CipherYin":{"merged":5,"total":5},"CodingGeoff":{"merged":0,"total":0},"Creativelf":{"merged":5,"total":5},"DawnBlackA":{"merged":15,"total":15},"DeJeune":{"merged":26.5,"total":30.5},"Debbl":{"merged":9,"total":18},"Dr-yellow":{"merged":5,"total":5},"Draculabo":{"merged":19,"total":23},"DukeDeng":{"merged":2.5,"total":5},"Eric-Cart":{"merged":0,"total":0},"Fang-Lansheng":{"merged":0,"total":0},"FrankChencc":{"merged":5,"total":5},"GGbond-Romeo":{"merged":0,"total":0},"GeeekerK":{"merged":0,"total":0},"Georgiafab":{"merged":29,"total":43},"HaisenCx":{"merged":5,"total":5},"HealerOS":{"merged":0,"total":0},"Hexi1997":{"merged":9,"total":9},"HoseaLyu":{"merged":0,"total":0},"ImSingee":{"merged":5,"total":13},"JackCat1221":{"merged":5,"total":5},"JasonStu":{"merged":2.5,"total":9},"JessieChen5":{"merged":5,"total":5},"Joejo":{"merged":2.5,"total":5},"Josh-hub01":{"merged":5,"total":5},"Justin-Xiang":{"merged":0,"total":0},"K-tang-mkv":{"merged":15,"total":15},"KarasuShin":{"merged":2.5,"total":2.5},"KeyHMX":{"merged":5,"total":5},"LeonXDH":{"merged":0,"total":0},"LittleMoreInteresting":{"merged":9,"total":23},"LotusLu777":{"merged":0,"total":0},"Lym599593":{"merged":9,"total":9},"LyricaQiang":{"merged":2.5,"total":18},"Mika-Lahtinen":{"merged":15,"total":19},"Minamogood":{"merged":0,"total":0},"Mira-mei":{"merged":0,"total":0},"MistoryChen":{"merged":0,"total":0},"NorthernDream":{"merged":5,"total":5},"Pithos23":{"merged":0,"total":0},"Raincal":{"merged":2.5,"total":2.5},"STAJJJ":{"merged":5,"total":5},"Secret1007":{"merged":9,"total":9},"Shuning0312":{"merged":5,"total":5},"ShuxunoO":{"merged":0,"total":0},"Sifotd":{"merged":5,"total":5},"Stackingrule":{"merged":0,"total":0},"TLwen114514":{"merged":5,"total":5},"TomatoDroid":{"merged":29,"total":43},"TrueTechLabs":{"merged":0,"total":0},"Tsuizen":{"merged":9,"total":18},"WAIYIN-tech":{"merged":9,"total":9},"WangEn":{"merged":5,"total":5},"Winson-030":{"merged":2.5,"total":2.5},"WonderfulWan8":{"merged":5,"total":9},"Wujerry":{"merged":29,"total":43},"Wzy-source":{"merged":5,"total":5},"XiaoMo-Donald":{"merged":2.5,"total":2.5},"Y2511525406":{"merged":10,"total":18},"YagamiNewLight":{"merged":2.5,"total":2.5},"Yahohohohohoho":{"merged":9,"total":9},"Yaqioooong":{"merged":2.5,"total":5},"Yolandatsai":{"merged":0,"total":2.5},"Yolo-00":{"merged":5,"total":5},"Yunfei1982":{"merged":5,"total":5},"Zintoki":{"merged":0,"total":0},"a6b017":{"merged":5,"total":13},"aSpecialFatPanda":{"merged":0,"total":0},"aiyoudiao":{"merged":5,"total":5},"aliyan404":{"merged":29,"total":43},"anderfib":{"merged":29,"total":29},"azyliu":{"merged":0,"total":0},"b-t-s-1":{"merged":9,"total":9},"bcma2333":{"merged":2.5,"total":9},"bcyangxu":{"merged":2.5,"total":2.5},"bdingtech":{"merged":0,"total":0},"ben100118":{"merged":5,"total":5},"billyma128":{"merged":2.5,"total":5},"birdream":{"merged":0,"total":0},"blackdogTT":{"merged":5,"total":5},"bluehawana":{"merged":0,"total":2.5},"bravehot":{"merged":19,"total":33},"bytesloop":{"merged":0,"total":2.5},"caesear":{"merged":5,"total":5},"caocanx":{"merged":5,"total":5},"carola-niu":{"merged":29,"total":43},"ccchur":{"merged":9,"total":9},"cdt3211":{"merged":5,"total":5},"chanhohn":{"merged":5,"total":9},"channely":{"merged":0,"total":0},"charming-06":{"merged":0,"total":2.5},"chefuny":{"merged":5,"total":5},"chensid":{"merged":2.5,"total":2.5},"choizhang":{"merged":29,"total":38},"coconal":{"merged":29,"total":29},"code342":{"merged":0,"total":0},"coderprepares":{"merged":5,"total":13},"coolberwin":{"merged":29,"total":43},"dark-Qy":{"merged":2.5,"total":2.5},"dethan3":{"merged":0,"total":0},"dirtmelon":{"merged":5,"total":5},"dockershe":{"merged":5,"total":9},"dongyuanwai":{"merged":0,"total":2.5},"douglas-ou":{"merged":0,"total":0},"dreamahouse":{"merged":5,"total":9},"elliotxin":{"merged":2.5,"total":2.5},"flatcc":{"merged":5,"total":5},"flexibility2":{"merged":29,"total":43},"flytam":{"merged":29,"total":43},"fragrans-maotou":{"merged":0,"total":0},"fyh2001":{"merged":2.5,"total":2.5},"gamble369":{"merged":5,"total":5},"gnls666":{"merged":0,"total":5},"gunksd":{"merged":10,"total":12.5},"haobarry":{"merged":2.5,"total":2.5},"hbrls":{"merged":0,"total":0},"hu-qi":{"merged":5,"total":9},"huangkuaikuai":{"merged":5,"total":5},"humbornjo":{"merged":9,"total":23},"hundren":{"merged":5,"total":5},"huzhengen":{"merged":29,"total":43},"hwwang2":{"merged":29,"total":43},"isLiuyinghao":{"merged":9,"total":9},"jamie-ji":{"merged":5,"total":5},"jeff09-28":{"merged":5,"total":5},"jeffierw":{"merged":5,"total":5},"jerikchan":{"merged":2.5,"total":2.5},"jerryq1":{"merged":2.5,"total":2.5},"jiantao88":{"merged":5,"total":9},"joy-joy-joy-joy-joy-joy-joy":{"merged":29,"total":43},"kakuro9":{"merged":5,"total":5},"kangvcar":{"merged":0,"total":0},"kepplow":{"merged":0,"total":0},"keyding":{"merged":29,"total":43},"kiwi6185":{"merged":5,"total":5},"knit-zhang":{"merged":29,"total":29},"leon-kay":{"merged":5,"total":5},"limitcool":{"merged":2.5,"total":2.5},"limsenkeat":{"merged":9,"total":13},"linghuccc":{"merged":29,"total":29},"linhaishe":{"merged":9,"total":18},"lispking":{"merged":29,"total":43},"litie2023":{"merged":0,"total":0},"littleLane":{"merged":5,"total":5},"liudafengshu":{"merged":29,"total":38},"liulvcheng":{"merged":2.5,"total":5},"liuzizi0505":{"merged":0,"total":0},"lixb-v":{"merged":5,"total":5},"liyincode":{"merged":5,"total":5},"lsPrivateGit":{"merged":0,"total":0},"luAmy":{"merged":0,"total":5},"lulu546":{"merged":5,"total":5},"luyaoLee":{"merged":2.5,"total":5},"lzq2013asd":{"merged":0,"total":0},"memory713":{"merged":0,"total":0},"mercury-zy":{"merged":2.5,"total":9},"miawithcode":{"merged":0,"total":0},"monnaliya":{"merged":5,"total":5},"mosida":{"merged":5,"total":5},"mundane799699":{"merged":2.5,"total":5},"muuyao":{"merged":5,"total":5},"newTap":{"merged":4,"total":4},"newraina":{"merged":2.5,"total":2.5},"no5no6":{"merged":2.5,"total":2.5},"nolank128":{"merged":0,"total":0},"ourai":{"merged":29,"total":43},"peewee92":{"merged":0,"total":2.5},"pol117":{"merged":0,"total":0},"polariscx":{"merged":5,"total":5},"posuihushui":{"merged":9,"total":9},"princejia":{"merged":0,"total":0},"qiaopengjun5162":{"merged":19,"total":19},"qimalan":{"merged":0,"total":5},"qq1456680570":{"merged":2.5,"total":2.5},"ranxi2001":{"merged":0,"total":5},"reetyo":{"merged":0,"total":0},"renfengyi":{"merged":0,"total":0},"rzexin":{"merged":5,"total":5},"sajakx":{"merged":0,"total":0},"saltand":{"merged":2.5,"total":5},"saveole":{"merged":5,"total":5},"serencc":{"merged":29,"total":43},"shaun17":{"merged":0,"total":2.5},"sheldon-xc":{"merged":29,"total":43},"shuhaoLIN":{"merged":5,"total":5},"smallbonelu":{"merged":5,"total":5},"soldcoin":{"merged":2.5,"total":6.5},"strong-to":{"merged":0,"total":0},"sunnydreamer":{"merged":9,"total":9},"sunshanpeng":{"merged":5,"total":5},"terry-hjj":{"merged":5,"total":5},"threshermagnus484159":{"merged":25,"total":38},"tiantianwork":{"merged":2.5,"total":2.5},"toleleYJL":{"merged":2.5,"total":5},"tristonchai":{"merged":2.5,"total":5},"upupnoah":{"merged":0,"total":0},"veithly":{"merged":29,"total":43},"vv1133":{"merged":29,"total":43},"w626w":{"merged":2.5,"total":2.5},"wanna-wl":{"merged":0,"total":2.5},"warku123":{"merged":19,"total":19},"wdonsong":{"merged":6.5,"total":9},"wiirhan":{"merged":5,"total":5},"windyund":{"merged":5,"total":5},"wjq990112":{"merged":0,"total":0},"wmjchf":{"merged":5,"total":5},"wormchenli":{"merged":5,"total":9},"wureny":{"merged":0,"total":2.5},"www759":{"merged":9,"total":18},"xhwoaini":{"merged":19,"total":19},"xiangergou":{"merged":2.5,"total":2.5},"xiangnuans":{"merged":29,"total":43},"xiaodingmao":{"merged":2.5,"total":5},"xiaowu55":{"merged":2.5,"total":5},"xqcheese":{"merged":5,"total":5},"ymiool":{"merged":29,"total":43},"ymjrcc":{"merged":29,"total":38},"yodhcn":{"merged":2.5,"total":2.5},"yougongjiang":{"merged":5,"total":5},"yywhyting":{"merged":0,"total":0},"zcy1024":{"merged":5,"total":5},"zer0fire":{"merged":29,"total":29},"zhangloveyan":{"merged":29,"total":43},"zhangmo8":{"merged":5,"total":5},"zhangolve":{"merged":29,"total":43},"zhengbangbo":{"merged":0,"total":0},"zhengjunxiang":{"merged":5,"total":13},"zhong-shanfu":{"merged":0,"total":0},"zhouBoom":{"merged":19,"total":19},"zhtkeepup":{"merged":5,"total":9},"zhuoqinyue":{"merged":2.5,"total":2.5},"ziicu2019":{"merged":2.5,"total":5},"zipingw":{"merged":0,"total":0},"zpjayyy":{"merged":9,"total":18},"zzworker":{"merged":9,"total":9}}
14 changes: 3 additions & 11 deletions scripts/count.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const timezone = require('dayjs/plugin/timezone');
const rootPath = resolvePath(__dirname, '../');
const pmcDataPath = joinPath(rootPath, '.obpmc', 'data');
const { people: studentMap, sequence: studentSeq } = readData(joinPath(pmcDataPath, 'students.json'));
const rewardMap = readData(joinPath(pmcDataPath, 'rewards.json'));
const { task: { rewards: taskRewards, rewardDeadline } } = readData(joinPath(pmcDataPath, 'metadata.json'));

dayjs.extend(utc);
Expand Down Expand Up @@ -58,20 +59,11 @@ function generateSummaryTable() {
const rows = resolveSortedSequence().map((id, idx) => {
const student = studentMap[id];
const cols = [`[\`${id}\`](${id})`, resolveCompletedEmoji(student.registered)].concat(student.tasks.map(({ completed, rewardable }) => resolveCompletedEmoji(completed, !rewardable)));
const rewards = student.registered ? student.tasks.reduce((total, task, idx) => {
const reward = taskRewards[idx];

if (task.rewardable && reward > 0) {
return plus(total, reward);
}

return total;
}, 0) : 0;

return `| ${idx + 1} | ${cols.join(' | ')} | ${rewards} |`;
return `| ${idx + 1} | ${cols.join(' | ')} | ${rewardMap[id].total} |`;
});

return `| 序号 | 学员 | 报名 | task1 | task2 | task3 | task4 | task5 | task6 | task7 | task8 | task9 | 奖励(U) |
return `| 序号 | 学员 | 报名 | T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9 | 奖励(U) |
| ---: | --- | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | ---: |
${rows.join('\n')}`;
}
Expand Down

0 comments on commit 4db33f6

Please sign in to comment.