mirror of
https://gitlab.com/MrFry/moodle-test-userscript
synced 2025-04-01 20:22:48 +02:00
Question answering fixes
This commit is contained in:
parent
599fac2928
commit
8956cbade9
1 changed files with 3 additions and 6 deletions
9
main.js
9
main.js
|
@ -34,7 +34,7 @@ const logElementGetting = false;
|
|||
var motdShowCount = 3;
|
||||
var motd = "";
|
||||
|
||||
var minMatchAmmount = 50; // TODO
|
||||
var minMatchAmmount = 50;
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Class descriptions
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
|
@ -67,7 +67,7 @@ class Question {
|
|||
if (typeof q2 == 'string') {
|
||||
var qmatchpercent = Question.CompareString(this.Q, q2);
|
||||
|
||||
if (i)
|
||||
if (i == undefined || i.length == 0)
|
||||
return qmatchpercent;
|
||||
else {
|
||||
if (this.HasImage()) {
|
||||
|
@ -200,7 +200,6 @@ class QuestionDB {
|
|||
r[j] = tmp;
|
||||
}
|
||||
|
||||
console.log(r); // TODO remove dis
|
||||
return r;
|
||||
}
|
||||
AddSubject(subj) {
|
||||
|
@ -723,7 +722,7 @@ function PrepareAnswers(result, j) {
|
|||
{
|
||||
msg += result[k].q.Q + "\n"; // adding the question if yes
|
||||
}
|
||||
msg += result[k].q.A; // adding answer
|
||||
msg += result[k].q.A.replace(/, /g, "\n"); // adding answer
|
||||
if (result[k].q.HasImage()) // and adding image, if it exists
|
||||
{
|
||||
msg += "\n" + result[k].q.I; // if it has image part, adding that too
|
||||
|
@ -738,7 +737,6 @@ function PrepareAnswers(result, j) {
|
|||
}
|
||||
|
||||
function ShowAnswers(answers) {
|
||||
// TODO: alll / current counter
|
||||
if (answers.length > 0) { // if there are more than 0 answer
|
||||
ShowMessage(answers);
|
||||
} else {
|
||||
|
@ -758,7 +756,6 @@ function HandleQuiz(url, count) {
|
|||
var answers = [];
|
||||
for (var j = 0; j < questions.length; j++) // going thru all answers
|
||||
{
|
||||
// TODO: images, and other stuffs
|
||||
var question = RemoveUnnecesarySpaces(questions[j]); // simplifying question
|
||||
var result = data.Search(question, SimplifyImages(imgNodes));
|
||||
answers.push(PrepareAnswers(result, j));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue