mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
64 lines
1.8 KiB
JavaScript
64 lines
1.8 KiB
JavaScript
/* ----------------------------------------------------------------------------
|
|
|
|
Question Server question file merger
|
|
GitLab: <https://gitlab.com/MrFry/mrfrys-node-server>
|
|
|
|
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 <https://www.gnu.org/licenses/>.
|
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
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)
|
|
}
|