mtierltd / timetracker

GNU Affero General Public License v3.0
82 stars 27 forks source link

Identical project name entries with different clients vanish in Reports #215

Open printplaatreparatie opened 1 year ago

printplaatreparatie commented 1 year ago

We have an issue where duplicate project names with different client names are not shown in Reports.

In order to be able to work together on the same projects, we create duplicate project. As long as each user creates their own project and client with exactly the same name as the original, they will be added as allowed user in that project. I agree that this is a bit of a hack. It would be better if there was a way to add users, but that's another topic (#177).

Things will hit the proverbial fan when there is a typo in the client name. The entries from that user will be present in the users Timer view, but are completely vanished in Reports, and will therefore not be billed. This is fortunate for our client, but rather unpleasant for our wallet.

To reduce the damage, I use this SQL command to list affected entries.

select wi.name AS `name`, user_uid AS `user`, c.name AS `client`, p.name AS `project`, from_unixtime(start) as `date`, from_unixtime(start+duration) as `end`, duration/3600 as duration from oc_timetracker_work_interval wi join oc_timetracker_project p on wi.project_id = p.id join oc_timetracker_client c on p.client_id = c.id where c.id NOT IN (select client_id from oc_timetracker_user_to_client utc where utc.user_uid=wi.user_uid);

Fixing entries is finicky, as the client name of the first created project name can only be used, and should be used by all users.