Two concurrent series lanes, Complete studies, self-paced finished books; v2.9.0
Publish Container / build (push) Successful in 17m50s
Publish Container / build (push) Successful in 17m50s
- Study status 'complete' (manual or auto when all lessons released); stays enrollable and self-paced (no sequential lock, Resume button, Finished Studies hub section) - Studies get lane (A/B) and expected start date; planned studies show "Starts <date>"; hub shows next lesson date instead of hardcoded pace - Second concurrent series (homepage card, admin panel) with its own scheduled launch; transitions are per lane and flip the ending study to Complete and the incoming study to Active - Finished books link to their study: "Study This Book" on playlist page, audio-only link from hub (playlist stays public, no account) - Admin: bulk release scheduler (every N days), same-day collision warning, linked-study selects - Weekly digest no longer dumps a finished study's backlog on late enrollees - CI: build and tag the container as :beta on pushes to the beta branch Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2d8e4be5ea
commit
ddcaec0ddf
12 files changed
+628
-105
No files matched your search
+16
-1
@@ -74,6 +74,17 @@ export function hashEmailVerifyToken(token) {
|
||||
|
||||
// ── Catalog / enrollment helpers ───────────────────────────────────────────
|
||||
|
||||
// A study is 'complete' when an admin marks it so, or when it has lessons and every
|
||||
// one of them has already been released. Planned studies never auto-complete.
|
||||
export function getEffectiveStudyStatus(study) {
|
||||
if (!study || typeof study !== 'object') return 'active'
|
||||
if (study.status === 'planned') return 'planned'
|
||||
if (study.status === 'complete') return 'complete'
|
||||
const sections = Array.isArray(study.sections) ? study.sections : []
|
||||
if (sections.length > 0 && sections.every(isSectionReleased)) return 'complete'
|
||||
return 'active'
|
||||
}
|
||||
|
||||
export function getStudyCatalog() {
|
||||
const fallback = [
|
||||
{ slug: 'colossians', title: 'Colossians: Rooted in Christ', status: 'active' },
|
||||
@@ -91,7 +102,7 @@ export function getStudyCatalog() {
|
||||
out.push({
|
||||
slug,
|
||||
title: typeof study?.title === 'string' && study.title.trim() ? study.title.trim() : slug,
|
||||
status: study?.status === 'planned' ? 'planned' : 'active',
|
||||
status: getEffectiveStudyStatus(study),
|
||||
})
|
||||
}
|
||||
if (out.length > 0) return out
|
||||
@@ -743,9 +754,13 @@ export async function scheduleWeeklyDigestEmails(sendStudyWeeklyDigestEmail) {
|
||||
: undefined
|
||||
if (!study) continue
|
||||
|
||||
// Finished studies are self-paced: only mention lessons from the last week so a
|
||||
// late enrollee isn't sent the whole back catalogue in one digest.
|
||||
const isComplete = getEffectiveStudyStatus(study) === 'complete'
|
||||
for (const section of study.sections ?? []) {
|
||||
const releaseTime = getSectionReleaseTime(section)
|
||||
if (!Number.isFinite(releaseTime) || releaseTime > nowMs) continue
|
||||
if (isComplete && nowMs - releaseTime > ONE_WEEK_MS) continue
|
||||
const sentForStudy = Array.isArray(userSent[studySlug]) ? userSent[studySlug] : []
|
||||
if (sentForStudy.includes(section.id)) continue
|
||||
|
||||
|
||||
Reference in new issue
Block a user