Update youtrack-wage

This commit is contained in:
Alexander Bantyev 2020-12-28 13:17:17 +03:00
parent b75f5c82c0
commit 1798adb555
Signed by: balsoft
GPG Key ID: E081FF12ADCB4AD5

View File

@ -5,17 +5,21 @@ in
#!${bash}/bin/bash #!${bash}/bin/bash
set -euo pipefail set -euo pipefail
export PATH="$PATH:${yt-utilities}/bin:${ec}/bin:${libqalculate}/bin" export PATH="$PATH:${yt-utilities}/bin:${ec}/bin:${libqalculate}/bin"
HOURS_DAY=$(yt org local --since $(date +'%Y-%m-%d') | tail -1)
HOURS_MONTH=$(yt org local --since $(date +'%Y-%m-01') | tail -1) HOURS_MONTH=$(yt org local --since $(date +'%Y-%m-01') | tail -1)
HOURS_YEAR=$(yt org local --since $(date +'%Y-01-01') | tail -1)
HOURS_TASK=$(emacsclient --eval "org-mode-line-string" | head -1 | cut -d\" -f 2 | cut -d\[ -f2 | cut -d\] -f1)h
MONEY_TASK=$(qalc -t -e "$HOURS_TASK * (${config.secrets.wage})" )
MONEY_DAY=$(qalc -t "($HOURS_DAY) * (${config.secrets.wage})")
MONEY_MONTH=$(qalc -t "($HOURS_MONTH) * (${config.secrets.wage})") MONEY_MONTH=$(qalc -t "($HOURS_MONTH) * (${config.secrets.wage})")
MONEY_YEAR=$(qalc -t "($HOURS_YEAR) * (${config.secrets.wage})")
'' + (if config.deviceSpecific.bigScreen then '' '' + (if config.deviceSpecific.bigScreen then ''
echo "$MONEY_TASK/$MONEY_DAY($HOURS_DAY)/$MONEY_MONTH($HOURS_MONTH)/$MONEY_YEAR" HOURS_DAY=$(yt org local --since $(date +'%Y-%m-%d') | tail -1)
HOURS_YEAR=$(yt org local --since $(date +'%Y-01-01') | tail -1)
MONEY_DAY=$(qalc -t "($HOURS_DAY) * (${config.secrets.wage})")
MONEY_YEAR=$(qalc -t "($HOURS_YEAR) * (${config.secrets.wage})")
TASK=$(emacsclient --eval "org-mode-line-string" 2>/dev/null || echo -n none)
if ! [[ "$TASK" == "none" ]]; then
HOURS_TASK=$(echo "$TASK" | head -1 | cut -d\" -f 2 | cut -d\[ -f2 | cut -d\] -f1)h
MONEY_TASK=$(qalc -t -e "$HOURS_TASK * (${config.secrets.wage})" )
echo "$MONEY_TASK/$MONEY_DAY($HOURS_DAY)/$MONEY_MONTH($HOURS_MONTH)/$MONEY_YEAR"
else
echo "$MONEY_DAY($HOURS_DAY)/$MONEY_MONTH($HOURS_MONTH)/$MONEY_YEAR"
fi
'' else '' '' else ''
echo "$MONEY_MONTH($HOURS_MONTH)" echo "$MONEY_MONTH($HOURS_MONTH)"
'') '')