propose "are you sure" if saving edited time entry with modified date

Discussion forum about Anuko Time Tracker
Post Reply
dalescott
Posts: 66
Joined: Fri Apr 21, 2017 2:53 pm
Location: Calgary, Alberta, Canada
Contact:

propose "are you sure" if saving edited time entry with modified date

Post by dalescott » Fri Nov 16, 2018 8:03 pm

Hi all, it may just be me, but more than once (perhaps even a couple times a month), I have created a new time entry by copying a previous one, then lost the previous entry by Saving instead of Copying. Doh! (much worse language if it was a long comment, and assuming I even realized I'd lost the original time entry). Is this really just me?

I'd like to propose having to confirm Saving with an "Are you sure, the date has changed" dialogue IF the date has been edited (if for example, someone accidentally created an entry for today when they had intended yesterday). IMHO the hardship will be minimal compared to the recovery effort when one _should_ have clicked Copy (could be disabled with a config setting, enabled by default).

Thanks,
Dale

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

Re: propose "are you sure" if saving edited time entry with modified date

Post by wrc » Fri Nov 16, 2018 10:00 pm

dalescott wrote:
Fri Nov 16, 2018 8:03 pm
I'd like to propose having to confirm Saving with an "Are you sure, the date has changed" dialogue IF the date has been edited (if for example, someone accidentally created an entry for today when they had intended yesterday). IMHO the hardship will be minimal compared to the recovery effort when one _should_ have clicked Copy (could be disabled with a config setting, enabled by default)
Warning on copy group config option with What is it? link explaining it sounds good to me, perhaps disabled by default?

dalescott
Posts: 66
Joined: Fri Apr 21, 2017 2:53 pm
Location: Calgary, Alberta, Canada
Contact:

Re: propose "are you sure" if saving edited time entry with modified date

Post by dalescott » Sat Nov 17, 2018 7:42 pm

Exactly what @wrc said! ;-)

I think wrc may understand the solution better than me.

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

Re: propose "are you sure" if saving edited time entry with modified date

Post by Nik » Sat Dec 01, 2018 5:06 pm

The Confirm saving feature is now implemented as of Time Tracker 1.18.29.4556. It is configured (per group) on the group edit page, and should also work for all subgroups with individually configured setting for each group.

dalescott
Posts: 66
Joined: Fri Apr 21, 2017 2:53 pm
Location: Calgary, Alberta, Canada
Contact:

Re: propose "are you sure" if saving edited time entry with modified date

Post by dalescott » Mon Dec 03, 2018 6:33 am

Hi @Nik, thanks so much for accepting my proposal. I pulled the latest code, then ran dbinstall.php and "Update database structure (v1.17.97 to v1.18.26)" (although the login page now shows 1.18.29). I then ran "Clean up DB from inactive teams", which reported it deleted unused groups and users (unfortunately I neglected to capture screenshot or make good notes) and now I am no longer able to login.

2018-12-02 23_23_29 Time Tracker login error.png
2018-12-02 23_23_29 Time Tracker login error.png (26.62 KiB) Viewed 161 times

Can you suggest how I can recover access?

Thanks,
Dale

P.S. I have noticed the original "admin" user is no longer in the db, but this could be unrelated.

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

Re: propose "are you sure" if saving edited time entry with modified date

Post by wrc » Mon Dec 03, 2018 12:33 pm

Did you try to do logout and then login again?

Are there any users left in the database?

Are you sure that the "DB Cleanup" step was done after an update to DB structure?

If so, then it looks like DB cleanup code now may have a bug of removing the admin account. Make sure you have DB backups, always.

dalescott
Posts: 66
Joined: Fri Apr 21, 2017 2:53 pm
Location: Calgary, Alberta, Canada
Contact:

Re: propose "are you sure" if saving edited time entry with modified date

Post by dalescott » Mon Dec 03, 2018 3:54 pm

>> Did you try to do logout and then login again?

Yes. And again after clearing browser data (fyi only testing with Chrome)

>> Are there any users left in the database?

Yes. All users are as expected, except for initial "admin" (which I might have previously deleted via Time Tracker app, but can't say for sure).
uyNp9Gi.png
users
uyNp9Gi.png (39.14 KiB) Viewed 156 times
>> Are you sure that the "DB Cleanup" step was done after an update to DB structure?

Yes. I performed "Update database structure (v1.17.97 to v1.18.26)" first. It appeared to complete correctly, but again I can't absolutely say for sure :-(

I will backup the db as-is, and then restore using a two-week-old backup. I will leave the code as-is (pulled from Github last night), run dbinstall to update the db only, then try logout/login.

I will eventually have to re-enter my time only for one week of the two, at least I have a recent PDF invoice with the entries. I don't have a backup of the app code, but I have the date I last pulled from Github so could checkout if needed. However, you are ABSOLUTELY CORRECT RE BACKUPS. I should have known better and have created a backup of both db and app immediately before doing anything. Doh!

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

Re: propose "are you sure" if saving edited time entry with modified date

Post by wrc » Mon Dec 03, 2018 4:14 pm

The first 2 accounts from your picture (login dale and robert) appear good (assigned role_id). What happens when you try to login?

dalescott
Posts: 66
Joined: Fri Apr 21, 2017 2:53 pm
Location: Calgary, Alberta, Canada
Contact:

Re: propose "are you sure" if saving edited time entry with modified date

Post by dalescott » Mon Dec 03, 2018 4:30 pm

Hi @wrc.

I can login with current code and updated db, but without "Clean up DB". I can't seem to attach more than 2 files to this post, so will send without pics and post them later if anyone wants more detail.

I restored the db from a two weeks ago. Running dbinstall.php an old db version as expected and indicates there is an update to apply.
PICTURE

Before updating, attempting to login gives this error saying the db is empty and to login as admin and fix.
PICTURE

The db is most certainly not empty, and in fact even the admin user is back (seems I had not deleted it).
PICTURE

Back to dbinstall.php, executing the most recent update completes successfully.
PICTURE

Now I can login as my normal user (dale) and poking about seems ok.

I'll backup the DB again later tonight and then "Clean up DB". Is there anything else? Turn on AuditTrail first?

Cheers,
Dale

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

Re: propose "are you sure" if saving edited time entry with modified date

Post by wrc » Mon Dec 03, 2018 4:51 pm

The code that you pulled earlier may delete all for group 0 when "Clean DB" step is executed. This may happen if admin account is "inactive" (not used for a while).

This includes Site administrator and Top manager roles. My guess: this is why you could not login because the role Top manager was gone.

Try to pull the latest code that takes care of not deleting group 0 when cleaning up DB.

Or you can restore the roles and admin account manually.

dalescott
Posts: 66
Joined: Fri Apr 21, 2017 2:53 pm
Location: Calgary, Alberta, Canada
Contact:

Re: propose "are you sure" if saving edited time entry with modified date

Post by dalescott » Tue Dec 04, 2018 4:46 pm

I just tried the new "Are you sure" feature. Fantastic! I'll never accidentally lose a time record again. :-)

Thanks @wrc. I'll update again when I can confirm if all is ok after running Clean DB.

Post Reply