feat: Bark 增加开始运行与获得学分提醒
收尾通知去掉重复的积分台账与完成门数;学习统计在无 TTY 时照常累计,保证 Docker 里也能推送学分提醒。 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
18c5e5a3be
commit
6b508a0b1a
15 files changed
+188
-51
No files matched your search
@@ -142,7 +142,29 @@ console.log('防重复计数');
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// 5. 学分文本:浮点累加不出现 3.7499999
|
||||
// 5. 学分事件:每次真正计入学分时产出 { course, credit },供 Bark 通知使用
|
||||
// ---------------------------------------------------------------------------
|
||||
console.log('学分事件');
|
||||
{
|
||||
const s = createStudyTracker({ now: clock().now });
|
||||
let st = s.update({ course: 'A', credit: 2.5, completed: 0, video: video(false) });
|
||||
eq(st.earned.length, 0, '只有学分、没完成时没有事件');
|
||||
|
||||
st = s.update({ course: 'A', credit: null, completed: 1, video: video(false) });
|
||||
eq(st.earned.length, 1, '课程完成时产出一条事件');
|
||||
eq(st.earned[0].course, 'A', '事件带课程名');
|
||||
eq(st.earned[0].credit, 2.5, '事件带本门学分数');
|
||||
eq(st.creditEarned, 2.5, '返回值里的累计学分同步更新');
|
||||
|
||||
st = s.update({ course: 'A', credit: null, completed: 1, video: video(false) });
|
||||
eq(st.earned.length, 0, '同一门重复上报不重复产生事件');
|
||||
|
||||
st = s.update({ course: 'C', credit: null, completed: 2, video: video(false) });
|
||||
eq(st.earned.length, 0, '没读到学分的课完成时不产生事件');
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// 6. 学分文本:浮点累加不出现 3.7499999
|
||||
// ---------------------------------------------------------------------------
|
||||
console.log('学分文本');
|
||||
{
|
||||
@@ -155,7 +177,7 @@ console.log('学分文本');
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// 6. 摘要 / 空状态
|
||||
// 7. 摘要 / 空状态
|
||||
// ---------------------------------------------------------------------------
|
||||
console.log('摘要与空状态');
|
||||
{
|
||||
@@ -182,7 +204,7 @@ console.log('摘要与空状态');
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// 7. reset:重开一轮(supervisor 重启的会话之间)要能清零
|
||||
// 8. reset:重开一轮(supervisor 重启的会话之间)要能清零
|
||||
// ---------------------------------------------------------------------------
|
||||
console.log('重置');
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user