MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / _daily_days_from_body

Function _daily_days_from_body

deployments/desktop/server.py:84–96  ·  view source on GitHub ↗
(body: Dict[str, Any])

Source from the content-addressed store, hash-verified

82 return "en" if raw.startswith("en") else "zh"
83
84
85def _daily_days_from_body(body: Dict[str, Any]) -> int:
86 raw_days = int(body.get("days") or 1)
87 target_date = str(body.get("target_date") or "").strip()
88 if not target_date:
89 return max(1, min(14, raw_days))
90 try:
91 selected = datetime.strptime(target_date, "%Y-%m-%d").date()
92 except ValueError:
93 return max(1, min(14, raw_days))
94 today = datetime.now().date()
95 if selected > today:
96 return 1
97 return max(1, min(14, (today - selected).days + 1))
98
99

Callers 2

_api_dailyFunction · 0.85
_api_daily_startFunction · 0.85

Calls 2

getMethod · 0.80
nowMethod · 0.80

Tested by

no test coverage detected