feat: 按自然月回补日报周报和月报
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
from datetime import date
|
||||
|
||||
from backfill_summaries import missing_message_dates
|
||||
from backfill_summaries import has_missing_report_tag, missing_message_dates
|
||||
|
||||
|
||||
def test_backfill_skips_empty_days_and_existing_nonempty_summaries(tmp_path):
|
||||
@ -33,3 +33,27 @@ def test_backfill_overwrite_still_skips_days_without_messages(tmp_path):
|
||||
))
|
||||
|
||||
assert days == [date(2024, 6, 2)]
|
||||
|
||||
|
||||
def test_backfill_refreshes_only_tagged_reports_from_requested_date(tmp_path):
|
||||
tagged = tmp_path / "2024-11-27.md"
|
||||
tagged.write_text(
|
||||
"---\ntags:\n- no_previous_weekly\n---\n旧日报", encoding="utf-8"
|
||||
)
|
||||
later = tmp_path / "2024-11-28.md"
|
||||
later.write_text("---\ntags:\n- no_previous_monthly\n---\n旧日报", encoding="utf-8")
|
||||
ordinary = tmp_path / "2024-11-29.md"
|
||||
ordinary.write_text("已有日报", encoding="utf-8")
|
||||
|
||||
days = list(missing_message_dates(
|
||||
date(2024, 11, 27),
|
||||
date(2024, 11, 29),
|
||||
lambda day: True,
|
||||
lambda day: tmp_path / f"{day.isoformat()}.md",
|
||||
refresh_tagged_from=date(2024, 11, 28),
|
||||
))
|
||||
|
||||
assert days == [date(2024, 11, 28)]
|
||||
assert has_missing_report_tag(tagged)
|
||||
assert has_missing_report_tag(later)
|
||||
assert not has_missing_report_tag(ordinary)
|
||||
|
||||
Reference in New Issue
Block a user