diff --git a/utils/dbcheck.js b/utils/dbcheck.js new file mode 100644 index 0000000..e5fdbb9 --- /dev/null +++ b/utils/dbcheck.js @@ -0,0 +1,64 @@ +/* ---------------------------------------------------------------------------- + + Question Server question file merger + GitLab: + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + ------------------------------------------------------------------------- */ + +const utils = require('./utils.js') + +Main() + +function Main () { + console.clear() + const params = GetParams() + console.log(params) + var db = [] + let errors = 0 + + PrintLN() + console.log(params[0] + ': ') + try { + db = JSON.parse(utils.ReadFile(params[0])) + db.Subjects.forEach((subj) => { + subj.Questions.forEach((question) => { + if (question.I) { + console.log('gebasz') + console.log(subj.Name) + console.log(question) + PrintLN() + errors++ + } + }) + }) + } catch (e) { + console.log(e) + } + PrintLN() + console.log(`done, ${errors} error`) + + // utils.WriteFile(JSON.stringify(db), 'newData') +} + +// ----------------------------------------------------------------------------------------- + +function PrintLN () { + console.log('------------------------------------------------------') +} + +function GetParams () { + return process.argv.splice(2) +}