Skip to content

Commit

Permalink
Merge pull request #2280 from sunbird-cb/learner-certificate-Issue-SR
Browse files Browse the repository at this point in the history
Fixed:- retired courses certificates for profile & learning strip in home page
  • Loading branch information
vishnubansaltarento authored Jul 9, 2024
2 parents df3e857 + 64e70d2 commit 4f0fa96
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1099,8 +1099,8 @@ <h2 class="mat-subheading-2 flex-1 min-w-0 margin-remove-bottom" i18n>{{'cardcon
</ng-template>

<ng-template #cardPortrait>
<mat-card class="card-portrait cursor-pointer" [ngClass]="widgetData.cardCustomeClass ? widgetData.cardCustomeClass : ''" (click)="raiseTelemetry();getRedirectUrlData(widgetData?.content); $event.stopPropagation()" >
<div class="course_widget portrait_widget flex margin-bottom-xs">
<mat-card class="card-portrait cursor-pointer" [ngClass]="widgetData.cardCustomeClass ? widgetData.cardCustomeClass : ''" (click)="raiseTelemetry();getRedirectUrlData(widgetData?.content); $event.stopPropagation()" >
<div class="course_widget portrait_widget flex margin-bottom-xs" [ngClass]="{'retiredCards': widgetData?.content?.status === 'Retired' && widgetData?.content?.completionPercentage === 100}">
<div class="flex flex-end flex-middle course_port">
<mat-icon class="mat-icon main_icon ws-mat-default-text margin-right-xs">video_library</mat-icon>
<ws-widget-display-content-type i18n-title title="Content Type" *ngIf="widgetData.content?.primaryCategory"
Expand All @@ -1110,7 +1110,7 @@ <h2 class="mat-subheading-2 flex-1 min-w-0 margin-remove-bottom" i18n>{{'cardcon
</ws-widget-display-content-type>
</div>
</div>
<div class="flex">
<div class="flex" [ngClass]="{'retiredCards': widgetData?.content?.status === 'Retired' && widgetData?.content?.completionPercentage === 100}">
<div class="margin-right-s">
<ng-container *ngIf="widgetData.content.posterImage">
<div class=" img-block-portrait position-relative">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1753,4 +1753,8 @@ $title-line-count: 2;
}
.card-standard-container:hover {
transform: scale(1.02);
}
.retiredCards {
opacity: 0.3;
cursor: default;
}
Original file line number Diff line number Diff line change
Expand Up @@ -426,12 +426,14 @@ export class CardContentV2Component extends WidgetBaseComponent
}
})
} else {
let urlData = await this.contSvc.getResourseLink(content)
this.router.navigate(
[urlData.url],
{
queryParams: urlData.queryParams
})
if (content && content.status && content.status.toLowerCase() !== 'retired') {
let urlData = await this.contSvc.getResourseLink(content)
this.router.navigate(
[urlData.url],
{
queryParams: urlData.queryParams
})
}
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,15 @@ export class ContentStripWithTabsComponent extends WidgetBaseComponent
let contentNew: NsContent.IContent[]
let tabResults: any[] = []
const queryParams = _.get(strip.request.enrollmentList, 'queryParams')
// if (queryParams && queryParams.batchDetails) {
// if (!queryParams.batchDetails.includes('&retiredCoursesEnabled=true')) {
// queryParams.batchDetails += '&retiredCoursesEnabled=true'
// }
// }
if (this.configSvc.userProfile) {
userId = this.configSvc.userProfile.userId
}
// this.userSvc.resetTime('enrollmentService')
// tslint:disable-next-line: deprecation
this.userSvc.fetchUserBatchList(userId, queryParams).subscribe(
(result: any) => {
Expand Down Expand Up @@ -445,7 +451,36 @@ export class ContentStripWithTabsComponent extends WidgetBaseComponent
strip: NsContentStripWithTabs.IContentStripUnit) {
const inprogress: any[] = []
const completed: any[] = []
array.forEach((e: any, idx: number, arr: any[]) => (customFilter(e, idx, arr) ? inprogress : completed).push(e))
// array.forEach((e: any, idx: number, arr: any[]) => (customFilter(e, idx, arr) ? inprogress : completed).push(e))
array.forEach((e, idx, arr) => {
const status = e.status ? (e.status as string).toLowerCase() : ''
const statusRetired = status === 'retired'
if (customFilter(e, idx, arr)) {
if (!statusRetired) {
inprogress.push(e)
}
} else {
completed.push(e)
}
})
// Sort the completed array with 'Live' status first and 'Retired' status second
completed.sort((a: any, b: any) => {
const statusA = a.status ? a.status.toLowerCase() : ''
const statusB = b.status ? b.status.toLowerCase() : ''
if (statusA === 'live' && statusB !== 'live') {
return -1
}
if (statusA !== 'live' && statusB === 'live') {
return 1
}
if (statusA === 'retired' && statusB !== 'retired') {
return 1
}
if (statusA !== 'retired' && statusB === 'retired') {
return -1
}
return 0
})
return [
{ value: 'inprogress', widgets: this.transformContentsToWidgets(inprogress, strip) },
{ value: 'completed', widgets: this.transformContentsToWidgets(completed, strip) }]
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"@project-sunbird/sb-styles": "0.0.7",
"@project-sunbird/sunbird-quml-player": "0.0.6",
"@project-sunbird/telemetry-sdk": "0.0.26",
"@sunbird-cb/consumption": "0.0.47",
"@sunbird-cb/consumption": "0.0.48",
"@sunbird-cb/design-system": "0.0.2",
"@sunbird-cb/discussions-ui-v8": "2.1.3",
"@sunbird-cb/micro-surveys": "^2.0.17",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,35 @@ export class SeeAllHomeComponent implements OnInit, OnDestroy {
strip: NsContentStripWithTabs.IContentStripUnit) {
const inprogress: any[] = []
const completed: any[] = []
array.forEach((e: any, idx: number, arr: any[]) => (customFilter(e, idx, arr) ? inprogress : completed).push(e))
array.forEach((e, idx, arr) => {
const status = e.status ? (e.status as string).toLowerCase() : ''
const statusRetired = status === 'retired'
if (customFilter(e, idx, arr)) {
if (!statusRetired) {
inprogress.push(e)
}
} else {
completed.push(e)
}
})
// Sort the completed array with 'live' status first and 'Retired' status second
completed.sort((a: any, b: any) => {
const statusA = a.status ? a.status.toLowerCase() : ''
const statusB = b.status ? b.status.toLowerCase() : ''
if (statusA === 'live' && statusB !== 'live') {
return -1
}
if (statusA !== 'live' && statusB === 'live') {
return 1
}
if (statusA === 'retired' && statusB !== 'retired') {
return 1
}
if (statusA !== 'retired' && statusB === 'retired') {
return -1
}
return 0
})
return [
{ value: 'inprogress', widgets: this.transformContentsToWidgets(inprogress, strip) },
{ value: 'completed', widgets: this.transformContentsToWidgets(completed, strip) }]
Expand Down Expand Up @@ -247,10 +275,16 @@ export class SeeAllHomeComponent implements OnInit, OnDestroy {
let contentNew: NsContent.IContent[]
this.tabResults = []
const queryParams = _.get(strip.request.enrollmentList, 'queryParams')
// if (queryParams && queryParams.batchDetails) {
// if (!queryParams.batchDetails.includes('&retiredCoursesEnabled=true')) {
// queryParams.batchDetails += '&retiredCoursesEnabled=true'
// }
// }
if (this.configSvc.userProfile) {
userId = this.configSvc.userProfile.userId
}
// tslint:disable-next-line: deprecation
// this.userSvc.resetTime('enrollmentService')
this.userSvc.fetchUserBatchList(userId, queryParams).subscribe(
(result: any) => {
const courses = result && result.courses
Expand Down
2 changes: 1 addition & 1 deletion src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,7 @@ const routes: Routes = [
pageId: 'public/privacy-policy',
},
},

{
path: 'public/google/sso',
component: PublicLoginWGComponent,
Expand Down

0 comments on commit 4f0fa96

Please sign in to comment.