Empty question fix

This commit is contained in:
mrfry 2021-01-14 17:10:30 +01:00
parent 09a04c4ae7
commit b5d5f20b79
6 changed files with 284 additions and 31 deletions

View file

@ -0,0 +1,48 @@
{
"subj": "2020/21/1 - Digitális rendszerek - NIXDR0HBNE/DR0_EA",
"version": "2.0.1.13",
"id": "0347000752702",
"quiz": [
{
"Q": "\n",
"A": "A helyes válasz: Bináris lefele számláló.",
"data": {
"type": "image",
"images": [
"wHFd9y6nWIHCAAAAABJRU5ErkJggg="
]
}
},
{
"Q": "\n",
"A": "D.\n\njobbra létető regiszter\n",
"data": {
"type": "image",
"images": [
"AcLnpIDsSgLsAAAAAElFTkSuQmCC"
]
}
},
{
"Q": "A regiszter feladata\n",
"A": "A.\n\nvezérlési feladatok\n",
"data": {
"type": "simple"
}
},
{
"Q": "A regiszter feladata\n",
"A": "D.\n\nÁtmeneti tárolás\n",
"data": {
"type": "simple"
}
},
{
"Q": "signal d : STD_LOGIC_VECTOR(3 downto 0);\n\nsignal q : STD_LOGIC_VECTOR(3 downto 0);\n\nsignal clk: STD_LOGIC;\n\n…\n\nprocess\n\nBegin\n\n  if (clear = 1) then\n\n  q <= ”0000”;\n\n  elsif (clk`event and clk = 1) then\n   q <= d;\nend if;\n\nend process;\n\n\n",
"A": "B.\n\ntároló regiszter\n",
"data": {
"type": "simple"
}
}
]
}

View file

@ -0,0 +1,78 @@
{
"subj": "2020/21/1 - Pénzügyek alapjai - GGEPU1GFNE/PA-GY2",
"version": "2.0.1.18",
"id": "0672665270899",
"location": "https://elearning.uni-obuda.hu/asd",
"quiz": [
{
"Q": "540.000 Ft-ot elhelyezünk bankbetét formájában 30 napra 18%-os kamatláb mellett. Az év napjait 365-tel számolja. Mekkora lesz a kamatjövedelem, amit felvehetünk a betétünk után (kerekítve)?\n\n\n",
"A": "\n\n\n\n",
"data": {
"type": "simple"
}
},
{
"Q": "Önnek 3 év múlva 3.000.000 Ft-ra lesz szüksége. Mennyi pénzt helyezzen el ma ahhoz 12% kamatláb mellett, hogy ezt a tervét megvalósítsa, ha a bank a kamatokat négy havonta tőkésíti?\n\n\n",
"A": "\n\n\n\n",
"data": {
"type": "simple"
}
},
{
"Q": "Egy kereskedelmi bank évi 6% betéti kamatot ajánl, a kamatok félévenkénti tőkésítése mellett. Hány forintot kellene „ma” elhelyezni, ha azt szeretnénk, hogy 10 év múlva 20.000.000 Ft-unk legyen?\n\n\n",
"A": "\n\n\n\n",
"data": {
"type": "simple"
}
},
{
"Q": "Hány forinttal rendelkeznénk 2,5 év múlva, ha ma elhelyeznénk 500.000 Ft-ot és a bank a kamatokat havonta tőkésítené 12%-os kamatláb mellett?\n",
"A": "\n\n\n\n",
"data": {
"type": "simple"
}
},
{
"Q": "Bankbetét formájában elhelyezünk 90.000 Ft-ot 3 évre, 14%-os kamatra. Mennyi pénzünk lesz három év múlva, ha a bank kamatos kamattal számol?\n\n\n",
"A": "\n\n\n\n",
"data": {
"type": "simple"
}
},
{
"Q": "300.000 Ft-ot helyezünk el a számlánkon lekötött betét formájában 16%-os kamatláb mellett két évre negyedéves tőkésítés mellett. Mekkora összeggel rendelkezünk a befektetés lejártakor?\n\n\n",
"A": "\n\n\n\n",
"data": {
"type": "simple"
}
},
{
"Q": "Mennyi pénz lesz 900.000 Ft-ból 3 év alatt 15%-os kamatláb esetén, ha a kamatok tőkésítésére nem kerül sor a futamidő alatt?\n\n\n",
"A": "\n\n\n\n",
"data": {
"type": "simple"
}
},
{
"Q": "200.000 Ft-ot szeretne elhelyezni 10%-os kamatláb mellett a bankba féléves tőkésítés mellett. Mekkora összeget vehet fel egy év múlva?\n\n\n",
"A": "\n\n\n\n",
"data": {
"type": "simple"
}
},
{
"Q": "Hány forintunk lenne a bankszámlán 25 év múlva, ha ma elhelyezünk 250.000 Ft-on a bankszámlán, és a bank évi 4%-os kamatot ígér, félévenkénti tőkésítéssel?\n\n\n",
"A": "\n\n\n\n",
"data": {
"type": "simple"
}
},
{
"Q": "Mennyi pénzt helyezzünk el ma bankbetét formájában, ha azt szeretnénk, hogy négy év múlva 220.000 Ft-unk legyen 8% kamatláb mellett?\n\n\n",
"A": "\n\n\n\n",
"data": {
"type": "simple"
}
}
]
}

View file

@ -0,0 +1,96 @@
{
"subj": "2020/21/1 - Pénzügyek alapjai - GGEPU1GFNE/PA-GY2",
"version": "2.0.1.18",
"id": "0672665270899",
"location": "https://elearning.uni-obuda.hu/asd",
"quiz": [
{
"Q": "",
"A": "",
"data": {
"type": "simple"
}
},
{
"Q": "\n\n\n\n",
"A": "\n\n\n\n",
"data": {
"type": "simple"
}
},
{
"Q": "",
"A": "\n\n\n\n",
"data": {
"type": "simple"
}
},
{
"Q": "\n\n\n\n",
"A": "",
"data": {
"type": "simple"
}
},
{
"Q": "",
"A": "",
"data": {
"type": "image",
"images": [
"Cu_Ag.jpg"
]
}
},
{
"Q": "\n\n\n\n",
"A": "\n\n\n\n",
"data": {
"type": "image",
"images": [
"Cu_Ag.jpg"
]
}
},
{
"Q": "",
"A": "\n\n\n\n",
"data": {
"type": "image",
"images": [
"Cu_Ag.jpg"
]
}
},
{
"Q": "\n\n\n\n",
"A": "",
"data": {
"type": "image",
"images": [
"Cu_Ag.jpg"
]
}
},
{
"Q": "This should be valid",
"A": "\n\n\n\n",
"data": {
"type": "image",
"images": [
"Cu_Ag.jpg"
]
}
},
{
"Q": "This should be valid",
"A": "",
"data": {
"type": "image",
"images": [
"Cu_Ag.jpg"
]
}
}
]
}

View file

@ -0,0 +1,14 @@
{
"subj": "2020/21/1 - Digitális rendszerek - AMXDR0IBNE/E",
"version": "2.0.1.13",
"id": "1586202966729",
"quiz": [
{
"Q": "Adott egy háromváltozós függvény, amely akkor 0 értékű, ha a 3 változóból legalább 2, 0 értékű. Válassza ki  a konjunktív kanonikus alakban szereplő maxtermeket amelyek ÉS kapcsolata adja az Y függvényt!",
"A": "A helyes válaszok: nC+B+A, C+nB+A, C+B+nA, C+B+A",
"data": {
"type": "simple"
}
}
]
}

View file

@ -97,7 +97,7 @@ export function processIncomingRequest(
dryRun: boolean,
user: User
): Promise<Array<Result>> {
logger.DebugLog('Processing incoming request', 'actions', 1)
logger.DebugLog('Processing incoming request', 'isadding', 1)
if (recievedData === undefined) {
logger.Log('\tRecieved data is undefined!', logger.GetColor('redbg'))
@ -116,7 +116,7 @@ export function processIncomingRequest(
towrite +=
'\n------------------------------------------------------------------------------\n'
utils.AppendToFile(towrite, recDataFile)
logger.DebugLog('recDataFile written', 'actions', 1)
logger.DebugLog('recDataFile written', 'isadding', 1)
} catch (err) {
logger.Log('Error writing recieved data.')
}
@ -147,13 +147,13 @@ function processIncomingRequestUsingDb(
try {
const recievedQuestions = []
logger.DebugLog('recievedData JSON parsed', 'actions', 1)
logger.DebugLog(recievedData, 'actions', 3)
logger.DebugLog('recievedData JSON parsed', 'isadding', 1)
logger.DebugLog(recievedData, 'isadding', 3)
const allQLength = recievedData.quiz.length
const questionSearchPromises = []
recievedData.quiz.forEach((question) => {
logger.DebugLog('Question:', 'actions', 2)
logger.DebugLog(question, 'actions', 2)
logger.DebugLog('Question:', 'isadding', 2)
logger.DebugLog(question, 'isadding', 2)
const currentQuestion = createQuestion(
question.Q,
question.A,
@ -161,24 +161,29 @@ function processIncomingRequestUsingDb(
)
logger.DebugLog(
'Searching for question in subj ' + recievedData.subj,
'actions',
'isadding',
3
)
logger.DebugLog(currentQuestion, 'actions', 3)
recievedQuestions.push(currentQuestion)
// This here searches only in relevant subjects, and not all subjects
questionSearchPromises.push(
doALongTask({
type: 'work',
data: {
searchIn: [qdb.index],
qdb: qdb.data,
question: currentQuestion,
subjName: recievedData.subj,
searchTillMatchPercent: minMatchAmmountToAdd,
},
})
)
logger.DebugLog(currentQuestion, 'isadding', 3)
if (isQuestionValid(currentQuestion)) {
recievedQuestions.push(currentQuestion)
// This here searches only in relevant subjects, and not all subjects
questionSearchPromises.push(
doALongTask({
type: 'work',
data: {
searchIn: [qdb.index],
qdb: qdb.data,
question: currentQuestion,
subjName: recievedData.subj,
searchTillMatchPercent: minMatchAmmountToAdd,
},
})
)
} else {
logger.DebugLog('Question isnt valid', 'isadding', 1)
logger.DebugLog(currentQuestion, 'isadding', 1)
}
})
Promise.all(questionSearchPromises)
@ -199,22 +204,22 @@ function processIncomingRequestUsingDb(
const sName = getSubjNameWithoutYear(recievedData.subj)
logger.DebugLog(
'Adding question with subjName: ' + sName + ' :',
'actions',
'isadding',
3
)
logger.DebugLog(currentQuestion, 'actions', 3)
logger.DebugLog(currentQuestion, 'isadding', 3)
addQuestion(qdb.data, sName, currentQuestion)
})
currWrites++
logger.DebugLog(
'currWrites for data.json: ' + currWrites,
'actions',
'isadding',
1
)
if (currWrites >= writeAfter && !dryRun) {
currWrites = 0
logger.DebugLog('Writing data.json', 'actions', 1)
logger.DebugLog('Writing data.json', 'isadding', 1)
utils.WriteFile(JSON.stringify(qdb.data), qdb.path)
}
}
@ -226,10 +231,10 @@ function processIncomingRequestUsingDb(
allQLength
)
logger.DebugLog('New Questions:', 'actions', 2)
logger.DebugLog(allQuestions, 'actions', 2)
logger.DebugLog('New Questions:', 'isadding', 2)
logger.DebugLog(allQuestions, 'isadding', 2)
logger.DebugLog('ProcessIncomingRequest done', 'actions', 1)
logger.DebugLog('ProcessIncomingRequest done', 'isadding', 1)
resolve({
newQuestions: allQuestions.length,
qdbName: qdb.name,
@ -263,6 +268,16 @@ function processIncomingRequestUsingDb(
})
}
function isQuestionValid(question: Question) {
if (!question.Q) {
return false
}
if (!question.Q && question.data.type !== 'image') {
return false
}
return true
}
export function shouldSearchDataFile(df: DataFile, testUrl: string): Boolean {
if (typeof df.shouldSearch === 'string' && df.shouldSearch === 'always') {
return true

View file

@ -126,7 +126,9 @@ function compareString(string1: string, string2: string) {
}
function answerPreProcessor(value: string) {
assert(value)
if (!value) {
return value
}
return removeStuff(value, commonUselessAnswerParts)
}
@ -208,7 +210,7 @@ function createQuestion(
): Question {
return {
Q: simplifyQuestion(question),
A: answer ? simplifyAnswer(answer) : null,
A: answer ? simplifyAnswer(answer) : undefined,
data: data,
}
}