This repository has been archived by the owner on Jul 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #146 from secretrobotron/content-xx
Conflict Teaches and Be an Artist activities
- Loading branch information
Showing
8 changed files
with
880 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
const fs = require('fs'); | ||
|
||
const quizFolder = './quizzes/'; | ||
|
||
function cleanString (input) { | ||
return input.replace(/\s\s+/g, ' ').replace(/\s+\?/g, '?').replace(/\?\s+/g, '?'); | ||
} | ||
|
||
let jsonFilesWritten = 0; | ||
|
||
fs.readdir(quizFolder, (err, files) => { | ||
let quizFilesToParse = files.filter(file => { | ||
return (file.substr(file.length - 4, 4) === '.txt'); | ||
}); | ||
|
||
quizFilesToParse.forEach(file => { | ||
|
||
fs.readFile(quizFolder + file, 'utf8', function(err, fileData) { | ||
|
||
const lines = fileData.split('\n'); | ||
|
||
const title = cleanString(lines.shift()); | ||
const questions = []; | ||
|
||
lines.shift(); | ||
|
||
while (lines.length > 0) { | ||
let question = cleanString(lines.shift()); | ||
|
||
let answers = [ | ||
lines.shift(), | ||
lines.shift(), | ||
lines.shift() | ||
]; | ||
|
||
let correctAnswer = -1; | ||
answers = answers.map((answer, index) => { | ||
let newAnswer = answer.replace('[CORRECT]', ''); | ||
if (answer.length !== newAnswer.length) { | ||
correctAnswer = index + 1; | ||
return newAnswer; | ||
} | ||
return answer; | ||
}); | ||
|
||
answers = answers.map(answer => { | ||
return cleanString(answer); | ||
}); | ||
|
||
lines.shift(); | ||
|
||
question = question.replace(/\d+\.\s+/, ''); | ||
question = question.replace('(hitamwo inyishu imwe ibereye)', ''); | ||
question = question.replace('(hitamwo kimwe)', ''); | ||
question = question.replace('’', '\''); | ||
question = question.replace('“', '"'); | ||
question = question.replace('”', '"'); | ||
|
||
if (question.indexOf('?') !== question.length - 1 && question.charCodeAt(question.length-1) == 32) { | ||
question = question.substr(0, question.length -1); | ||
} | ||
|
||
let entry = { | ||
question: question, | ||
answers: answers, | ||
'answer-type': 'multiple-choice', | ||
}; | ||
|
||
if (correctAnswer > -1) { | ||
entry['correct-answer'] = correctAnswer; | ||
} | ||
|
||
questions.push(entry); | ||
} | ||
|
||
const outputFilename = quizFolder + file + '.json'; | ||
|
||
const quiz = { | ||
id: 0, | ||
title: title, | ||
color: '#45B39D', | ||
video: '', | ||
questions: questions | ||
}; | ||
|
||
fs.writeFile(outputFilename, JSON.stringify(quiz, null, 2), 'utf8', err => { | ||
console.log('Wrote ' + outputFilename); | ||
|
||
if (++jsonFilesWritten === quizFilesToParse.length) { | ||
fs.readFile(quizFolder + 'content-skeleton.json', 'utf8', (err, data) => { | ||
const skeletonContentJSON = JSON.parse(data); | ||
|
||
skeletonContentJSON.categories.forEach(category => { | ||
const categoryColor = category.color; | ||
|
||
category.topics = category.topics.map((topic, index) => { | ||
const video = topic.video; | ||
const jsonFilename = topic.json; | ||
const json = JSON.parse(fs.readFileSync(quizFolder + jsonFilename, 'utf8')); | ||
|
||
json.id = index; | ||
json.color = categoryColor; | ||
json.video = video; | ||
|
||
return json; | ||
}); | ||
}); | ||
|
||
fs.writeFile(quizFolder + 'content.json', JSON.stringify(skeletonContentJSON, null, 2), 'utf8', err => { | ||
console.log('Wrote content.json'); | ||
}); | ||
}); | ||
} | ||
}); | ||
|
||
}); | ||
|
||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
BA UMUNYATUGENEGENE | ||
|
||
1. Wabonye gute muri rusangi iyi reresi? (hitamwo kimwe) | ||
Nayikunze kandi yari ngira kamaro | ||
Ntaho mpagaze kandi nibaza ko vyoba vyari ngira kamaro canke atari ngira kamaro | ||
Sinahimbawe n’iyi reresi kandi nibaza ko itari ngira kamaro | ||
|
||
2. What competency does this video cover? (hitamwo inyishu imwe ibereye) | ||
Kutadohoka[CORRECT] | ||
Ukugenzura inyiyumvo zawe | ||
Kwubaka ubwonko bwawe | ||
|
||
3. Ni iyihe ntumbero y’agakorwa? (hitamwo inyishu imwe ibereye) | ||
Gufasha ababnyeshure kuryohora ubumenyi bwabo bwo gufata ku mutwe | ||
Gufasha ababnyeshure kwiga kurondera izindi nteguro mu gihe bahuye n’igikorwa kigoye[CORRECT] | ||
Gufasha abanyeshure kumenya inyiyumvo ziri mu bandi | ||
|
||
4. Ni igiki wokwibutsa abanyeshure bawe mu gihe bariko barakora aka gakorwa? (hitamwo inyishu imwe ibereye) | ||
Kwibutsa abanyeshure kwama bibuka kubaza ibibazo igihe bahuye n’amatati kugira ngo bige vyinshi kuri izo ngorane | ||
Kwibutsa abanyeshure ko iyo integuro yabo ya mbere itagenze neza, barashobora kuyihindura[CORRECT] | ||
Kwibutsa abanyeshure kwerekana ibishobisho, atari ukwerekana ibikorwa nk’ugukina umupira | ||
|
||
5. Ni ikihe kintu wotegerezwa kuba uriko urakora? (hitamwo inyishu imwe ibereye) | ||
Notegerezwa guhitamwo imirwi isa ngo yerekane ibicapu vyayo mu gihe bariko barimenyereza ibintu bitandukanye | ||
Notegerezwa guha abana amashusho nyezina canke ivyo bisunga mu gucapa mu gihe bariko barakina ibintu bitandukanye[CORRECT] | ||
Notegerezwa kubwira abanyeshure guhagarika ico gikorwa mu gihe bafise ingorane | ||
|
||
6. Ni ikihe kintu wotegerezwa kuba uriko urakora? (hitamwo inyishu imwe ibereye) | ||
Notegerezwa kubwira abanyeshure baheze agakorwa ningoga | ||
Notegerezwa kuguma ndi imvuga kuri kandi ndabibakundisha, n’ubwo abanyeshureboba bobabafise ingorane muri aka gakorwa[CORRECT] | ||
Notegerezwa kubwira abanyeshure ukuntu bakorera hamwe mu gucapa igicapu | ||
|
||
7. Ni ikihe kintu wotegerezwa kuba utariko urakora? (hitamwo inyishu imwe ibereye) | ||
Sinotegerezwa guha abanyeshure ishusho nyezina canke ivyo bisunga mu gucapa nk "ibikoko" canke "inzu" | ||
Sinotegerezwa kubwira ananyeshure ico bakora[CORRECT] | ||
Sinotegerezwa kureka abanyeshure ngo bahindure integuro zabo mu gucapa amashusho | ||
|
||
8. Ni akahe karorero k’ikibazo wotegerezwa kubaza mu mwanya w’igice c’ikiganiro c’aka gakorwa? (hitamwo inyishu imwe ibereye) | ||
Ni gute wiyumvira ko ivyo ukora misi yose bihindura inyiyumvo za bagenzawe? | ||
Ni kuki ari ngirakamaro kwiyumvamwo inyiyumvo zitaraba? | ||
Ni bangahe muri mwebwe bamaze guhindura integuro zabo za mbere? Kubera iki?[CORRECT] | ||
|
||
9. Ni gute ushigikira abanyeshure bawe kwigira muri kano gakorwa? hitamwo inyishu imwe ibereye) | ||
Mu kubwira abanyeshure ukuntu batorera umuti ingorane hanyuma rero nkabasaba kubisubiramwo | ||
Mu kubatuma gufata k8u mutwe ukuntu batorera umuti ingorane | ||
Mu kureka abanyeshure bakironderera umuti w’ingorane atarinze kubafasha[CORRECT] |
Oops, something went wrong.