mirror of
https://github.com/AustinKelsay/plebdevs.git
synced 2025-06-06 18:31:00 +00:00
Fix filtering condition for paid lessons n carousels
This commit is contained in:
parent
3ddcf47a72
commit
45b6b66f33
@ -53,12 +53,11 @@ export default function DocumentsCarousel() {
|
|||||||
try {
|
try {
|
||||||
if (documents && documents.length > 0 && paidLessons.length > 0) {
|
if (documents && documents.length > 0 && paidLessons.length > 0) {
|
||||||
const processedDocuments = documents.map(document => parseEvent(document));
|
const processedDocuments = documents.map(document => parseEvent(document));
|
||||||
console.log('processedDocuments', processedDocuments);
|
|
||||||
// Sort documents by created_at in descending order (most recent first)
|
// Sort documents by created_at in descending order (most recent first)
|
||||||
const sortedDocuments = processedDocuments.sort((a, b) => b.created_at - a.created_at);
|
const sortedDocuments = processedDocuments.sort((a, b) => b.created_at - a.created_at);
|
||||||
|
|
||||||
// filter out documents that are in the paid lessons array
|
// filter out documents that are in the paid lessons array
|
||||||
const filteredDocuments = sortedDocuments.filter(document => !paidLessons.includes(document?.d));
|
const filteredDocuments = sortedDocuments.filter(document => !paidLessons.includes(document?.resource?.resourceId));
|
||||||
|
|
||||||
setProcessedDocuments(filteredDocuments);
|
setProcessedDocuments(filteredDocuments);
|
||||||
} else {
|
} else {
|
||||||
|
@ -52,13 +52,11 @@ export default function VideosCarousel() {
|
|||||||
try {
|
try {
|
||||||
if (videos && videos.length > 0 && paidLessons.length > 0) {
|
if (videos && videos.length > 0 && paidLessons.length > 0) {
|
||||||
const processedVideos = videos.map(video => parseEvent(video));
|
const processedVideos = videos.map(video => parseEvent(video));
|
||||||
console.log('processedVideos', processedVideos);
|
|
||||||
|
|
||||||
const sortedVideos = processedVideos.sort((a, b) => b.created_at - a.created_at);
|
const sortedVideos = processedVideos.sort((a, b) => b.created_at - a.created_at);
|
||||||
console.log('paidLessons', paidLessons);
|
|
||||||
|
|
||||||
// filter out videos that are in the paid lessons array
|
// filter out videos that are in the paid lessons array
|
||||||
const filteredVideos = sortedVideos.filter(video => !paidLessons.includes(video?.d));
|
const filteredVideos = sortedVideos.filter(video => !paidLessons.includes(video?.resource?.resourceId));
|
||||||
|
|
||||||
setProcessedVideos(filteredVideos);
|
setProcessedVideos(filteredVideos);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user