Created
March 4, 2018 15:09
-
-
Save theeye-io/658f80ca64c110088f9dfd0d98a628f5 to your computer and use it in GitHub Desktop.
This scripts calculates the total worked hours by Ticker user for a given date.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
token="YourToken" | |
user="YourUser" | |
id="YourID" | |
startsDay="2018-02-01" | |
endsDay="2018-02-28" | |
users=$(curl -s -H "Authorization: Token token=$token" \ | |
-H "User-Agent: Theeye ($user)" \ | |
https://www.tickspot.com/$id/api/v2/users|jq '.[]| "\(.id) \(.email)"') | |
for interactano in ${users//" "/"|"} | |
do | |
interactanoID=$(echo $interactano|cut -d'|' -f1|sed s/\"//g) | |
interactarnoMail=$(echo $interactano|cut -d'|' -f2|sed s/\"//g) | |
HoursPerInteractano=$(curl -s -H "Authorization: Token token=$token" \ | |
-H "User-Agent: Theeye ($user)" \ | |
"https://www.tickspot.com/$id/api/v2/entries.json?user_id=$interactanoID&start_date=$startsDay&end_date=$endsDay" | jq '.[].hours') | |
totalHoursPerInteractano=$(echo $HoursPerInteractano|sed 's/\n//g'|sed -e 's/[[:space:]]/\+/g'|bc) | |
echo "user $interactarnoMail, $totalHoursPerInteractano" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment