MOBILE-3833 module: Only show uncompleted completion conditions

main
Pau Ferrer Ocaña 2022-02-23 14:24:24 +01:00
parent c939fd23ca
commit 57ba1f9363
6 changed files with 27 additions and 20 deletions

View File

@ -5,21 +5,24 @@
<ng-container *ngIf="completion.istrackeduser"> <ng-container *ngIf="completion.istrackeduser">
<ng-container *ngFor="let rule of details"> <ng-container *ngFor="let rule of details">
<ion-chip *ngIf="rule.statuscomplete" color="success" role="listitem" [attr.aria-label]="rule.accessibleDescription"> <ion-chip *ngIf="rule.statuscomplete" color="success" role="listitem" [attr.aria-label]="rule.accessibleDescription"
class="completioninfo completion_complete">
<ion-icon name="fas-check" [attr.aria-label]="'core.course.completion_automatic:done' | translate "></ion-icon> <ion-icon name="fas-check" [attr.aria-label]="'core.course.completion_automatic:done' | translate "></ion-icon>
<ion-label> <ion-label>
{{ rule.rulevalue.description }} {{ rule.rulevalue.description }}
</ion-label> </ion-label>
</ion-chip> </ion-chip>
<ion-chip *ngIf="rule.statuscompletefail" color="danger" role="listitem" [attr.aria-label]="rule.accessibleDescription"> <ion-chip *ngIf="rule.statuscompletefail" color="danger" role="listitem" [attr.aria-label]="rule.accessibleDescription"
class="completioninfo completion_fail">
<ion-icon name="fas-times" [attr.aria-label]="'core.course.completion_automatic:failed' | translate "></ion-icon> <ion-icon name="fas-times" [attr.aria-label]="'core.course.completion_automatic:failed' | translate "></ion-icon>
<ion-label> <ion-label>
{{ rule.rulevalue.description }} {{ rule.rulevalue.description }}
</ion-label> </ion-label>
</ion-chip> </ion-chip>
<ion-chip *ngIf="rule.statusincomplete" color="dark" role="listitem" [attr.aria-label]="rule.accessibleDescription"> <ion-chip *ngIf="rule.statusincomplete" color="dark" role="listitem" [attr.aria-label]="rule.accessibleDescription"
class="completioninfo completion_incomplete">
<ion-icon name="fas-edit" [attr.aria-label]="'core.course.completion_automatic:todo' | translate "></ion-icon> <ion-icon name="fas-edit" [attr.aria-label]="'core.course.completion_automatic:todo' | translate "></ion-icon>
<ion-label> <ion-label>
{{ rule.rulevalue.description }} {{ rule.rulevalue.description }}
@ -29,7 +32,7 @@
</ng-container> </ng-container>
<ng-container *ngIf="!completion.istrackeduser"> <ng-container *ngIf="!completion.istrackeduser">
<ion-chip *ngFor="let rule of details" role="listitem"> <ion-chip *ngFor="let rule of details" role="listitem" class="core-module-completion-todo">
<ion-icon name="fas-edit" [attr.aria-label]="'core.course.completion_automatic:todo' | translate "></ion-icon> <ion-icon name="fas-edit" [attr.aria-label]="'core.course.completion_automatic:todo' | translate "></ion-icon>
<ion-label> <ion-label>
{{ rule.rulevalue.description }} {{ rule.rulevalue.description }}

View File

@ -1,12 +0,0 @@
:host {
.core-module-automatic-completion-conditions {
ion-badge {
font-weight: normal;
margin-right: 5px;
&[color="medium"] {
color: black;
}
}
}
}

View File

@ -36,7 +36,6 @@ import { Translate } from '@singletons';
@Component({ @Component({
selector: 'core-course-module-completion', selector: 'core-course-module-completion',
templateUrl: 'core-course-module-completion.html', templateUrl: 'core-course-module-completion.html',
styleUrls: ['module-completion.scss'],
}) })
export class CoreCourseModuleCompletionComponent extends CoreCourseModuleCompletionBaseComponent { export class CoreCourseModuleCompletionComponent extends CoreCourseModuleCompletionBaseComponent {

View File

@ -71,7 +71,7 @@
</core-format-text> </core-format-text>
<!-- Module completion. Only auto conditions--> <!-- Module completion. Only auto conditions-->
<core-course-module-completion *ngIf="module.completiondata && module.uservisible" [completion]="module.completiondata" <core-course-module-completion *ngIf="autoCompletionTodo && module.uservisible" [completion]="module.completiondata"
[moduleName]="module.name" [moduleId]="module.id" [showCompletionConditions]="showCompletionConditions"> [moduleName]="module.name" [moduleId]="module.id" [showCompletionConditions]="showCompletionConditions">
</core-course-module-completion> </core-course-module-completion>

View File

@ -8,6 +8,10 @@
margin-right: var(--horizontal-margin); margin-right: var(--horizontal-margin);
} }
ion-item {
--padding-start: 12px;
}
ion-item.core-module-main-item { ion-item.core-module-main-item {
--min-height: 52px; --min-height: 52px;
@ -84,4 +88,7 @@
@include margin-horizontal(null, 8px); @include margin-horizontal(null, 8px);
} }
.core-course-module-info ::ng-deep core-course-module-completion .core-module-automatic-completion-conditions .completioninfo.completion_complete {
display: none;
}
} }

View File

@ -20,7 +20,7 @@ import {
CoreCourseModuleCompletionData, CoreCourseModuleCompletionData,
CoreCourseSection, CoreCourseSection,
} from '@features/course/services/course-helper'; } from '@features/course/services/course-helper';
import { CoreCourse } from '@features/course/services/course'; import { CoreCourse, CoreCourseModuleCompletionStatus, CoreCourseModuleCompletionTracking } from '@features/course/services/course';
import { CoreCourseModuleDelegate, CoreCourseModuleHandlerButton } from '@features/course/services/module-delegate'; import { CoreCourseModuleDelegate, CoreCourseModuleHandlerButton } from '@features/course/services/module-delegate';
import { import {
CoreCourseModulePrefetchDelegate, CoreCourseModulePrefetchDelegate,
@ -55,6 +55,8 @@ export class CoreCourseModuleComponent implements OnInit, OnDestroy {
showManualCompletion = false; // Whether to show manual completion when completion conditions are disabled. showManualCompletion = false; // Whether to show manual completion when completion conditions are disabled.
prefetchStatusIcon = ''; // Module prefetch status icon. prefetchStatusIcon = ''; // Module prefetch status icon.
prefetchStatusText = ''; // Module prefetch status text. prefetchStatusText = ''; // Module prefetch status text.
autoCompletionTodo = false;
protected prefetchHandler?: CoreCourseModulePrefetchHandler; protected prefetchHandler?: CoreCourseModulePrefetchHandler;
protected moduleStatusObserver?: CoreEventObserver; protected moduleStatusObserver?: CoreEventObserver;
@ -73,10 +75,18 @@ export class CoreCourseModuleComponent implements OnInit, OnDestroy {
this.module.handlerData.a11yTitle = this.module.handlerData.a11yTitle ?? this.module.handlerData.title; this.module.handlerData.a11yTitle = this.module.handlerData.a11yTitle ?? this.module.handlerData.title;
const completionStatus = this.showCompletionConditions && this.module.completiondata?.isautomatic &&
this.module.completiondata.tracking == CoreCourseModuleCompletionTracking.COMPLETION_TRACKING_AUTOMATIC
? this.module.completiondata.state
: undefined;
this.autoCompletionTodo = completionStatus == CoreCourseModuleCompletionStatus.COMPLETION_INCOMPLETE ||
completionStatus == CoreCourseModuleCompletionStatus.COMPLETION_COMPLETE_FAIL;
this.hasInfo = !!( this.hasInfo = !!(
this.module.description || this.module.description ||
(this.showActivityDates && this.module.dates && this.module.dates.length) || (this.showActivityDates && this.module.dates && this.module.dates.length) ||
(this.module.completiondata && this.showCompletionConditions && this.module.completiondata.isautomatic) || (this.autoCompletionTodo) ||
(this.module.visible === 0 && (!this.section || this.section.visible)) || (this.module.visible === 0 && (!this.section || this.section.visible)) ||
(this.module.visible !== 0 && this.module.isStealth) || (this.module.visible !== 0 && this.module.isStealth) ||
(this.module.availabilityinfo) (this.module.availabilityinfo)