Skip to content

Timesheet reports across multiple workspaces #3

@n7st

Description

@n7st

Hi,

Testing under the development branch, timesheet reports seem to be on a per-workspace basis.

It would be useful to be able to run a daily report across multiple workspaces (for example for tracking time across multiple projects for one billable entity) or run a report on specific workspaces without switching to them individually.

Today, I have three active workspaces (split by project, chargeable to one company) with time spent on tickets logged under each one. To send my daily report, I had to tid stop and cycle through the workspaces running tid report on each one.

Example data:

% tid workspace ls
default
DPC00005 *
Support
DPC00032

% tid timesheet ls
+------------+---------+----------+
|    DATE    | ENTRIES | DURATION |
+------------+---------+----------+
| 2017-04-18 | 4       | 6h56m27s |
+------------+         +          +
| TOTAL      |         |          |
+------------+---------+----------+

The bash script below meets the feature request in a roundabout way (list the workspaces and find which one you're on at the moment, find your currently active check-in, loop through workspaces running a report on each and then resume your active check-in).

#!/usr/bin/env bash
set -euo pipefail;

WORKSPACES=$(tid workspace ls | awk '{ print $1 }');
ACTIVE=$(tid workspace ls | grep '*' | awk '{ print $1 }');
STATUS=$(tid status -f="{{.IsRunning}}");
TASK=$(tid status -f="{{.ShortHash}}");

if [[ $STATUS == "true" ]];
then
    echo "Stopping tid timer...";

    tid stop;
fi

for ws in ${WORKSPACES[@]};
do
    tid workspace switch $ws > /dev/null;
    report=$(tid report);

    if [[ "$report" != "report: No entries within the given time period" ]];
    then
        echo "

Project $ws
$report";
    fi
done

if [[ $STATUS == "true" ]];
then
    echo "Resuming tid timer (ShortHash $TASK on workspace $ACTIVE)...";

    tid workspace switch $ACTIVE;
    tid resume $TASK;
fi

Thanks,
Mike

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions