Top-manager, Reports and "Select all"

Discussion forum about Anuko Time Tracker
Post Reply
Semper
Posts: 17
Joined: Mon May 20, 2019 6:25 pm

Top-manager, Reports and "Select all"

Post by Semper » Sun Jun 30, 2019 1:41 pm

Hello.

When in Time Tracker the Top-Manager goes to Reports, there is a handy link to "select all" users for the reporting.

If the Top-Manager creates a "favorite report" with the "select all users" option, when later a new user is added to the Group, that new user is not auto-included in the already existing "favorite reports".

My boss (the Top-Manager) created a handful of highly customized favorite reports, and now he is complaining that he has to "check them all over again" so that some newly added users get included in them.

Is there a way to tell a "favorite report" to include all current and also future users of the Group? That would be extremely handy!

admin
Posts: 560
Joined: Fri Oct 08, 2004 9:46 pm
Location: Vancouver, Canada
Contact:

Re: Top-manager, Reports and "Select all"

Post by admin » Mon Jul 01, 2019 3:40 pm

Semper wrote:
Sun Jun 30, 2019 1:41 pm
My boss (the Top-Manager) created a handful of highly customized favorite reports, and now he is complaining that he has to "check them all over again" so that some newly added users get included in them.
Old code had this a while ago by treating a NULL value in the field with a special meaning of "all users". However, it was removed due to inconsistencies and some code maintenance difficulties.

Ask your boss if he is able to contribute to the project in any capability, if there is commitment and the need is serious, perhaps we could re-implement this in a more maintainable fashion, which will require some effort, if done properly.

Semper
Posts: 17
Joined: Mon May 20, 2019 6:25 pm

Re: Top-manager, Reports and "Select all"

Post by Semper » Mon Jul 01, 2019 7:12 pm

Thanks for the reply, admin.

My boss is not willing to make a donation to the project, as I suggested him - I think he is not really sure he will stick to using Anuko Time Tracker (but I keep telling him it is a great program, and at the same time simple enough to be easy to use). However, I am willing to contribute a full translation to Spanish, as I see the current one is very incomplete.

Anyway, I have devised a crude hack to make "Favorite Reports" report on all current and future users of a given Group. I modified the file "WEB-INF/lib/ttReportHelper.class.php" and changed this block of code:

Code: Select all

// Prepare sql query part for user list.
$userlist = $options['users'] ? $options['users'] : '-1';
if ($user->can('view_reports') || $user->can('view_all_reports') || $user->isClient())
  $user_list_part = " and l.user_id in ($userlist)";
else
...so that it now looks like this:

Code: Select all

// Prepare sql query part for user list.
$userlist = $options['users'] ? $options['users'] : '-1';
if ($user->can('view_reports') || $user->can('view_all_reports') || $user->isClient()) {
// $user_list_part = " and l.user_id in ($userlist)";
  if ($userlist == '-1')
	$user_list_part = " ";
  else
	$user_list_part = " and l.user_id in ($userlist)";
} else
This way, if a Favorite Report is saved by the Top-Manager selecting "no users at all", such Favorite Report will report on all users in the Group, even on users added in the future to said Group without having to manually add them to that Favorite Report.

I am not really sure if this hack has bad consecuences in other areas of the program. I hope not. Could you validate whether this hack is harmless?

Nik
Posts: 488
Joined: Wed May 26, 2010 5:55 pm

Re: Top-manager, Reports and "Select all"

Post by Nik » Tue Jul 02, 2019 1:16 pm

Semper wrote:
Mon Jul 01, 2019 7:12 pm
I am willing to contribute a full translation to Spanish, as I see the current one is very incomplete.
Translation improvements are always welcome.
Semper wrote:
Mon Jul 01, 2019 7:12 pm
This way, if a Favorite Report is saved by the Top-Manager selecting "no users at all", such Favorite Report will report on all users in the Group, even on users added in the future to said Group without having to manually add them to that Favorite Report.

I am not really sure if this hack has bad consecuences in other areas of the program. I hope not. Could you validate whether this hack is harmless?
Design-wise, this does not look proper.

How does one know not to select any users and yet expect all users to be included in a report? This is not obvious and is also not logical.

A better way:

- Upon creation a fav report, detect if all active or all inactive users are selected.
- If true, present a dialog asking whether or not they want to include "future users" in such categories, or keep only selected.
- Designate "active_users" and "inactive_users" strings as legit entries in users field in tt_fav_reports table that is saved in the database. Perhaps "all_users" too, but that could be an overkill. For example:

Code: Select all

3,4,5 // users having ids 3, 4, and 5
acrtive_users // all active users
inactive_users // all inactive users
active_users,inactive_users // active and inactive users
active_users,6,7 // active users and users with ids 6 and 7
Then refactor the code accordingly.

Semper
Posts: 17
Joined: Mon May 20, 2019 6:25 pm

Re: Top-manager, Reports and "Select all"

Post by Semper » Tue Jul 02, 2019 8:12 pm

Nik wrote:
Tue Jul 02, 2019 1:16 pm
Semper wrote:
Mon Jul 01, 2019 7:12 pm
This way, if a Favorite Report is saved by the Top-Manager selecting "no users at all", such Favorite Report will report on all users in the Group, even on users added in the future to said Group without having to manually add them to that Favorite Report.

I am not really sure if this hack has bad consecuences in other areas of the program. I hope not. Could you validate whether this hack is harmless?
Design-wise, this does not look proper.

How does one know not to select any users and yet expect all users to be included in a report? This is not obvious and is also not logical.
I agree with you there.
However, in my use-case scenario I only have several Users and one Top-Manager, so the Top-Manager is a single human who I can train about this "peculiarity" of the program... That's not a solution, just an excuse, I know...
Nik wrote:
Tue Jul 02, 2019 1:16 pm
A better way:

- Upon creation a fav report, detect if all active or all inactive users are selected.
- If true, present a dialog asking whether or not they want to include "future users" in such categories, or keep only selected.
- Designate "active_users" and "inactive_users" strings as legit entries in users field in tt_fav_reports table that is saved in the database. Perhaps "all_users" too, but that could be an overkill.
Too complicated IMHO, I think that solution goes against the ethos of simplicity of the program. ¿What about a "virtual user" next to his own checkmark, in the Reports page, called "Report on all current and future users", so that that checkmark is not automatically checked upon clicking on the "select all users link", but so that when that virtual user "Report on all current and future users" is manually checked, then my code change goes into effect?

wrc
Posts: 289
Joined: Tue May 25, 2010 8:30 pm

Re: Top-manager, Reports and "Select all"

Post by wrc » Wed Jul 03, 2019 12:44 pm

How about an additional dropdown with "active" and "selected" options in the Users section. Active means all current active users in group, subject to access rights.

Post Reply