mirror of
				https://gitlab.com/MrFry/moodle-test-userscript
				synced 2025-04-01 20:22:48 +02:00 
			
		
		
		
	Fixed question highlighting in some cases
This commit is contained in:
		
							
								
								
									
										14
									
								
								main.js
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								main.js
									
									
									
									
									
								
							| @@ -1415,7 +1415,16 @@ function SortByPercent(results) { | ||||
|  | ||||
| // removes stuff like " a. q1" -> "q1" | ||||
| function RemoveLetterMarking(inp) { | ||||
| 	return RemoveUnnecesarySpaces(inp.substr(inp.indexOf(".") + 1, inp.length)); | ||||
| 	let dotIndex = inp.indexOf('.'); | ||||
| 	let doubledotIndex = inp.indexOf(':'); | ||||
| 	let maxInd = 4; // inp.length * 0.2; | ||||
|  | ||||
| 	if (dotIndex < maxInd) | ||||
| 		return RemoveUnnecesarySpaces(inp.substr(inp.indexOf(".") + 1, inp.length)); | ||||
| 	else if (doubledotIndex < maxInd) | ||||
| 		return RemoveUnnecesarySpaces(inp.substr(inp.indexOf(":") + 1, inp.length)); | ||||
| 	else | ||||
| 		return inp; | ||||
| } | ||||
|  | ||||
| // highlights the possible solutions to the current question | ||||
| @@ -1436,6 +1445,9 @@ function HighLightAnswer(results, currQuestionNumber) { | ||||
| 					// removing stuff like "a." | ||||
| 					answer = RemoveLetterMarking(answer); | ||||
|  | ||||
| 					if (EmptyOrWhiteSpace(correct) || EmptyOrWhiteSpace(answer)) | ||||
| 						continue; | ||||
|  | ||||
| 					if (NormalizeSpaces(RemoveUnnecesarySpaces(correct)).includes(answer)) // if the correct answer includes the current answer | ||||
| 					{ | ||||
| 						toColor.push(i); // adding the index | ||||
|   | ||||
		Reference in New Issue
	
	Block a user