Move daily briefings to personal scratchpads, project reports under Project Status Reports parent
This commit is contained in:
@@ -9,7 +9,7 @@ with a config dict specifying location, wiki parent, and agent ID.
|
||||
import sys
|
||||
from datetime import datetime
|
||||
from shared import (
|
||||
MT, DASHBOARD_API, WIKI_API, WIKI_COLLECTION_ID, MONTH_NAMES,
|
||||
MT, DASHBOARD_API, WIKI_API, WIKI_COLLECTION_ID as DEFAULT_WIKI_COLLECTION, MONTH_NAMES,
|
||||
api_request, log_run, wiki_headers, find_child_doc, ensure_child_doc,
|
||||
)
|
||||
|
||||
@@ -138,6 +138,7 @@ def compose_briefing(config, sections):
|
||||
|
||||
def post_to_wiki(config, markdown, date_str):
|
||||
"""Post the briefing to wiki under Year/Month hierarchy."""
|
||||
wiki_collection = config.get("wiki_collection_id", DEFAULT_WIKI_COLLECTION)
|
||||
wiki_parent_id = config["wiki_parent_doc_id"]
|
||||
now = datetime.now(MT)
|
||||
year_str = str(now.year)
|
||||
@@ -146,14 +147,16 @@ def post_to_wiki(config, markdown, date_str):
|
||||
year_id = ensure_child_doc(
|
||||
wiki_parent_id, year_str,
|
||||
f"Daily briefings for {year_str}.",
|
||||
collection_id=wiki_collection,
|
||||
)
|
||||
month_id = ensure_child_doc(
|
||||
year_id, month_str,
|
||||
f"Daily briefings for {month_str} {year_str}.",
|
||||
collection_id=wiki_collection,
|
||||
)
|
||||
|
||||
title = f"Daily Briefing — {date_str}"
|
||||
doc_id = find_child_doc(month_id, title)
|
||||
doc_id = find_child_doc(month_id, title, collection_id=wiki_collection)
|
||||
|
||||
if doc_id:
|
||||
api_request(
|
||||
@@ -169,7 +172,7 @@ def post_to_wiki(config, markdown, date_str):
|
||||
data={
|
||||
"title": title,
|
||||
"text": markdown,
|
||||
"collectionId": WIKI_COLLECTION_ID,
|
||||
"collectionId": wiki_collection,
|
||||
"parentDocumentId": month_id,
|
||||
"publish": True,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user