Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command timetrace edit record <key> does not rename file #89

Open
joshuaherrera opened this issue May 29, 2021 · 4 comments · May be fixed by #133 or #134
Open

Command timetrace edit record <key> does not rename file #89

joshuaherrera opened this issue May 29, 2021 · 4 comments · May be fixed by #133 or #134
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@joshuaherrera
Copy link
Contributor

Similar to issue #81 , the timetrace edit record <key> command does not rename the file. This shouldn't be an issue when we pass either the --plus or --minus flags, since these edit the end times, but without those flags, the user can edit the json file and potentially change the start time, which is the key for a record. The documentation recommends using timetrace list records in conjunction with the timetrace edit record command, but this does not work as intended if a flag is not used.

The code expects the key to correspond to the filename, but since it is not changed, the file is not found.

In the image, I demonstrate the above with record 1. Note that this also occurs when use12Hours is false.
editrecord

I'd imagine the solution would be similar to those mentioned in issue #81 .

@joshuaherrera joshuaherrera changed the title Command `timetrace edit record <key> does not rename file Command timetrace edit record <key> does not rename file May 29, 2021
@dominikbraun dominikbraun added enhancement New feature or request help wanted Extra attention is needed labels May 29, 2021
@dominikbraun
Copy link
Owner

Thanks for opening this issue! Since the issue that proposed the edit record command stated that only the end time should be changed with --plus and --minus and the behaviour of edit without flags hasn't been specified, I labeled this as an enhancement and not a bug.

You're right that it is the same problem as with #81. I think we should take the same approach for both issues.

@dominikbraun
Copy link
Owner

dominikbraun commented May 31, 2021

So this is my suggestion to solve this:

  1. When edit record is run without options for directly editing the record, load the record internally first.
  2. Store the record's start time.
  3. When the user has finished editing and the start time has changed, rename the file accordingly.

It probably would also make sense to warn the user before the editor opens:

Warning: Directly editing the record can lead to undefined behavior.

If you change the start time of the record, the underlying file will be renamed automatically. Make sure it doesn't collide with other records. If you want to change the end time, use --minus or --plus instead.

Do you want to continue [y/N]?

@joshuaherrera
Copy link
Contributor Author

@dominikbraun Very well though out solution to this, I like it 👍

@joshuaherrera
Copy link
Contributor Author

@dominikbraun I can handle this issue, can you assign it to me please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants