score: fix settings module

pull/828/head
Mika Dede 2021-09-28 15:47:19 +02:00
parent f4d820bf60
commit 7a98c039e7
No known key found for this signature in database
GPG Key ID: 546586DC38D45BBD
1 changed files with 41 additions and 42 deletions

View File

@ -1,46 +1,45 @@
function fillSettingsWithDefaults(settings) {
if (settings.winSets == null) {
settings.winSets = 2;
}
if (settings.setsPerPage == null) {
settings.setsPerPage = 5;
}
if (settings.winScore == null) {
settings.winScore = 21;
}
if (settings.enableTwoAhead == null) {
settings.enableTwoAhead = true;
}
if (settings.enableMaxScore == null) {
settings.enableMaxScore = true;
}
if (settings.maxScore == null) {
settings.maxScore = 30;
}
if (settings.enableTennisScoring == null) {
settings.enableTennisScoring = false;
}
if (settings.enableMaxScoreTiebreak == null) {
settings.enableMaxScoreTiebreak = false;
}
if (settings.maxScoreTiebreakWinScore == null) {
settings.maxScoreTiebreakWinScore = 6;
}
if (settings.maxScoreTiebreakEnableTwoAhead == null) {
settings.maxScoreTiebreakEnableTwoAhead = true;
}
if (settings.maxScoreTiebreakEnableMaxScore == null) {
settings.maxScoreTiebreakEnableMaxScore = false;
}
if (settings.maxScoreTiebreakMaxScore == null) {
settings.maxScoreTiebreakMaxScore = 15;
}
return settings;
}
(function (back, inApp, ret) {
function fillSettingsWithDefaults(settings) {
if (settings.winSets == null) {
settings.winSets = 2;
}
if (settings.setsPerPage == null) {
settings.setsPerPage = 5;
}
if (settings.winScore == null) {
settings.winScore = 21;
}
if (settings.enableTwoAhead == null) {
settings.enableTwoAhead = true;
}
if (settings.enableMaxScore == null) {
settings.enableMaxScore = true;
}
if (settings.maxScore == null) {
settings.maxScore = 30;
}
if (settings.enableTennisScoring == null) {
settings.enableTennisScoring = false;
}
if (settings.enableMaxScoreTiebreak == null) {
settings.enableMaxScoreTiebreak = false;
}
if (settings.maxScoreTiebreakWinScore == null) {
settings.maxScoreTiebreakWinScore = 6;
}
if (settings.maxScoreTiebreakEnableTwoAhead == null) {
settings.maxScoreTiebreakEnableTwoAhead = true;
}
if (settings.maxScoreTiebreakEnableMaxScore == null) {
settings.maxScoreTiebreakEnableMaxScore = false;
}
if (settings.maxScoreTiebreakMaxScore == null) {
settings.maxScoreTiebreakMaxScore = 15;
}
return settings;
}
const fileName = 'score.json';
let settings = require('Storage').readJSON(fileName, 1) || {};