同步招生就业服务队新版值班表
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
- **课表收取**:单周、双周分别上传课表图片,每人每类只保留一份,可修改替换。本地自动识别为值班时段表,由本人核对后导出 JSON / CSV;课表仅本人及指定收取负责人可查看,其他成员只见提交状态。详见 [TIMETABLES.md](TIMETABLES.md)。
|
- **课表收取**:单周、双周分别上传课表图片,每人每类只保留一份,可修改替换。本地自动识别为值班时段表,由本人核对后导出 JSON / CSV;课表仅本人及指定收取负责人可查看,其他成员只见提交状态。详见 [TIMETABLES.md](TIMETABLES.md)。
|
||||||
- **赋能中心一楼**:全员可见的纯记录,不接受参加、不计入参加统计;照片可多选直传并显示逐张进度,ZIP为可选文档附件。所有登录成员可补充照片和附件,保留已有材料及上传人信息。支持 AI 读取接口及 JSON / CSV 导出;另有每日物品清点,以及免审批、登记后立即生效的物品借出和归还;登录页还提供无需账号、填写姓名/手机号/学院/活动及物品清单的免登录借出登记。详细规则见 [CENTER.md](CENTER.md)。
|
- **赋能中心一楼**:全员可见的纯记录,不接受参加、不计入参加统计;照片可多选直传并显示逐张进度,ZIP为可选文档附件。所有登录成员可补充照片和附件,保留已有材料及上传人信息。支持 AI 读取接口及 JSON / CSV 导出;另有每日物品清点,以及免审批、登记后立即生效的物品借出和归还;登录页还提供无需账号、填写姓名/手机号/学院/活动及物品清单的免登录借出登记。详细规则见 [CENTER.md](CENTER.md)。
|
||||||
- **邮箱换绑**:登录后在账号设置中验证新邮箱即可更换绑定地址;新邮箱须未被其他账号占用。账号及活动记录保留,当前会话保留、其他设备退出,原邮箱未使用验证码失效;后续使用新邮箱登录并接收提醒。
|
- **邮箱换绑**:登录后在账号设置中验证新邮箱即可更换绑定地址;新邮箱须未被其他账号占用。账号及活动记录保留,当前会话保留、其他设备退出,原邮箱未使用验证码失效;后续使用新邮箱登录并接收提醒。
|
||||||
- **值班提醒**:读取单双周值班 JSON,按 2026-11-06 单周周五为基准循环,北京时间前一天 18:00 汇总提醒,并在每个值班时段开始前一小时再次发送邮件;邮箱匹配、预览和部署说明见 [duty/README.md](duty/README.md)。
|
- **招生就业服务队值班提醒**:独立于赋能中心一楼,读取招生就业服务队单双周值班 JSON,按 2026-11-06 单周周五为基准循环,北京时间前一天 18:00 汇总提醒,并在每个值班时段开始前一小时再次发送邮件;邮箱匹配、预览和部署说明见 [duty/README.md](duty/README.md)。
|
||||||
- **账号体系**:注册时设置密码,通过邮箱+密码登录;也可选邮箱验证码登录,忘记密码后可凭邮箱验证码重设。注册需填写姓名、所属部门、邮箱和手机号,Bearer 会话默认 30 天有效,可改个人资料
|
- **账号体系**:注册时设置密码,通过邮箱+密码登录;也可选邮箱验证码登录,忘记密码后可凭邮箱验证码重设。注册需填写姓名、所属部门、邮箱和手机号,Bearer 会话默认 30 天有效,可改个人资料
|
||||||
- **活动记录**:标题 / 分类(8 类)/ 时间 / 地点 / 描述 / 可选人数上限 / 公开或私密;编辑时可清空人数上限,发起人自动写入一条参加记录
|
- **活动记录**:标题 / 分类(8 类)/ 时间 / 地点 / 描述 / 可选人数上限 / 公开或私密;编辑时可清空人数上限,发起人自动写入一条参加记录
|
||||||
- **参加方式**:在活动墙自行报名公开活动;或由**发起人按账号名代登记**(适合"帮大家统一记录"的场景)
|
- **参加方式**:在活动墙自行报名公开活动;或由**发起人按账号名代登记**(适合"帮大家统一记录"的场景)
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
参考:[RapidOCR 使用说明](https://rapidai.github.io/RapidOCRDocs/main/en/install_usage/rapidocr/usage/)。
|
参考:[RapidOCR 使用说明](https://rapidai.github.io/RapidOCRDocs/main/en/install_usage/rapidocr/usage/)。
|
||||||
|
|
||||||
目前按已有值班安排整理周一至周五的四个时段:
|
目前按招生就业服务队值班安排整理周一至周五的四个时段:
|
||||||
|
|
||||||
| 时段ID | 节次 | 时间 |
|
| 时段ID | 节次 | 时间 |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
|
|||||||
Vendored
+2
-2
@@ -148,7 +148,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<section id="duty-banner" class="duty-banner" aria-label="值班提示">
|
<section id="duty-banner" class="duty-banner" aria-label="值班提示">
|
||||||
<div class="duty-info" role="status"><span class="duty-label" id="duty-label">值班安排</span><strong id="duty-names">正在加载…</strong><span class="duty-time" id="duty-time"></span></div>
|
<div class="duty-info" role="status"><span class="duty-label" id="duty-label">招生就业服务队值班</span><strong id="duty-names">正在加载…</strong><span class="duty-time" id="duty-time"></span></div>
|
||||||
<div class="duty-clock hidden" id="duty-clock"><span id="duty-countdown-label">本轮剩余</span><strong id="duty-countdown" role="timer" aria-live="off"></strong></div>
|
<div class="duty-clock hidden" id="duty-clock"><span id="duty-countdown-label">本轮剩余</span><strong id="duty-countdown" role="timer" aria-live="off"></strong></div>
|
||||||
<div id="duty-reminders" class="duty-reminders"></div>
|
<div id="duty-reminders" class="duty-reminders"></div>
|
||||||
</section>
|
</section>
|
||||||
@@ -337,7 +337,7 @@
|
|||||||
|
|
||||||
<div id="toast" class="toast hidden" role="status" aria-live="polite"></div>
|
<div id="toast" class="toast hidden" role="status" aria-live="polite"></div>
|
||||||
|
|
||||||
<script src="/js/app.js?v=38"></script>
|
<script src="/js/app.js?v=39"></script>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Vendored
+6
-5
@@ -634,6 +634,7 @@
|
|||||||
function renderDutyStatus() {
|
function renderDutyStatus() {
|
||||||
if (!dutySnapshot) return;
|
if (!dutySnapshot) return;
|
||||||
const now = dutySnapshot.server_now + performance.now() - dutySyncedAt;
|
const now = dutySnapshot.server_now + performance.now() - dutySyncedAt;
|
||||||
|
const scheduleLabel = dutySnapshot.title || "值班安排";
|
||||||
const current = dutySnapshot.current;
|
const current = dutySnapshot.current;
|
||||||
const next = dutySnapshot.next;
|
const next = dutySnapshot.next;
|
||||||
const active = current && now < current.end_at;
|
const active = current && now < current.end_at;
|
||||||
@@ -652,11 +653,11 @@
|
|||||||
$("#duty-banner").classList.toggle("on-duty", !!active);
|
$("#duty-banner").classList.toggle("on-duty", !!active);
|
||||||
$("#duty-clock").classList.toggle("hidden", !shift || !!expired);
|
$("#duty-clock").classList.toggle("hidden", !shift || !!expired);
|
||||||
if (expired) {
|
if (expired) {
|
||||||
$("#duty-label").textContent = "值班安排";
|
$("#duty-label").textContent = `${scheduleLabel} · 更新中`;
|
||||||
$("#duty-names").textContent = "正在更新…";
|
$("#duty-names").textContent = "正在更新…";
|
||||||
$("#duty-time").textContent = "";
|
$("#duty-time").textContent = "";
|
||||||
} else if (shift) {
|
} else if (shift) {
|
||||||
$("#duty-label").textContent = active ? "当前值班" : "下一轮值班";
|
$("#duty-label").textContent = `${scheduleLabel} · ${active ? "当前" : "下一轮"}`;
|
||||||
$("#duty-names").textContent = shift.names.join("、");
|
$("#duty-names").textContent = shift.names.join("、");
|
||||||
$("#duty-time").textContent = `${active ? shift.slot : dutyDate(shift.start_at, true)} · ${active ? dutyDate(shift.start_at) + "–" + dutyDate(shift.end_at) : "开始"}(北京时间)`;
|
$("#duty-time").textContent = `${active ? shift.slot : dutyDate(shift.start_at, true)} · ${active ? dutyDate(shift.start_at) + "–" + dutyDate(shift.end_at) : "开始"}(北京时间)`;
|
||||||
$("#duty-countdown-label").textContent = active ? "本轮剩余" : "距离开始";
|
$("#duty-countdown-label").textContent = active ? "本轮剩余" : "距离开始";
|
||||||
@@ -665,8 +666,8 @@
|
|||||||
const clock = [Math.floor(seconds / 3600) % 24, Math.floor(seconds / 60) % 60, seconds % 60].map((n) => String(n).padStart(2, "0")).join(":");
|
const clock = [Math.floor(seconds / 3600) % 24, Math.floor(seconds / 60) % 60, seconds % 60].map((n) => String(n).padStart(2, "0")).join(":");
|
||||||
$("#duty-countdown").textContent = (days ? `${days}天 ` : "") + clock;
|
$("#duty-countdown").textContent = (days ? `${days}天 ` : "") + clock;
|
||||||
} else {
|
} else {
|
||||||
$("#duty-label").textContent = "值班安排";
|
$("#duty-label").textContent = scheduleLabel;
|
||||||
$("#duty-names").textContent = dutySnapshot.enabled ? "暂无值班安排" : "值班安排已暂停";
|
$("#duty-names").textContent = dutySnapshot.enabled ? "暂无排班" : "已暂停";
|
||||||
$("#duty-time").textContent = "";
|
$("#duty-time").textContent = "";
|
||||||
}
|
}
|
||||||
if ((expired || performance.now() - dutySyncedAt >= 60000) && performance.now() >= dutyRetryAt) loadDutyStatus();
|
if ((expired || performance.now() - dutySyncedAt >= 60000) && performance.now() >= dutyRetryAt) loadDutyStatus();
|
||||||
@@ -686,7 +687,7 @@
|
|||||||
dutyRemindersKey = "";
|
dutyRemindersKey = "";
|
||||||
$("#duty-reminders").innerHTML = "";
|
$("#duty-reminders").innerHTML = "";
|
||||||
$("#duty-banner").classList.remove("on-duty");
|
$("#duty-banner").classList.remove("on-duty");
|
||||||
$("#duty-label").textContent = "值班安排";
|
$("#duty-label").textContent = "招生就业服务队值班";
|
||||||
$("#duty-names").textContent = "暂时无法加载";
|
$("#duty-names").textContent = "暂时无法加载";
|
||||||
$("#duty-time").textContent = "稍后自动重试";
|
$("#duty-time").textContent = "稍后自动重试";
|
||||||
$("#duty-clock").classList.add("hidden");
|
$("#duty-clock").classList.add("hidden");
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
# 值班提醒
|
# 值班提醒
|
||||||
|
|
||||||
`schedule.json` 是程序使用的排班表,`roster.csv` 是同一份排班的简表:每行一位同学,列为 week(odd 单周 / even 双周)、weekday(1 周一至 5 周五)、slot(节次)、name(姓名)、start_time(开始时间)、reminder_time(当天提醒时间)。CSV 不包含签到空行或合并单元格。
|
`schedule.json` 是程序使用的招生就业服务队排班表,`roster.csv` 是同一份排班的简表:每行一位同学,列为 week(odd 单周 / even 双周)、weekday(1 周一至 5 周五)、slot(节次)、name(姓名)、start_time(开始时间)、reminder_time(当天提醒时间)。CSV 不包含签到空行或合并单元格。该排班与赋能中心一楼的每日物品清点、活动记录和物品借出相互独立。
|
||||||
|
|
||||||
数据取自「单周值班表模板.xlsx」「双周值班表.xlsx」:40 个时段,58 位同学。原始文件保持不变。修改排班时以 `schedule.json` 为准;CSV 用于查看和另行导入,不会被服务自动读取。
|
数据取自 2026-11-19 更新的「单周值班表.xlsx」「双周值班表 (1).xlsx」:40 个时段,48 人次。两份原表标题均为“招生就业服务队值班签到表”。原始文件保持不变。修改排班时以 `schedule.json` 为准;CSV 用于查看和另行导入,不会被服务自动读取。
|
||||||
|
|
||||||
## 已确认的规则
|
## 已确认的规则
|
||||||
|
|
||||||
|
|||||||
@@ -1,23 +1,50 @@
|
|||||||
{
|
{
|
||||||
"仲雅玉": "",
|
"程振宇": "",
|
||||||
"刘一诺": "",
|
"田震": "",
|
||||||
"刘文逸": "",
|
"梁元曦": "",
|
||||||
"刘泽敏": "",
|
"常亚芯": "",
|
||||||
"刘鑫杰": "",
|
"米鑫源": "",
|
||||||
|
"孙鹏": "",
|
||||||
"孙梦婕": "",
|
"孙梦婕": "",
|
||||||
"张一帆": "",
|
"刘鑫杰": "",
|
||||||
"张胥柯": "",
|
"费小榕": "",
|
||||||
"彭春晓": "",
|
"闫晓彤": "",
|
||||||
"晁祥茹": "",
|
"韩惠敏": "",
|
||||||
"李心睿": "",
|
"李悦嘉": "",
|
||||||
"武鑫": "",
|
"武鑫": "",
|
||||||
"王乐帆": "",
|
"王乐帆": "",
|
||||||
"田震": "",
|
"彭春晓": "",
|
||||||
"薛含悦": "",
|
"林子歆": "",
|
||||||
"费小榕": "",
|
"李心睿": "",
|
||||||
"贾正国": "",
|
"晁祥茹": "",
|
||||||
"郭珈伊": "",
|
"仲雅玉": "",
|
||||||
"闫晓彤": "",
|
|
||||||
"马涵雪": "",
|
"马涵雪": "",
|
||||||
"鲍嘉泽": ""
|
"郭珈伊": "",
|
||||||
|
"张雨彤": "",
|
||||||
|
"张惠文": "",
|
||||||
|
"李俊颖": "",
|
||||||
|
"孟祥凤": "",
|
||||||
|
"田馨宇": "",
|
||||||
|
"马驰骋": "",
|
||||||
|
"刘旭洋": "",
|
||||||
|
"程煦阳": "",
|
||||||
|
"张一帆": "",
|
||||||
|
"刘佩宁": "",
|
||||||
|
"牛雅晴": "",
|
||||||
|
"任兴海": "",
|
||||||
|
"刘泽敏": "",
|
||||||
|
"鲍嘉泽": "",
|
||||||
|
"刘一诺": "",
|
||||||
|
"从铭洁": "",
|
||||||
|
"贾俊娴": "",
|
||||||
|
"米文睿朴": "",
|
||||||
|
"杜馨甜": "",
|
||||||
|
"薛含悦": "",
|
||||||
|
"马悦悦": "",
|
||||||
|
"刘颖": "",
|
||||||
|
"任静": "",
|
||||||
|
"卓著": "",
|
||||||
|
"刘文逸": "",
|
||||||
|
"任梦琪": "",
|
||||||
|
"张胥柯": ""
|
||||||
}
|
}
|
||||||
|
|||||||
+41
-51
@@ -1,59 +1,49 @@
|
|||||||
name,status
|
name,status
|
||||||
从铭洁,已匹配本地账号
|
|
||||||
仲雅玉,待补邮箱或注册账号
|
|
||||||
任兴海,已匹配本地账号
|
|
||||||
任梦琪,已匹配本地账号
|
|
||||||
任静,已匹配本地账号
|
|
||||||
刘一诺,待补邮箱或注册账号
|
|
||||||
刘佩宁,已匹配本地账号
|
|
||||||
刘文逸,待补邮箱或注册账号
|
|
||||||
刘旭洋,已匹配本地账号
|
|
||||||
刘泽敏,待补邮箱或注册账号
|
|
||||||
刘洋,已匹配本地账号
|
|
||||||
刘鑫杰,待补邮箱或注册账号
|
|
||||||
刘颖,已匹配本地账号
|
|
||||||
华秋豪,已匹配本地账号
|
|
||||||
卓著,已匹配本地账号
|
|
||||||
周鸿光,已匹配本地账号
|
|
||||||
姜鑫钰,已匹配本地账号
|
|
||||||
孙梦婕,待补邮箱或注册账号
|
|
||||||
孙畅,已匹配本地账号
|
|
||||||
孙鹏,已匹配本地账号
|
|
||||||
孟祥凤,已匹配本地账号
|
|
||||||
常亚芯,已匹配本地账号
|
|
||||||
张一帆,待补邮箱或注册账号
|
|
||||||
张惠文,已匹配本地账号
|
|
||||||
张胥柯,待补邮箱或注册账号
|
|
||||||
张雨彤,已匹配本地账号
|
|
||||||
彭春晓,待补邮箱或注册账号
|
|
||||||
晁祥茹,待补邮箱或注册账号
|
|
||||||
李俊颖,已匹配本地账号
|
|
||||||
李心睿,待补邮箱或注册账号
|
|
||||||
李悦嘉,已匹配本地账号
|
|
||||||
杜欣桐,已匹配本地账号
|
|
||||||
杜馨甜,已匹配本地账号
|
|
||||||
林子歆,已匹配本地账号
|
|
||||||
梁元曦,已匹配本地账号
|
|
||||||
武鑫,待补邮箱或注册账号
|
|
||||||
牛雅晴,已匹配本地账号
|
|
||||||
王乐帆,待补邮箱或注册账号
|
|
||||||
田宇恒,已匹配本地账号
|
|
||||||
田震,待补邮箱或注册账号
|
|
||||||
田馨宇,已匹配本地账号
|
|
||||||
程振宇,已匹配本地账号
|
程振宇,已匹配本地账号
|
||||||
程煦阳,已匹配本地账号
|
田震,待补邮箱或注册账号
|
||||||
米文睿朴,已匹配本地账号
|
梁元曦,已匹配本地账号
|
||||||
|
常亚芯,已匹配本地账号
|
||||||
米鑫源,已匹配本地账号
|
米鑫源,已匹配本地账号
|
||||||
薛含悦,待补邮箱或注册账号
|
孙鹏,已匹配本地账号
|
||||||
薛紫彦,已匹配本地账号
|
孙梦婕,待补邮箱或注册账号
|
||||||
|
刘鑫杰,待补邮箱或注册账号
|
||||||
费小榕,待补邮箱或注册账号
|
费小榕,待补邮箱或注册账号
|
||||||
贾俊娴,已匹配本地账号
|
|
||||||
贾正国,待补邮箱或注册账号
|
|
||||||
郝浴含,已匹配本地账号
|
|
||||||
郭珈伊,待补邮箱或注册账号
|
|
||||||
闫晓彤,待补邮箱或注册账号
|
闫晓彤,待补邮箱或注册账号
|
||||||
韩惠敏,已匹配本地账号
|
韩惠敏,已匹配本地账号
|
||||||
马悦悦,已匹配本地账号
|
李悦嘉,已匹配本地账号
|
||||||
|
武鑫,待补邮箱或注册账号
|
||||||
|
王乐帆,待补邮箱或注册账号
|
||||||
|
彭春晓,待补邮箱或注册账号
|
||||||
|
林子歆,已匹配本地账号
|
||||||
|
李心睿,待补邮箱或注册账号
|
||||||
|
晁祥茹,待补邮箱或注册账号
|
||||||
|
仲雅玉,待补邮箱或注册账号
|
||||||
马涵雪,待补邮箱或注册账号
|
马涵雪,待补邮箱或注册账号
|
||||||
|
郭珈伊,待补邮箱或注册账号
|
||||||
|
张雨彤,已匹配本地账号
|
||||||
|
张惠文,已匹配本地账号
|
||||||
|
李俊颖,已匹配本地账号
|
||||||
|
孟祥凤,已匹配本地账号
|
||||||
|
田馨宇,已匹配本地账号
|
||||||
马驰骋,已匹配本地账号
|
马驰骋,已匹配本地账号
|
||||||
|
刘旭洋,已匹配本地账号
|
||||||
|
程煦阳,已匹配本地账号
|
||||||
|
张一帆,待补邮箱或注册账号
|
||||||
|
刘佩宁,已匹配本地账号
|
||||||
|
牛雅晴,已匹配本地账号
|
||||||
|
任兴海,已匹配本地账号
|
||||||
|
刘泽敏,待补邮箱或注册账号
|
||||||
鲍嘉泽,待补邮箱或注册账号
|
鲍嘉泽,待补邮箱或注册账号
|
||||||
|
刘一诺,待补邮箱或注册账号
|
||||||
|
从铭洁,已匹配本地账号
|
||||||
|
贾俊娴,已匹配本地账号
|
||||||
|
米文睿朴,已匹配本地账号
|
||||||
|
杜馨甜,已匹配本地账号
|
||||||
|
薛含悦,待补邮箱或注册账号
|
||||||
|
马悦悦,已匹配本地账号
|
||||||
|
刘颖,已匹配本地账号
|
||||||
|
任静,已匹配本地账号
|
||||||
|
卓著,已匹配本地账号
|
||||||
|
刘文逸,待补邮箱或注册账号
|
||||||
|
任梦琪,已匹配本地账号
|
||||||
|
张胥柯,待补邮箱或注册账号
|
||||||
|
|||||||
|
+14
-24
@@ -1,28 +1,24 @@
|
|||||||
week,weekday,slot,name,start_time,reminder_time
|
week,weekday,slot,name,start_time,reminder_time
|
||||||
odd,1,一二节,程振宇,08:30,07:30
|
odd,1,一二节,程振宇,08:30,07:30
|
||||||
odd,2,一二节,田震,08:30,07:30
|
odd,2,一二节,田震,08:30,07:30
|
||||||
odd,2,一二节,梁元曦,08:30,07:30
|
odd,2,一二节,梁元曦,08:30,07:30
|
||||||
odd,3,一二节,常亚芯,08:30,07:30
|
odd,3,一二节,常亚芯,08:30,07:30
|
||||||
odd,3,一二节,晁祥茹,08:30,07:30
|
|
||||||
odd,4,一二节,米鑫源,08:30,07:30
|
odd,4,一二节,米鑫源,08:30,07:30
|
||||||
odd,5,一二节,华秋豪,08:30,07:30
|
odd,5,一二节,孙鹏,08:30,07:30
|
||||||
odd,1,三四节,孙梦婕,10:25,09:25
|
odd,1,三四节,孙梦婕,10:25,09:25
|
||||||
odd,2,三四节,刘鑫杰,10:25,09:25
|
odd,2,三四节,刘鑫杰,10:25,09:25
|
||||||
odd,2,三四节,费小榕,10:25,09:25
|
odd,2,三四节,费小榕,10:25,09:25
|
||||||
odd,3,三四节,闫晓彤,10:25,09:25
|
odd,3,三四节,闫晓彤,10:25,09:25
|
||||||
odd,3,三四节,韩惠敏,10:25,09:25
|
odd,3,三四节,韩惠敏,10:25,09:25
|
||||||
odd,4,三四节,李悦嘉,10:25,09:25
|
odd,4,三四节,李悦嘉,10:25,09:25
|
||||||
odd,5,三四节,孙鹏,10:25,09:25
|
|
||||||
odd,5,三四节,武鑫,10:25,09:25
|
odd,5,三四节,武鑫,10:25,09:25
|
||||||
odd,1,五六节,王乐帆,14:00,13:00
|
odd,1,五六节,王乐帆,14:00,13:00
|
||||||
odd,2,五六节,姜鑫钰,14:00,13:00
|
|
||||||
odd,2,五六节,彭春晓,14:00,13:00
|
odd,2,五六节,彭春晓,14:00,13:00
|
||||||
odd,3,五六节,林子歆,14:00,13:00
|
odd,3,五六节,林子歆,14:00,13:00
|
||||||
odd,3,五六节,李心睿,14:00,13:00
|
odd,3,五六节,李心睿,14:00,13:00
|
||||||
odd,4,五六节,孙畅,14:00,13:00
|
odd,4,五六节,晁祥茹,14:00,13:00
|
||||||
odd,5,五六节,仲雅玉,14:00,13:00
|
odd,5,五六节,仲雅玉,14:00,13:00
|
||||||
odd,5,五六节,马涵雪,14:00,13:00
|
odd,5,五六节,马涵雪,14:00,13:00
|
||||||
odd,1,七八节,薛紫彦,16:00,15:00
|
|
||||||
odd,1,七八节,郭珈伊,16:00,15:00
|
odd,1,七八节,郭珈伊,16:00,15:00
|
||||||
odd,2,七八节,张雨彤,16:00,15:00
|
odd,2,七八节,张雨彤,16:00,15:00
|
||||||
odd,3,七八节,张惠文,16:00,15:00
|
odd,3,七八节,张惠文,16:00,15:00
|
||||||
@@ -31,29 +27,23 @@ odd,4,七八节,孟祥凤,16:00,15:00
|
|||||||
odd,4,七八节,田馨宇,16:00,15:00
|
odd,4,七八节,田馨宇,16:00,15:00
|
||||||
odd,5,七八节,马驰骋,16:00,15:00
|
odd,5,七八节,马驰骋,16:00,15:00
|
||||||
even,1,一二节,刘旭洋,08:30,07:30
|
even,1,一二节,刘旭洋,08:30,07:30
|
||||||
even,2,一二节,郝浴含,08:30,07:30
|
even,2,一二节,程煦阳,08:30,07:30
|
||||||
even,2,一二节,刘佩宁,08:30,07:30
|
even,3,一二节,张一帆,08:30,07:30
|
||||||
even,3,一二节,刘颖,08:30,07:30
|
even,4,一二节,刘佩宁,08:30,07:30
|
||||||
even,3,一二节,刘一诺,08:30,07:30
|
even,5,一二节,牛雅晴,08:30,07:30
|
||||||
even,4,一二节,周鸿光,08:30,07:30
|
|
||||||
even,5,一二节,贾正国,08:30,07:30
|
|
||||||
even,1,三四节,任兴海,10:25,09:25
|
even,1,三四节,任兴海,10:25,09:25
|
||||||
even,2,三四节,刘泽敏,10:25,09:25
|
even,2,三四节,刘泽敏,10:25,09:25
|
||||||
even,2,三四节,鲍嘉泽,10:25,09:25
|
even,2,三四节,鲍嘉泽,10:25,09:25
|
||||||
even,3,三四节,杜欣桐,10:25,09:25
|
even,3,三四节,刘一诺,10:25,09:25
|
||||||
even,4,三四节,从铭洁,10:25,09:25
|
even,4,三四节,从铭洁,10:25,09:25
|
||||||
even,5,三四节,贾俊娴,10:25,09:25
|
even,5,三四节,贾俊娴,10:25,09:25
|
||||||
even,1,五六节,张一帆,14:00,13:00
|
even,1,五六节,米文睿朴,14:00,13:00
|
||||||
even,2,五六节,田宇恒,14:00,13:00
|
even,2,五六节,杜馨甜,14:00,13:00
|
||||||
even,2,五六节,米文睿朴,14:00,13:00
|
even,3,五六节,薛含悦,14:00,13:00
|
||||||
even,3,五六节,刘文逸,14:00,13:00
|
|
||||||
even,3,五六节,刘洋,14:00,13:00
|
|
||||||
even,4,五六节,马悦悦,14:00,13:00
|
even,4,五六节,马悦悦,14:00,13:00
|
||||||
even,5,五六节,程煦阳,14:00,13:00
|
even,5,五六节,刘颖,14:00,13:00
|
||||||
even,1,七八节,任静,16:00,15:00
|
even,1,七八节,任静,16:00,15:00
|
||||||
even,1,七八节,杜馨甜,16:00,15:00
|
|
||||||
even,2,七八节,卓著,16:00,15:00
|
even,2,七八节,卓著,16:00,15:00
|
||||||
even,3,七八节,任梦琪,16:00,15:00
|
even,3,七八节,刘文逸,16:00,15:00
|
||||||
even,3,七八节,薛含悦,16:00,15:00
|
even,4,七八节,任梦琪,16:00,15:00
|
||||||
even,4,七八节,牛雅晴,16:00,15:00
|
|
||||||
even,5,七八节,张胥柯,16:00,15:00
|
even,5,七八节,张胥柯,16:00,15:00
|
||||||
|
|||||||
|
+17
-25
@@ -1,6 +1,8 @@
|
|||||||
{
|
{
|
||||||
"version": 1,
|
"version": 1,
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
|
"title": "招生就业服务队值班",
|
||||||
|
"organization": "招生就业服务队",
|
||||||
"anchor_date": "2026-11-06",
|
"anchor_date": "2026-11-06",
|
||||||
"anchor_week": "odd",
|
"anchor_week": "odd",
|
||||||
"reminder_days_before": 1,
|
"reminder_days_before": 1,
|
||||||
@@ -26,8 +28,7 @@
|
|||||||
"weekday": 3,
|
"weekday": 3,
|
||||||
"slot": "一二节",
|
"slot": "一二节",
|
||||||
"names": [
|
"names": [
|
||||||
"常亚芯",
|
"常亚芯"
|
||||||
"晁祥茹"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -41,7 +42,7 @@
|
|||||||
"weekday": 5,
|
"weekday": 5,
|
||||||
"slot": "一二节",
|
"slot": "一二节",
|
||||||
"names": [
|
"names": [
|
||||||
"华秋豪"
|
"孙鹏"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -78,7 +79,6 @@
|
|||||||
"weekday": 5,
|
"weekday": 5,
|
||||||
"slot": "三四节",
|
"slot": "三四节",
|
||||||
"names": [
|
"names": [
|
||||||
"孙鹏",
|
|
||||||
"武鑫"
|
"武鑫"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -93,7 +93,6 @@
|
|||||||
"weekday": 2,
|
"weekday": 2,
|
||||||
"slot": "五六节",
|
"slot": "五六节",
|
||||||
"names": [
|
"names": [
|
||||||
"姜鑫钰",
|
|
||||||
"彭春晓"
|
"彭春晓"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -109,7 +108,7 @@
|
|||||||
"weekday": 4,
|
"weekday": 4,
|
||||||
"slot": "五六节",
|
"slot": "五六节",
|
||||||
"names": [
|
"names": [
|
||||||
"孙畅"
|
"晁祥茹"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -124,7 +123,6 @@
|
|||||||
"weekday": 1,
|
"weekday": 1,
|
||||||
"slot": "七八节",
|
"slot": "七八节",
|
||||||
"names": [
|
"names": [
|
||||||
"薛紫彦",
|
|
||||||
"郭珈伊"
|
"郭珈伊"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -171,30 +169,28 @@
|
|||||||
"weekday": 2,
|
"weekday": 2,
|
||||||
"slot": "一二节",
|
"slot": "一二节",
|
||||||
"names": [
|
"names": [
|
||||||
"郝浴含",
|
"程煦阳"
|
||||||
"刘佩宁"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"weekday": 3,
|
"weekday": 3,
|
||||||
"slot": "一二节",
|
"slot": "一二节",
|
||||||
"names": [
|
"names": [
|
||||||
"刘颖",
|
"张一帆"
|
||||||
"刘一诺"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"weekday": 4,
|
"weekday": 4,
|
||||||
"slot": "一二节",
|
"slot": "一二节",
|
||||||
"names": [
|
"names": [
|
||||||
"周鸿光"
|
"刘佩宁"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"weekday": 5,
|
"weekday": 5,
|
||||||
"slot": "一二节",
|
"slot": "一二节",
|
||||||
"names": [
|
"names": [
|
||||||
"贾正国"
|
"牛雅晴"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -216,7 +212,7 @@
|
|||||||
"weekday": 3,
|
"weekday": 3,
|
||||||
"slot": "三四节",
|
"slot": "三四节",
|
||||||
"names": [
|
"names": [
|
||||||
"杜欣桐"
|
"刘一诺"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -237,23 +233,21 @@
|
|||||||
"weekday": 1,
|
"weekday": 1,
|
||||||
"slot": "五六节",
|
"slot": "五六节",
|
||||||
"names": [
|
"names": [
|
||||||
"张一帆"
|
"米文睿朴"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"weekday": 2,
|
"weekday": 2,
|
||||||
"slot": "五六节",
|
"slot": "五六节",
|
||||||
"names": [
|
"names": [
|
||||||
"田宇恒",
|
"杜馨甜"
|
||||||
"米文睿朴"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"weekday": 3,
|
"weekday": 3,
|
||||||
"slot": "五六节",
|
"slot": "五六节",
|
||||||
"names": [
|
"names": [
|
||||||
"刘文逸",
|
"薛含悦"
|
||||||
"刘洋"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -267,15 +261,14 @@
|
|||||||
"weekday": 5,
|
"weekday": 5,
|
||||||
"slot": "五六节",
|
"slot": "五六节",
|
||||||
"names": [
|
"names": [
|
||||||
"程煦阳"
|
"刘颖"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"weekday": 1,
|
"weekday": 1,
|
||||||
"slot": "七八节",
|
"slot": "七八节",
|
||||||
"names": [
|
"names": [
|
||||||
"任静",
|
"任静"
|
||||||
"杜馨甜"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -289,15 +282,14 @@
|
|||||||
"weekday": 3,
|
"weekday": 3,
|
||||||
"slot": "七八节",
|
"slot": "七八节",
|
||||||
"names": [
|
"names": [
|
||||||
"任梦琪",
|
"刘文逸"
|
||||||
"薛含悦"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"weekday": 4,
|
"weekday": 4,
|
||||||
"slot": "七八节",
|
"slot": "七八节",
|
||||||
"names": [
|
"names": [
|
||||||
"牛雅晴"
|
"任梦琪"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
+15
-3
@@ -21,6 +21,9 @@ def load_schedule(path):
|
|||||||
data = json.loads(Path(path).read_text(encoding="utf-8-sig"))
|
data = json.loads(Path(path).read_text(encoding="utf-8-sig"))
|
||||||
if data.get("version") != 1 or type(data.get("enabled")) is not bool:
|
if data.get("version") != 1 or type(data.get("enabled")) is not bool:
|
||||||
raise ValueError("值班表版本或开关无效")
|
raise ValueError("值班表版本或开关无效")
|
||||||
|
for key in ("title", "organization"):
|
||||||
|
if key in data and (not isinstance(data[key], str) or not data[key].strip()):
|
||||||
|
raise ValueError(f"{key} 不能为空")
|
||||||
date.fromisoformat(data["anchor_date"])
|
date.fromisoformat(data["anchor_date"])
|
||||||
if data["anchor_week"] not in ("odd", "even"):
|
if data["anchor_week"] not in ("odd", "even"):
|
||||||
raise ValueError("anchor_week 必须为 odd 或 even")
|
raise ValueError("anchor_week 必须为 odd 或 even")
|
||||||
@@ -94,7 +97,14 @@ def resolve_recipients(assignments, accounts, overrides=None):
|
|||||||
def duty_status(schedule, now):
|
def duty_status(schedule, now):
|
||||||
"""活动墙只返回排班姓名和时间,不暴露邮箱等联系方式。"""
|
"""活动墙只返回排班姓名和时间,不暴露邮箱等联系方式。"""
|
||||||
now = now.astimezone(BEIJING)
|
now = now.astimezone(BEIJING)
|
||||||
result = {"server_now": int(now.timestamp() * 1000), "enabled": schedule["enabled"], "current": None, "next": None}
|
result = {
|
||||||
|
"server_now": int(now.timestamp() * 1000),
|
||||||
|
"enabled": schedule["enabled"],
|
||||||
|
"title": schedule.get("title", "值班安排"),
|
||||||
|
"organization": schedule.get("organization", ""),
|
||||||
|
"current": None,
|
||||||
|
"next": None,
|
||||||
|
}
|
||||||
if not schedule["enabled"]:
|
if not schedule["enabled"]:
|
||||||
return result
|
return result
|
||||||
anchor = date.fromisoformat(schedule["anchor_date"])
|
anchor = date.fromisoformat(schedule["anchor_date"])
|
||||||
@@ -183,9 +193,11 @@ async def send_due(schedule, now, accounts, send_email, state_path, overrides=No
|
|||||||
clocks = schedule.get("slot_times", {})
|
clocks = schedule.get("slot_times", {})
|
||||||
slots = {slot for items in names.values() for slot in items}
|
slots = {slot for items in names.values() for slot in items}
|
||||||
ends = [datetime.combine(target, datetime.strptime(clocks[slot], "%H:%M").time(), BEIJING) + timedelta(minutes=schedule.get("duration_minutes", 105)) for slot in slots]
|
ends = [datetime.combine(target, datetime.strptime(clocks[slot], "%H:%M").time(), BEIJING) + timedelta(minutes=schedule.get("duration_minutes", 105)) for slot in slots]
|
||||||
body = f"日期:{target.isoformat()}(周{'一二三四五六日'[target.weekday()]},{'单' if week == 'odd' else '双'}周)\n" + "、".join(f"{slot} {clocks[slot]} 开始" for slot in sorted(slots)) + "\n以上时间均为北京时间。请准时值班。"
|
organization = schedule.get("organization", "招生就业服务队")
|
||||||
|
body = f"机构:{organization}\n日期:{target.isoformat()}(周{'一二三四五六日'[target.weekday()]},{'单' if week == 'odd' else '双'}周)\n" + "、".join(f"{slot} {clocks[slot]} 开始" for slot in sorted(slots)) + "\n以上时间均为北京时间。请准时值班。"
|
||||||
|
subject = f"{schedule.get('title', organization + '值班')}|{label}|{target.isoformat()}"
|
||||||
try:
|
try:
|
||||||
sent = await send_notice(state_path, target.isoformat(), names, email, max(ends).timestamp(), send_email, f"{label}|{target.isoformat()}", body, base_url, now.timestamp())
|
sent = await send_notice(state_path, target.isoformat(), names, email, max(ends).timestamp(), send_email, subject, body, base_url, now.timestamp())
|
||||||
except Exception:
|
except Exception:
|
||||||
result["failed"] += 1
|
result["failed"] += 1
|
||||||
await asyncio.to_thread(finish, state_path, key, email, "failed")
|
await asyncio.to_thread(finish, state_path, key, email, "failed")
|
||||||
|
|||||||
+2
-1
@@ -1542,7 +1542,8 @@ async def remind_duty(payload: DutyRemindIn, viewer: dict = Depends(current_user
|
|||||||
email = next(iter(recipients))
|
email = next(iter(recipients))
|
||||||
start = datetime.fromtimestamp(shift["start_at"] / 1000, BEIJING)
|
start = datetime.fromtimestamp(shift["start_at"] / 1000, BEIJING)
|
||||||
try:
|
try:
|
||||||
sent = await duty_receipts.send_notice(_duty_state(), start.date().isoformat(), {payload.name: [shift["slot"]]}, email, shift["end_at"] / 1000, _send_email, "值班提醒", f"日期:{start:%Y-%m-%d},{start:%H:%M} 开始(北京时间)", _site_base_url())
|
duty_title = data.get("title", "值班提醒")
|
||||||
|
sent = await duty_receipts.send_notice(_duty_state(), start.date().isoformat(), {payload.name: [shift["slot"]]}, email, shift["end_at"] / 1000, _send_email, f"{duty_title}|邮件提醒", f"机构:{data.get('organization', '招生就业服务队')}\n日期:{start:%Y-%m-%d},{start:%H:%M} 开始(北京时间)", _site_base_url())
|
||||||
except HTTPException:
|
except HTTPException:
|
||||||
raise
|
raise
|
||||||
if not sent:
|
if not sent:
|
||||||
|
|||||||
+2
-1
@@ -239,7 +239,8 @@ class WorkLogApiTests(ApiTestCase):
|
|||||||
clock.now.return_value = datetime(2026, 11, 6, 8, 30, tzinfo=BEIJING)
|
clock.now.return_value = datetime(2026, 11, 6, 8, 30, tzinfo=BEIJING)
|
||||||
r = await c.get("/api/duty/current", headers=auth(u["token"]))
|
r = await c.get("/api/duty/current", headers=auth(u["token"]))
|
||||||
self.assertEqual(r.status_code, 200)
|
self.assertEqual(r.status_code, 200)
|
||||||
self.assertEqual(r.json()["current"]["names"], ["华秋豪"])
|
self.assertEqual(r.json()["current"]["names"], ["孙鹏"])
|
||||||
|
self.assertEqual(r.json()["title"], "招生就业服务队值班")
|
||||||
self.assertEqual(r.json()["current"]["end_at"] - r.json()["current"]["start_at"], 105 * 60000)
|
self.assertEqual(r.json()["current"]["end_at"] - r.json()["current"]["start_at"], 105 * 60000)
|
||||||
self.assertNotIn("email", r.text)
|
self.assertNotIn("email", r.text)
|
||||||
self.assertNotIn("phone", r.text)
|
self.assertNotIn("phone", r.text)
|
||||||
|
|||||||
+16
-14
@@ -43,8 +43,8 @@ class DutyTests(unittest.IsolatedAsyncioTestCase):
|
|||||||
self.assertEqual(duties_on(self.schedule, date(2026, 11, 7))[1], {})
|
self.assertEqual(duties_on(self.schedule, date(2026, 11, 7))[1], {})
|
||||||
|
|
||||||
def test_spreadsheet_friday_and_names(self):
|
def test_spreadsheet_friday_and_names(self):
|
||||||
self.assertEqual(self.names, {"华秋豪": ["一二节"], "孙鹏": ["三四节"], "武鑫": ["三四节"], "仲雅玉": ["五六节"], "马涵雪": ["五六节"], "马驰骋": ["七八节"]})
|
self.assertEqual(self.names, {"孙鹏": ["一二节"], "武鑫": ["三四节"], "仲雅玉": ["五六节"], "马涵雪": ["五六节"], "马驰骋": ["七八节"]})
|
||||||
self.assertEqual(sum(len(e["names"]) for entries in self.schedule["weeks"].values() for e in entries), 58)
|
self.assertEqual(sum(len(e["names"]) for entries in self.schedule["weeks"].values() for e in entries), 48)
|
||||||
|
|
||||||
def test_wall_current_shift_boundaries_and_duration(self):
|
def test_wall_current_shift_boundaries_and_duration(self):
|
||||||
for hour, minute, expected_slot in [(8, 30, "一二节"), (10, 14, "一二节"), (10, 15, None), (10, 25, "三四节"), (12, 10, None), (14, 0, "五六节"), (15, 45, None), (16, 0, "七八节"), (17, 45, None)]:
|
for hour, minute, expected_slot in [(8, 30, "一二节"), (10, 14, "一二节"), (10, 15, None), (10, 25, "三四节"), (12, 10, None), (14, 0, "五六节"), (15, 45, None), (16, 0, "七八节"), (17, 45, None)]:
|
||||||
@@ -52,8 +52,10 @@ class DutyTests(unittest.IsolatedAsyncioTestCase):
|
|||||||
self.assertEqual(data["current"]["slot"] if data["current"] else None, expected_slot, (hour, minute))
|
self.assertEqual(data["current"]["slot"] if data["current"] else None, expected_slot, (hour, minute))
|
||||||
if data["current"]:
|
if data["current"]:
|
||||||
self.assertEqual(data["current"]["end_at"] - data["current"]["start_at"], 105 * 60000)
|
self.assertEqual(data["current"]["end_at"] - data["current"]["start_at"], 105 * 60000)
|
||||||
current = duty_status(self.schedule, self.now.replace(hour=8, minute=30))["current"]
|
status = duty_status(self.schedule, self.now.replace(hour=8, minute=30))
|
||||||
self.assertEqual(current["names"], ["华秋豪"])
|
current = status["current"]
|
||||||
|
self.assertEqual(current["names"], ["孙鹏"])
|
||||||
|
self.assertEqual(status["title"], "招生就业服务队值班")
|
||||||
|
|
||||||
def test_wall_weekend_next_week_and_disabled(self):
|
def test_wall_weekend_next_week_and_disabled(self):
|
||||||
weekend = duty_status(self.schedule, datetime(2026, 11, 7, 12, tzinfo=BEIJING))
|
weekend = duty_status(self.schedule, datetime(2026, 11, 7, 12, tzinfo=BEIJING))
|
||||||
@@ -79,9 +81,9 @@ class DutyTests(unittest.IsolatedAsyncioTestCase):
|
|||||||
send.assert_not_called()
|
send.assert_not_called()
|
||||||
first = await send_due(self.schedule, self.now, self.accounts, send, self.state)
|
first = await send_due(self.schedule, self.now, self.accounts, send, self.state)
|
||||||
second = await send_due(self.schedule, self.now, self.accounts, send, self.state)
|
second = await send_due(self.schedule, self.now, self.accounts, send, self.state)
|
||||||
self.assertEqual(first["sent"], 6)
|
self.assertEqual(first["sent"], 5)
|
||||||
self.assertEqual(second["sent"], 0)
|
self.assertEqual(second["sent"], 0)
|
||||||
self.assertEqual(send.await_count, 6)
|
self.assertEqual(send.await_count, 5)
|
||||||
self.assertIn("单周", send.await_args_list[0].args[2])
|
self.assertIn("单周", send.await_args_list[0].args[2])
|
||||||
|
|
||||||
async def test_failure_retries_after_cooldown(self):
|
async def test_failure_retries_after_cooldown(self):
|
||||||
@@ -102,29 +104,29 @@ class DutyTests(unittest.IsolatedAsyncioTestCase):
|
|||||||
async def test_concurrent_workers_claim_only_once(self):
|
async def test_concurrent_workers_claim_only_once(self):
|
||||||
send = AsyncMock()
|
send = AsyncMock()
|
||||||
await asyncio.gather(*(send_due(self.schedule, self.now, self.accounts, send, self.state) for _ in range(2)))
|
await asyncio.gather(*(send_due(self.schedule, self.now, self.accounts, send, self.state) for _ in range(2)))
|
||||||
self.assertEqual(send.await_count, 6)
|
self.assertEqual(send.await_count, 5)
|
||||||
|
|
||||||
async def test_day_before_and_disabled(self):
|
async def test_day_before_and_disabled(self):
|
||||||
self.schedule["reminder_days_before"] = 1
|
self.schedule["reminder_days_before"] = 1
|
||||||
send = AsyncMock()
|
send = AsyncMock()
|
||||||
result = await send_due(self.schedule, datetime(2026, 11, 5, 18, tzinfo=BEIJING), self.accounts, send, self.state)
|
result = await send_due(self.schedule, datetime(2026, 11, 5, 18, tzinfo=BEIJING), self.accounts, send, self.state)
|
||||||
self.assertEqual(result["sent"], 6)
|
self.assertEqual(result["sent"], 5)
|
||||||
self.schedule["enabled"] = False
|
self.schedule["enabled"] = False
|
||||||
await send_due(self.schedule, self.now, self.accounts, send, self.state)
|
await send_due(self.schedule, self.now, self.accounts, send, self.state)
|
||||||
self.assertEqual(send.await_count, 6)
|
self.assertEqual(send.await_count, 5)
|
||||||
|
|
||||||
async def test_evening_and_four_hour_before_reminders_are_independent(self):
|
async def test_evening_and_four_hour_before_reminders_are_independent(self):
|
||||||
self.schedule.update(reminder_days_before=1, reminder_time="18:00")
|
self.schedule.update(reminder_days_before=1, reminder_time="18:00")
|
||||||
send = AsyncMock()
|
send = AsyncMock()
|
||||||
result = await send_due(self.schedule, datetime(2026, 11, 5, 18, tzinfo=BEIJING), self.accounts, send, self.state)
|
result = await send_due(self.schedule, datetime(2026, 11, 5, 18, tzinfo=BEIJING), self.accounts, send, self.state)
|
||||||
self.assertEqual(result["sent"], 6)
|
self.assertEqual(result["sent"], 5)
|
||||||
checks = [(7, 29, 0), (7, 30, 1), (7, 31, 0), (8, 30, 0), (9, 24, 0), (9, 25, 2), (13, 0, 2), (15, 0, 1), (16, 0, 0)]
|
checks = [(7, 29, 0), (7, 30, 1), (7, 31, 0), (8, 30, 0), (9, 24, 0), (9, 25, 1), (13, 0, 2), (15, 0, 1), (16, 0, 0)]
|
||||||
for hour, minute, count in checks:
|
for hour, minute, count in checks:
|
||||||
result = await send_due(self.schedule, self.now.replace(hour=hour, minute=minute), self.accounts, send, self.state)
|
result = await send_due(self.schedule, self.now.replace(hour=hour, minute=minute), self.accounts, send, self.state)
|
||||||
self.assertEqual(result["sent"], count, (hour, minute))
|
self.assertEqual(result["sent"], count, (hour, minute))
|
||||||
self.assertEqual(send.await_count, 12)
|
self.assertEqual(send.await_count, 10)
|
||||||
# 上午第一场仅通知华秋豪,邮件带明确开始时间。
|
# 上午第一场仅通知孙鹏,邮件带明确开始时间。
|
||||||
first_before = send.await_args_list[6]
|
first_before = send.await_args_list[5]
|
||||||
self.assertEqual(first_before.args[0], self.accounts[0]["email"])
|
self.assertEqual(first_before.args[0], self.accounts[0]["email"])
|
||||||
self.assertIn("08:30", first_before.args[2])
|
self.assertIn("08:30", first_before.args[2])
|
||||||
self.assertNotIn("三四节", first_before.args[2])
|
self.assertNotIn("三四节", first_before.args[2])
|
||||||
|
|||||||
Reference in New Issue
Block a user