Accept 5-digit dienst numbers and normalize lookup type
This commit is contained in:
parent
bd8b5a5a66
commit
c97d662856
3 changed files with 4 additions and 3 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -2,3 +2,4 @@ node_modules/
|
|||
.env
|
||||
AGENTS.md
|
||||
diensten/
|
||||
diensten_*/
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ function loadDiensten() {
|
|||
|
||||
function findDienst(dienstnummer) {
|
||||
const diensten = loadDiensten()
|
||||
return diensten.find(d => d.dienstnummer === dienstnummer) || null
|
||||
return diensten.find(d => String(d.dienstnummer) === dienstnummer) || null
|
||||
}
|
||||
|
||||
function getPngFilePaths(dienst) {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ const { increment: incrementDaily } = require('./dailyStats')
|
|||
const ALLOWED_GROUP = process.env.ALLOWED_GROUP
|
||||
|
||||
function extractDienstnummer(body) {
|
||||
const match = body.match(/^\s*(\d{4})\s*$/)
|
||||
const match = body.match(/^\s*(\d{4,5})\s*$/)
|
||||
return match ? match[1] : null
|
||||
}
|
||||
|
||||
|
|
@ -66,4 +66,4 @@ async function handleWebhook(payload) {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = { handleWebhook }
|
||||
module.exports = { handleWebhook, extractDienstnummer }
|
||||
|
|
|
|||
Loading…
Reference in a new issue