forked from CIT/Vmeda.Online
		
	MOBILE-2915 lesson: Allow review when max attempts reached
This commit is contained in:
		
							parent
							
								
									d81004f528
								
							
						
					
					
						commit
						2f1171fec8
					
				| @ -245,7 +245,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy { | |||||||
| 
 | 
 | ||||||
|             if (info.preventaccessreasons && info.preventaccessreasons.length) { |             if (info.preventaccessreasons && info.preventaccessreasons.length) { | ||||||
|                 // If it's a password protected lesson and we have the password, allow playing it.
 |                 // If it's a password protected lesson and we have the password, allow playing it.
 | ||||||
|                 const preventReason = this.lessonProvider.getPreventAccessReason(info, !!this.password); |                 const preventReason = this.lessonProvider.getPreventAccessReason(info, !!this.password, this.review); | ||||||
|                 if (preventReason) { |                 if (preventReason) { | ||||||
|                     // Lesson cannot be played, show message and go back.
 |                     // Lesson cannot be played, show message and go back.
 | ||||||
|                     return Promise.reject(preventReason.message); |                     return Promise.reject(preventReason.message); | ||||||
|  | |||||||
| @ -2367,9 +2367,10 @@ export class AddonModLessonProvider { | |||||||
|      * |      * | ||||||
|      * @param {any} info Lesson access info. |      * @param {any} info Lesson access info. | ||||||
|      * @param {boolean} [ignorePassword] Whether password protected reason should be ignored (user already entered the password). |      * @param {boolean} [ignorePassword] Whether password protected reason should be ignored (user already entered the password). | ||||||
|  |      * @param {boolean} [isReview] Whether user is reviewing a retake. | ||||||
|      * @return {any} Prevent access reason. |      * @return {any} Prevent access reason. | ||||||
|      */ |      */ | ||||||
|     getPreventAccessReason(info: any, ignorePassword?: boolean): any { |     getPreventAccessReason(info: any, ignorePassword?: boolean, isReview?: boolean): any { | ||||||
|         let result; |         let result; | ||||||
| 
 | 
 | ||||||
|         if (info && info.preventaccessreasons) { |         if (info && info.preventaccessreasons) { | ||||||
| @ -2384,6 +2385,8 @@ export class AddonModLessonProvider { | |||||||
|                         // Treat password before all other reasons.
 |                         // Treat password before all other reasons.
 | ||||||
|                         result = entry; |                         result = entry; | ||||||
|                     } |                     } | ||||||
|  |                 } else if (entry.reason == 'noretake' && isReview) { | ||||||
|  |                     // Ignore noretake error when reviewing.
 | ||||||
|                 } else if (!result) { |                 } else if (!result) { | ||||||
|                     // Rest of cases, just return any of them.
 |                     // Rest of cases, just return any of them.
 | ||||||
|                     result = entry; |                     result = entry; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user