musora-content-services 1.3.2 → 1.3.3

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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
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
+ ### [1.3.3](https://github.com/railroadmedia/musora-content-services/compare/v1.3.2...v1.3.3) (2025-01-31)
6
+
5
7
  ### [1.3.2](https://github.com/railroadmedia/musora-content-services/compare/v1.3.1...v1.3.2) (2025-01-30)
6
8
 
7
9
  ### [1.3.1](https://github.com/railroadmedia/musora-content-services/compare/v1.3.0...v1.3.1) (2025-01-29)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musora-content-services",
3
- "version": "1.3.2",
3
+ "version": "1.3.3",
4
4
  "description": "A package for Musoras content services ",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -621,6 +621,9 @@ export function filtersToGroq(filters, selectedFilters = []) {
621
621
  return `instrumentless == ${value}`
622
622
  }
623
623
  } else if (key === 'difficulty' && !selectedFilters.includes(key)) {
624
+ if(value === 'Introductory'){
625
+ return `(difficulty_string == "Novice" || difficulty_string == "Introductory" )`
626
+ }
624
627
  return `difficulty_string == "${value}"`
625
628
  } else if (key === 'type' && !selectedFilters.includes(key)) {
626
629
  return `_type == "${value}"`
@@ -106,8 +106,20 @@ export async function fetchSongArtistCount(brand) {
106
106
  return fetchSanity(query, true, { processNeedAccess: false })
107
107
  }
108
108
 
109
- export async function fetchPlayAlongsCount(brand) {
110
- const query = `count(*[brand == '${brand}' && _type == "play-along"]) `
109
+ export async function fetchPlayAlongsCount(brand, {
110
+ searchTerm,
111
+ includedFields,
112
+ progressIds,
113
+ progress,
114
+ }) {
115
+ const searchFilter = searchTerm ? `&& (artist->name match "${searchTerm}*" || instructor[]->name match "${searchTerm}*" || title match "${searchTerm}*" || name match "${searchTerm}*")` :'';
116
+
117
+ // Construct the included fields filter, replacing 'difficulty' with 'difficulty_string'
118
+ const includedFieldsFilter = includedFields.length > 0 ? filtersToGroq(includedFields) : ''
119
+
120
+ // limits the results to supplied progressIds for started & completed filters
121
+ const progressFilter = await getProgressFilter(progress, progressIds)
122
+ const query = `count(*[brand == '${brand}' && _type == "play-along" ${searchFilter} ${includedFieldsFilter} ${progressFilter} ]) `
111
123
  return fetchSanity(query, true, { processNeedAccess: false })
112
124
  }
113
125
 
@@ -1889,7 +1901,7 @@ function getFilterOptions(option, commonFilter, contentType, brand) {
1889
1901
  filterGroq = `
1890
1902
  "difficulty": [
1891
1903
  {"type": "All", "count": count(*[${commonFilter} && difficulty_string == "All"])},
1892
- {"type": "Introductory", "count": count(*[${commonFilter} && difficulty_string == "Introductory"])},
1904
+ {"type": "Introductory", "count": count(*[${commonFilter} && (difficulty_string == "Novice" || difficulty_string == "Introductory")])},
1893
1905
  {"type": "Beginner", "count": count(*[${commonFilter} && difficulty_string == "Beginner"])},
1894
1906
  {"type": "Intermediate", "count": count(*[${commonFilter} && difficulty_string == "Intermediate" ])},
1895
1907
  {"type": "Advanced", "count": count(*[${commonFilter} && difficulty_string == "Advanced" ])},
File without changes