1
0
Fork 0

openproject_hours: refactor

This commit is contained in:
Luca Bilke 2025-01-08 16:22:10 +01:00
commit 8db3a4adf0
No known key found for this signature in database
GPG key ID: F6E11C9BAA7C82F5

View file

@ -1,4 +1,5 @@
#!/bin/sh #!/bin/sh
# vim: noet ci pi sts=0 sw=4 ts=4
year=$1 year=$1
month=$2 month=$2
@ -8,20 +9,26 @@ API_KEY="<#openproject_apikey#>"
API_URL="https://op.tralios.de" API_URL="https://op.tralios.de"
PAGE_SIZE="1000" PAGE_SIZE="1000"
filters='[ days=$(cal "$month" "$year" | awk 'NF {DAYS=$NF} END {print DAYS}')
filters=$(
cat <<-EOF
[
{ {
"spentOn": { "spentOn": {
"operator": "<>d", "operator": "<>d",
"values": ["'"${year}-${month}-01"'", "'"${year}-${month}-30"'"] "values": ["${year}-${month}-01", "${year}-${month}-${days}"]
} }
}, },
{ {
"user": { "user": {
"operator": "=", "operator": "=",
"values": ["'"$USER_ID"'"] "values": ["$USER_ID"]
} }
} }
]' ]
EOF
)
curl -s \ curl -s \
-u "apikey:${API_KEY}" \ -u "apikey:${API_KEY}" \