Skip to content

Commit

Permalink
Merge pull request #349 from claushaas/dev
Browse files Browse the repository at this point in the history
fix
  • Loading branch information
claushaas authored Aug 22, 2024
2 parents 8c4eea8 + f10952b commit d33b612
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/services/course.service.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,11 @@ export class CourseService {
const allCourses = allCoursesKeys.map(key => {
const course = JSON.parse(CourseService.cache.get(key) ?? '{}') as TCourseDataForCache;

const hasActiveSubscription = user.roles?.includes('admin') ?? course.delegateAuthTo.some(courseSlug => {
const hasActiveSubscription = user.roles?.includes('admin') || course.delegateAuthTo.some(courseSlug => { // eslint-disable-line @typescript-eslint/prefer-nullish-coalescing
const subscription = CourseService.cache.get(`${courseSlug}:${user.id}`);

console.log('assinatura', subscription);

if (!subscription) {
return false;
}
Expand All @@ -127,7 +129,7 @@ export class CourseService {
};
});

const filteredCourses = allCourses.filter(course => user.roles?.includes('admin') ?? (course.isPublished && course.hasActiveSubscription) ?? course.isSelling);
const filteredCourses = allCourses.filter(course => user.roles?.includes('admin') || (course.isPublished && course.hasActiveSubscription) || course.isSelling); // eslint-disable-line @typescript-eslint/prefer-nullish-coalescing

filteredCourses.sort((a, b) => {
if (!a.order && !b.order) {
Expand Down

0 comments on commit d33b612

Please sign in to comment.