Merge remote-tracking branch 'origin/rel-1.4.0'
This commit is contained in:
		
						commit
						8443d8405c
					
				
					 3 changed files with 27 additions and 2 deletions
				
			
		|  | @ -202,7 +202,7 @@ public class LmsAPITemplateAdapter implements LmsAPITemplate { | ||||||
|                         throw new RuntimeException("No course API Access: " + testCourseAccessAPI); |                         throw new RuntimeException("No course API Access: " + testCourseAccessAPI); | ||||||
|                     } |                     } | ||||||
|                     return testCourseAccessAPI; |                     return testCourseAccessAPI; | ||||||
|                 }); |                 }).getOrThrow(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|  |  | ||||||
|  | @ -137,7 +137,7 @@ public class MoodleRestTemplateFactory { | ||||||
|                         log.warn("Failed to get access token for LMS: {}({})", |                         log.warn("Failed to get access token for LMS: {}({})", | ||||||
|                                 lmsSetup.name, |                                 lmsSetup.name, | ||||||
|                                 lmsSetup.id, |                                 lmsSetup.id, | ||||||
|                                 result.getError()); |                                 result.getError().getMessage()); | ||||||
|                     } |                     } | ||||||
|                     return result; |                     return result; | ||||||
|                 }) |                 }) | ||||||
|  |  | ||||||
|  | @ -88,6 +88,31 @@ class ExamUpdateHandler { | ||||||
|             final Set<String> failedOrMissing = new HashSet<>(exams.keySet()); |             final Set<String> failedOrMissing = new HashSet<>(exams.keySet()); | ||||||
|             final String updateId = this.createUpdateId(); |             final String updateId = this.createUpdateId(); | ||||||
| 
 | 
 | ||||||
|  |             // test overall LMS access | ||||||
|  |             try { | ||||||
|  |                 this.lmsAPIService | ||||||
|  |                         .getLmsAPITemplate(lmsSetupId) | ||||||
|  |                         .getOrThrow() | ||||||
|  |                         .checkCourseAPIAccess(); | ||||||
|  |             } catch (final Exception e) { | ||||||
|  |                 log.warn("No LMS access, mark all exams of the LMS as not connected to LMS"); | ||||||
|  |                 if (!failedOrMissing.isEmpty()) { | ||||||
|  |                     failedOrMissing | ||||||
|  |                             .stream() | ||||||
|  |                             .forEach(quizId -> { | ||||||
|  |                                 try { | ||||||
|  |                                     final Exam exam = exams.get(quizId); | ||||||
|  |                                     if (exam.lmsAvailable == null || exam.isLmsAvailable()) { | ||||||
|  |                                         this.examDAO.markLMSAvailability(quizId, false, updateId); | ||||||
|  |                                     } | ||||||
|  |                                 } catch (final Exception ee) { | ||||||
|  |                                     log.error("Failed to mark exam: {} as not connected to LMS", quizId, ee); | ||||||
|  |                                 } | ||||||
|  |                             }); | ||||||
|  |                 } | ||||||
|  |                 return failedOrMissing; | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|             this.lmsAPIService |             this.lmsAPIService | ||||||
|                     .getLmsAPITemplate(lmsSetupId) |                     .getLmsAPITemplate(lmsSetupId) | ||||||
|                     .map(template -> { |                     .map(template -> { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 anhefti
						anhefti