summaryrefslogtreecommitdiffstats
path: root/server/api/configloader.js
diff options
context:
space:
mode:
authorChristian Hofmaier2019-04-03 03:39:44 +0200
committerChristian Hofmaier2019-04-03 03:39:44 +0200
commitac0597737d8473b57d33346f6c40edd2106c0ec8 (patch)
tree96879bdcc2838507415e75d809c759ad6e851152 /server/api/configloader.js
parent[eventmanager] Migration that actually works (diff)
downloadbas-ac0597737d8473b57d33346f6c40edd2106c0ec8.tar.gz
bas-ac0597737d8473b57d33346f6c40edd2106c0ec8.tar.xz
bas-ac0597737d8473b57d33346f6c40edd2106c0ec8.zip
[configloader] eslint is great
Diffstat (limited to 'server/api/configloader.js')
-rw-r--r--server/api/configloader.js15
1 files changed, 6 insertions, 9 deletions
diff --git a/server/api/configloader.js b/server/api/configloader.js
index bb8f9f5..bc09a59 100644
--- a/server/api/configloader.js
+++ b/server/api/configloader.js
@@ -43,7 +43,7 @@ noAuthRouter.getAsync('/:uuid', async (req, res) => {
if (client.events[i].client_x_event.blacklist) blacklist.push(client.events[i].id)
else if (client.events[i].important) importantEvents.push(client.events[i])
else events.push(client.events[i])
- } else console.log('Event ' + client.events[i].name + ' ist nicht intime' )
+ } else console.log('Event ' + client.events[i].name + ' ist nicht intime')
}
importantEvents = importantEvents.filter(e => !blacklist.includes(e.id))
@@ -114,7 +114,7 @@ noAuthRouter.get('/getconfig/:configId', (req, res) => {
})
})
-function checkEventNow(times) {
+function checkEventNow (times) {
var now = new Date()
if (!times.repetitive) {
if (times.start * 1000 <= now && now < times.end * 1000) return true
@@ -139,10 +139,8 @@ function checkEventNow(times) {
if (checkEventInterval(startDate, yesterday, times.intervalType, times.interval)) {
startAtDay.setDate(startAtDay.getDate() - 1)
overnight = true
- }
- else return false
- }
- else if (endAtDay < now && startAtDay > now) endAtDay.setDate(endAtDay.getDate() + 1)
+ } else return false
+ } else if (endAtDay < now && startAtDay > now) endAtDay.setDate(endAtDay.getDate() + 1)
else if (endAtDay < now && startAtDay < now && endAtDay < startAtDay) endAtDay.setDate(endAtDay.getDate() + 1)
if (!(times.monthMap[now.getMonth()] && (overnight ? times.dayMap[((yesterday.getDay() + 6) % 7)] : times.dayMap[((now.getDay() + 6) % 7)]) && startDate <= now && now < endDate && startAtDay <= now && now < endAtDay)) return false
@@ -152,13 +150,13 @@ function checkEventNow(times) {
return false
}
-function dateDiffInDays(a, b) {
+function dateDiffInDays (a, b) {
const utc1 = Date.UTC(a.getFullYear(), a.getMonth(), a.getDate())
const utc2 = Date.UTC(b.getFullYear(), b.getMonth(), b.getDate())
return Math.floor((utc2 - utc1) / (1000 * 3600 * 24))
}
-function checkEventInterval(startDate, now, type, interval) {
+function checkEventInterval (startDate, now, type, interval) {
if (type === 'day') {
let dateDiff = dateDiffInDays(startDate, now)
if (dateDiff % interval === 0) return true
@@ -183,7 +181,6 @@ function checkEventInterval(startDate, now, type, interval) {
}
}
-
async function fetchParentConfigs (groupIds, blacklist) {
if (groupIds.length === 0) return { 'ids': [], 'type': '' }