Skip to content

Commit

Permalink
Progress tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
VitalikL committed Dec 20, 2024
1 parent acee25b commit d32db17
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
10 changes: 9 additions & 1 deletion ops/deploy/deploy-resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
RESOURCE_AUDIO_FILENAME,
RESOURCE_VIDEO_FILENAME,
RESOURCE_PDF_FILENAME,
RESOURCE_COVER_PLACEHOLDER
RESOURCE_COVER_PLACEHOLDER, RESOURCE_PROGRESS_TRACKING
} from "../helpers/constants.js"

let getResourceInfo = async function (resource, depth = 0) {
Expand Down Expand Up @@ -62,6 +62,14 @@ let getResourceInfo = async function (resource, depth = 0) {
delete resourceInfo.end_date
}

if (!resourceInfo.progressTracking && (resourceInfo.kind === RESOURCE_KIND.DEVOTIONAL || resourceInfo.kind === RESOURCE_KIND.PLAN)) {
resourceInfo.progressTracking =
resourceInfo.startDate && resourceInfo.endDate
? RESOURCE_PROGRESS_TRACKING.AUTOMATIC
: RESOURCE_PROGRESS_TRACKING.MANUAL
resourceInfo.displayProgress = true
}

if (resourceInfo.splash) {
delete resourceInfo.splash
}
Expand Down
5 changes: 5 additions & 0 deletions ops/helpers/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ export const RESOURCE_KIND = {
BLOG: "blog",
MAGAZINE: "magazine",
}
export const RESOURCE_PROGRESS_TRACKING = {
NONE: "none",
AUTOMATIC: "automatic",
MANUAL: "manual",
}
export const RESOURCE_ORDER = {
ASC: "asc",
DESC: "desc",
Expand Down
2 changes: 1 addition & 1 deletion src/en/categories/love/feed.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
- group: Devotionals
scope: resource
kind: devotionals
kind: devotional
- group: Other resources
scope: resource
- group: Found within titles
Expand Down

0 comments on commit d32db17

Please sign in to comment.