musora-content-services 2.177.0 → 2.177.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,61 @@
1
+ <component name="ProjectCodeStyleConfiguration">
2
+ <code_scheme name="Project" version="173">
3
+ <HTMLCodeStyleSettings>
4
+ <option name="HTML_SPACE_INSIDE_EMPTY_TAG" value="true" />
5
+ </HTMLCodeStyleSettings>
6
+ <JSCodeStyleSettings version="0">
7
+ <option name="USE_SEMICOLON_AFTER_STATEMENT" value="false" />
8
+ <option name="FORCE_SEMICOLON_STYLE" value="true" />
9
+ <option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
10
+ <option name="USE_DOUBLE_QUOTES" value="false" />
11
+ <option name="FORCE_QUOTE_STYlE" value="true" />
12
+ <option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
13
+ <option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
14
+ <option name="SPACES_WITHIN_IMPORTS" value="true" />
15
+ </JSCodeStyleSettings>
16
+ <TypeScriptCodeStyleSettings version="0">
17
+ <option name="USE_SEMICOLON_AFTER_STATEMENT" value="false" />
18
+ <option name="FORCE_SEMICOLON_STYLE" value="true" />
19
+ <option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
20
+ <option name="USE_DOUBLE_QUOTES" value="false" />
21
+ <option name="FORCE_QUOTE_STYlE" value="true" />
22
+ <option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
23
+ <option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
24
+ <option name="SPACES_WITHIN_IMPORTS" value="true" />
25
+ </TypeScriptCodeStyleSettings>
26
+ <VueCodeStyleSettings>
27
+ <option name="INTERPOLATION_NEW_LINE_AFTER_START_DELIMITER" value="false" />
28
+ <option name="INTERPOLATION_NEW_LINE_BEFORE_END_DELIMITER" value="false" />
29
+ </VueCodeStyleSettings>
30
+ <codeStyleSettings language="HTML">
31
+ <option name="SOFT_MARGINS" value="100" />
32
+ <indentOptions>
33
+ <option name="INDENT_SIZE" value="2" />
34
+ <option name="CONTINUATION_INDENT_SIZE" value="2" />
35
+ <option name="TAB_SIZE" value="2" />
36
+ </indentOptions>
37
+ </codeStyleSettings>
38
+ <codeStyleSettings language="JavaScript">
39
+ <option name="SOFT_MARGINS" value="100" />
40
+ <indentOptions>
41
+ <option name="INDENT_SIZE" value="2" />
42
+ <option name="CONTINUATION_INDENT_SIZE" value="2" />
43
+ <option name="TAB_SIZE" value="2" />
44
+ </indentOptions>
45
+ </codeStyleSettings>
46
+ <codeStyleSettings language="TypeScript">
47
+ <option name="SOFT_MARGINS" value="100" />
48
+ <indentOptions>
49
+ <option name="INDENT_SIZE" value="2" />
50
+ <option name="CONTINUATION_INDENT_SIZE" value="2" />
51
+ <option name="TAB_SIZE" value="2" />
52
+ </indentOptions>
53
+ </codeStyleSettings>
54
+ <codeStyleSettings language="Vue">
55
+ <option name="SOFT_MARGINS" value="100" />
56
+ <indentOptions>
57
+ <option name="CONTINUATION_INDENT_SIZE" value="2" />
58
+ </indentOptions>
59
+ </codeStyleSettings>
60
+ </code_scheme>
61
+ </component>
@@ -0,0 +1,5 @@
1
+ <component name="ProjectCodeStyleConfiguration">
2
+ <state>
3
+ <option name="USE_PER_PROJECT_SETTINGS" value="true" />
4
+ </state>
5
+ </component>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/musora-content-services.iml" filepath="$PROJECT_DIR$/.idea/musora-content-services.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="WEB_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$" />
5
+ <orderEntry type="inheritedJdk" />
6
+ <orderEntry type="sourceFolder" forTests="false" />
7
+ </component>
8
+ </module>
package/.idea/php.xml ADDED
@@ -0,0 +1,19 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="MessDetectorOptionsConfiguration">
4
+ <option name="transferred" value="true" />
5
+ </component>
6
+ <component name="PHPCSFixerOptionsConfiguration">
7
+ <option name="transferred" value="true" />
8
+ </component>
9
+ <component name="PHPCodeSnifferOptionsConfiguration">
10
+ <option name="highlightLevel" value="WARNING" />
11
+ <option name="transferred" value="true" />
12
+ </component>
13
+ <component name="PhpStanOptionsConfiguration">
14
+ <option name="transferred" value="true" />
15
+ </component>
16
+ <component name="PsalmOptionsConfiguration">
17
+ <option name="transferred" value="true" />
18
+ </component>
19
+ </project>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="PrettierConfiguration">
4
+ <option name="myConfigurationMode" value="AUTOMATIC" />
5
+ </component>
6
+ </project>
package/.idea/vcs.xml ADDED
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="" vcs="Git" />
5
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
6
+ </component>
7
+ </project>
Binary file
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [2.177.1](https://github.com/railroadmedia/musora-content-services/compare/v2.177.0...v2.177.1) (2026-08-26)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **TP-1323:** add a condition when updating award progress ([#1029](https://github.com/railroadmedia/musora-content-services/issues/1029)) ([67933b8](https://github.com/railroadmedia/musora-content-services/commit/67933b8eb1d55dd01200cca68b9ef0c199f84d72))
11
+
5
12
  ## [2.177.0](https://github.com/railroadmedia/musora-content-services/compare/v2.176.0...v2.177.0) (2026-08-19)
6
13
 
7
14
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musora-content-services",
3
- "version": "2.177.0",
3
+ "version": "2.177.1",
4
4
  "description": "A package for Musoras content services ",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -5,6 +5,7 @@ import { AwardMessageGenerator } from './message-generator'
5
5
  import db from '../../sync/repository-proxy'
6
6
  import { STATE, COLLECTION_TYPE } from '../../sync/models/ContentProgress'
7
7
  import {getProgressStateByIds} from "../../contentProgress.js";
8
+ import UserAwardProgressRepository from '../../sync/repositories/user-award-progress'
8
9
 
9
10
  async function getCompletionStates(contentIds, collection = null) {
10
11
  const progress = await getProgressStateByIds(contentIds, collection)
@@ -24,6 +25,12 @@ function getCollectionFromAward(award) {
24
25
  return null
25
26
  }
26
27
 
28
+ function haveSameLessonIds(a, b) {
29
+ if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return false
30
+ const setA = new Set(a)
31
+ return b.every(id => setA.has(id))
32
+ }
33
+
27
34
 
28
35
  export class AwardManager {
29
36
  async onContentCompleted(contentId) {
@@ -44,8 +51,8 @@ export class AwardManager {
44
51
 
45
52
  async evaluateAward(award) {
46
53
  try {
47
- const hasCompleted = await db.userAwardProgress.hasCompletedAward(award._id)
48
- if (hasCompleted) {
54
+ const existing = await db.userAwardProgress.getByAwardId(award._id)
55
+ if (existing?.data && UserAwardProgressRepository.isCompleted(existing.data)) {
49
56
  console.log(`Award ${award._id} already completed, skipping evaluation`)
50
57
  return
51
58
  }
@@ -57,7 +64,7 @@ export class AwardManager {
57
64
  console.log(`Award ${award._id} is now eligible, granting award`)
58
65
  await this.grantAward(award, collection)
59
66
  } else {
60
- await this.updateAwardProgress(award, collection)
67
+ await this.updateAwardProgress(award, collection, existing)
61
68
  }
62
69
  } catch (error) {
63
70
  console.error(`Error checking award ${award._id}:`, error)
@@ -114,7 +121,7 @@ export class AwardManager {
114
121
  })
115
122
  }
116
123
 
117
- async updateAwardProgress(award, collection) {
124
+ async updateAwardProgress(award, collection, existing) {
118
125
  try {
119
126
  const childIds = getEligibleChildIds(award)
120
127
 
@@ -139,10 +146,18 @@ export class AwardManager {
139
146
  totalLessons: childIds.length,
140
147
  completedCount
141
148
  }
142
-
143
- await db.userAwardProgress.recordAwardProgress(award._id, progressPercentage, {
144
- progressData
145
- })
149
+ const existingProgressData = existing?.data?.progress_data
150
+ const isUnchanged = existing?.data
151
+ && existing.data.progress_percentage === progressPercentage
152
+ && existingProgressData?.totalLessons === progressData.totalLessons
153
+ && existingProgressData?.completedCount === progressData.completedCount
154
+ && haveSameLessonIds(existingProgressData?.completedLessonIds, progressData.completedLessonIds)
155
+
156
+ if (!isUnchanged) {
157
+ await db.userAwardProgress.recordAwardProgress(award._id, progressPercentage, {
158
+ progressData
159
+ })
160
+ }
146
161
 
147
162
  awardEvents.emitAwardProgress({
148
163
  awardId: award._id,
@@ -82,6 +82,7 @@ export interface UpgradeProduct {
82
82
  export interface UpgradeOption {
83
83
  annual_savings: number
84
84
  lowest_monthly_cost: number
85
+ upgrade_type: string
85
86
  products: UpgradeProduct[] // annual + monthly products, or solely annual product with the same configuration information
86
87
  }
87
88
 
@@ -1 +1 @@
1
- export const MCS_VERSION = '2.177.0'
1
+ export const MCS_VERSION = '2.177.1'
@@ -1,71 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "Bash(npx jest *)",
5
- "Bash(npx tsc *)",
6
- "Skill(counselors)",
7
- "Bash(counselors ls *)",
8
- "Bash(counselors groups *)",
9
- "Bash(counselors run *)",
10
- "Bash(npm test *)",
11
- "Bash(gh pr *)",
12
- "Bash(gh api *)",
13
- "Bash(mkdir -p /tmp/pr-review-v2)",
14
- "Read(//tmp/pr-review-v2/**)",
15
- "Bash(cat /home/alesevero/railenvironment/applications/musora-content-services/AGENTS.md)",
16
- "Bash(echo \"no AGENTS.md\")",
17
- "Bash(echo \"exit=$?\")",
18
- "Bash(git checkout *)",
19
- "Skill(pr)",
20
- "Skill(create-decision)",
21
- "mcp__github__pull_request_read",
22
- "mcp__github__push_files",
23
- "Bash(git push *)",
24
- "mcp__github__create_pull_request",
25
- "mcp__github__search_pull_requests",
26
- "Bash(git commit *)",
27
- "Bash(git add *)",
28
- "mcp__github__list_pull_requests",
29
- "mcp__sanity__get_schema",
30
- "mcp__sanity__query_documents",
31
- "Bash(git rm *)",
32
- "Bash(git rebase *)",
33
- "Bash(git fetch *)",
34
- "Bash(git --no-pager log --oneline -1)",
35
- "Bash(git --no-pager log --oneline -5)",
36
- "Bash(git ls-tree *)",
37
- "Bash(git --no-pager log --oneline -2)",
38
- "Bash(git --no-pager diff --stat HEAD~1)",
39
- "Bash(git check-ignore *)",
40
- "Bash(python3 -)",
41
- "Bash(git --no-pager log --oneline -3)",
42
- "Bash(mkdir *)",
43
- "Bash(git --no-pager log --oneline origin/main..HEAD)"
44
- ]
45
- },
46
- "model": "sonnet",
47
- "enabledMcpjsonServers": [
48
- "atlassian",
49
- "figma",
50
- "google-workspace",
51
- "snowflake",
52
- "aws",
53
- "hex",
54
- "sanity",
55
- "mysql",
56
- "slack",
57
- "langfuse",
58
- "chrome-devtools",
59
- "railway",
60
- "github",
61
- "asana"
62
- ],
63
- "disabledMcpjsonServers": [
64
- "nightwatch",
65
- "1password",
66
- "mysql-staging",
67
- "mysql-local",
68
- "mobile"
69
- ],
70
- "effortLevel": "medium"
71
- }