Redmine Logbook update
We need a new devops command named logbook
that uses these CLI options:
-
--top-project-id
(optional) which should limit the scope of projects to iterate through. When not set, default to listing ALL projects available -
--redmine-api-url
with env var support -
--redmine-api-token
with env var support
The workflow would be :
- iterate over projects:
- by default all projects available
- if
--top-project-id
is set, limit to all projects under that one
- for a project
- get or create the
LogBook
wiki page (using https://python-redmine.com/resources/wiki_page.html ) - find the first H2 title (level 2) that parses as a date under format
DD/MM/YYYY
- if no date is available, iterate over ALL time entries (using https://python-redmine.com/resources/time_entry.html#filter)
- otherwise limit to the ones after that date
- filter out all time entries without a comment a comment set
- build a markdown list for each day with the actions of that day:
# LogBook
## {DAY 2}
- ({user}): {comment} [[link](https://redmine.teklia.com/issues/xxxx)]
## {DAY 1}
- ({user}): {comment} [[link](https://redmine.teklia.com/issues/xxxx)]
...
Example iteration on time entries
>>> for x in redmine.time_entry.filter(project_id='projectA'):
... print(f"[{x.spent_on}] {x.user.name} : {x.hours} h => {x.comments or 'no comment'}")
...
[2024-02-20] Yoann Schneider : 0.5 h => do that
[2024-02-20] Eva Bardou : 2.0 h => do something else
[2024-02-19] Eva Bardou : 0.5 h => do this
[2024-02-19] Eva Bardou : 0.5 h => do this
[2024-02-16] Eva Bardou : 0.5 h => no comment