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

[bug] Cannot edit a record that had its initial timestamp edited #246

Open
pedroangelini opened this issue Feb 5, 2024 · 0 comments · May be fixed by #247
Open

[bug] Cannot edit a record that had its initial timestamp edited #246

pedroangelini opened this issue Feb 5, 2024 · 0 comments · May be fixed by #247

Comments

@pedroangelini
Copy link

pedroangelini commented Feb 5, 2024

If you edit a record's start timestamp (for example, changing the minutes of the record), you can no longer edit it using the timestamp as a key.

How to reproduce:

> timetrace create project dummy
✔️ Created project dummy

> timetrace start dummy
✔️ Started tracking time

> timetrace stop
✔️ Stopped tracking time

> timetrace list records today
+-----+------------------+---------------+---------+-------+------------+--------+
|  #  |       KEY        |    PROJECT    |  START  |  END  |  BILLABLE  |  TAGS  |
+-----+------------------+---------------+---------+-------+------------+--------+
|   4 | 2024-02-05-16-57 | dummy         | 16:57   | 16:57 | no         |        |
...

> timetrace edit 2024-02-05-16-57

In the editor, change the start time from 16:57 to 16:55
{
"start": "2024-02-05T16:5755:24.5205026+01:00",
"end": "2024-02-05T16:57:34.8433413+01:00",
"project": {
"key": "dummy"
},
"is_billable": false,
"tags": []
}

> timetrace list records today
+-----+------------------+---------------+---------+-------+------------+--------+
|  #  |       KEY        |    PROJECT    |  START  |  END  |  BILLABLE  |  TAGS  |
+-----+------------------+---------------+---------+-------+------------+--------+
|   4 | 2024-02-05-16-55 | dummy         | 16:55   | 16:57 | no         |        |
...

> timetrace edit record 2024-02-05-16-55
❗ failed to backup record before edit: record not found

The issue seems to be that the record file is still named 16-57 in the 2024-02-05 folder, so the edit command cannot find the file. Indeed if you try to edit using timetrace edit record 2024-02-05-16-57, you can still edit the record normally.

I see 2 possible solutions:

  1. after editing the record, rename the file to match the new record start time
  2. maintain the file name, and display it as the key of the record, which in the example above would look like the below (note the key and start times are no longer similar)
> timetrace list records today
+-----+------------------+---------------+---------+-------+------------+--------+
|  #  |       KEY        |    PROJECT    |  START  |  END  |  BILLABLE  |  TAGS  |
+-----+------------------+---------------+---------+-------+------------+--------+
|   4 | 2024-02-05-16-57 | dummy         | 16:55   | 16:57 | no         |        |
@pedroangelini pedroangelini changed the title [bug] Cannot edit a record that had it's initial timestamp edited [bug] Cannot edit a record that had its initial timestamp edited Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant