Skip to content

Commit

Permalink
Merge pull request #54 from sudeeppr1998/release-2.0-dev
Browse files Browse the repository at this point in the history
Removed english code from Indic content code
  • Loading branch information
sudeeppr1998 authored Oct 29, 2024
2 parents c2ea206 + dc93a8e commit 1f4dde3
Showing 1 changed file with 2 additions and 52 deletions.
54 changes: 2 additions & 52 deletions src/services/content.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -783,59 +783,9 @@ export class contentService {
});
}

// remove all criteria and get random content with content type
if (contentData.length <= limit) {
let randomContentQuery = {
contentSourceData: {
$elemMatch: {
},
},
contentType: contentType
};

randomContentQuery.contentSourceData.$elemMatch['language'] = en_config.language_code;

await this.content
.aggregate([
{
$addFields: {
contentSourceData: {
$map: {
input: '$contentSourceData',
as: 'elem',
in: {
$mergeObjects: [
'$$elem',
{
syllableCountArray: {
$objectToArray: '$$elem.syllableCountMap',
},
},
],
},
},
},
},
},
{
$match: randomContentQuery,
},
{ $sample: { size: limit - contentData.length } },
])
.exec()
.then((doc) => {
for (const docEle of doc) {
if (contentData.length == 0 || !contentDataSet.has(docEle.contentId)) {
contentDataSet.add(docEle.contentId);
contentData.push(docEle);
}
}
});
}

// remove all criteria and get random content with content type
if (contentData.length <= limit) {
console.log("hello");

let randomContentQuery = {
contentSourceData: {
$elemMatch: {
Expand Down Expand Up @@ -882,7 +832,7 @@ export class contentService {
}
}
});
}
}


for (let contentDataEle of contentData) {
Expand Down

0 comments on commit 1f4dde3

Please sign in to comment.