Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "1.6.0"
".": "1.7.0"
}
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [1.7.0](https://github.com/handball-referee/referee.app/compare/v1.6.0...v1.7.0) (2025-08-28)


### Features

* add me language ([ee8b0c9](https://github.com/handball-referee/referee.app/commit/ee8b0c9cde6e875d10e291228e17d5a092e33420))

## [1.6.0](https://github.com/handball-referee/referee.app/compare/v1.5.0...v1.6.0) (2025-08-17)


Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "referee.app",
"version": "1.6.0",
"version": "1.7.0",
"description": "App to study for handball referee tests",
"license": "MIT",
"scripts": {
Expand Down
24 changes: 19 additions & 5 deletions scripts/check_questions.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,49 @@ const path = require('path');

const dePath = path.join(process.cwd(), 'de.json');
const enPath = path.join(process.cwd(), 'en.json');
const mePath = path.join(process.cwd(), 'me.json');
const answersPath = path.join(process.cwd(), 'answers.json');

function loadJson(filePath) {
return JSON.parse(fs.readFileSync(filePath, 'utf8'));
}

function checkQuestions(deQuestions, enQuestions) {
function checkQuestions(deQuestions, enQuestions, meQuestions) {
let success = true;
if (deQuestions.length !== enQuestions.length) {
console.error(`Mismatch: de.json has ${deQuestions.length} questions, en.json has ${enQuestions.length}`);
// Find missing or extra questions by id
const deIds = new Set(deQuestions.map(q => q.id));
const enIds = new Set(enQuestions.map(q => q.id));
const meIds = new Set(meQuestions.map(q => q.id));
const missingInEn = [...deIds].filter(id => !enIds.has(id));
const missingInDe = [...enIds].filter(id => !deIds.has(id));
const missingInMe = [...enIds].filter(id => !meIds.has(id));
if (missingInEn.length > 0) {
console.error(`Questions in de.json but not in en.json: ${missingInEn.join(', ')}`);
}
if (missingInDe.length > 0) {
console.error(`Questions in en.json but not in de.json: ${missingInDe.join(', ')}`);
}
if (missingInMe.length > 0) {
console.error(`Questions in en.json but not in de.json: ${missingInMe.join(', ')}`);
}
success = false;
}
const minLen = Math.min(deQuestions.length, enQuestions.length);
const minLen = Math.min(deQuestions.length, enQuestions.length, meQuestions.length);
for (let i = 0; i < minLen; i++) {
const deQ = deQuestions[i];
const enQ = enQuestions[i];
const meQ = meQuestions[i];
const deAnswers = Object.keys(deQ.answers || {});
const enAnswers = Object.keys(enQ.answers || {});
const meAnswers = Object.keys(meQ.answers || {});
if (deAnswers.length !== enAnswers.length) {
console.error(`Mismatch in answers for question index ${i} (id: ${deQ.id}): de.json has ${deAnswers.length}, en.json has ${enAnswers.length}`);
console.error(`Question ${deQ.id}: DE has ${deAnswers.length} answers, EN has ${enAnswers.length}`);
success = false;
}
if (meAnswers.length !== enAnswers.length) {
console.error(`Question ${meQ.id}: ME has ${meAnswers.length} answers, EN has ${enAnswers.length}`);
success = false;
}
}
Expand All @@ -60,11 +72,13 @@ function checkAnswers(questions, answers) {
function main() {
const deQuestions = loadJson(dePath);
const enQuestions = loadJson(enPath);
const meQuestions = loadJson(mePath);
const answers = loadJson(answersPath);
checkQuestions(deQuestions, enQuestions);
checkQuestions(deQuestions, enQuestions, meQuestions);
const deOk = checkAnswers(deQuestions, answers);
const enOk = checkAnswers(enQuestions, answers);
if (deOk && enOk) {
const meOk = checkAnswers(meQuestions, answers);
if (deOk && enOk && meOk) {
console.log('All questions have corresponding answers in answers.json');
}
}
Expand Down
10 changes: 5 additions & 5 deletions scripts/clean_questions.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const fs = require('fs');
const path = require('path');

const filePath = path.join(__dirname, '2025_07_DHB_Regelfragenkatalog_Fragen.txt');
const outputPath = path.join(__dirname, 'questions_clean.txt');
const jsonPath = path.join(__dirname, 'de.json');
const filePath = path.join(process.cwd(), 'RSCG - IHF katalog pitanja 2025_250819_210002_efe9d55c-218e-411e-be70-aef400013a3a.txt');
const outputPath = path.join(process.cwd(), 'questions_clean.txt');
const jsonPath = path.join(process.cwd(), 'me.json');

function isSectionTitle(line) {
return /^\s*Rule \d+\s*$/.test(line);
Expand Down Expand Up @@ -44,8 +44,8 @@ function parseQuestionsAndAnswers(lines) {
let currentAnswer = null;
let currentAnswerId = null;

const questionRegex = /^\s*((?:SAR1|SAR2|\d+\.\d+))\s*(.*)$/;
const answerRegex = /^\s*([a-z])\)\s*(.*)$/i;
const questionRegex = /^\s*((?:SAR1|SAR2|\d+\.\d+))\)?\s*(.*)$/;
const answerRegex = /^\s*([a-z])\s*?\)\s*(.*)$/i;

for (let i = 0; i < lines.length; i++) {
const line = lines[i];
Expand Down
5 changes: 5 additions & 0 deletions src/components/LanguagePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import de from "../img/de.svg";
import fr from "../img/fr.svg";
import es from "../img/es.svg";
import pl from "../img/pl.svg";
import me from "../img/me.svg";

const LanguagePicker: FunctionComponent = () => {
const { i18n } = useTranslation();
Expand Down Expand Up @@ -51,6 +52,10 @@ const LanguagePicker: FunctionComponent = () => {
<img src={pl} alt="Polski" className="rounded mr-1 h-5" />
<span>Polski</span>
</Item>
<Item code="me">
<img src={me} alt="Crnogorski" className="rounded mr-1 h-4 mt-0.5 mb-0.5" />
<span>Crnogorski</span>
</Item>
</Dropdown>
);
};
Expand Down
Loading