Skip to content

timestat back and forth is weird #114

@sductor

Description

@sductor

Hi,

First thank you for the work.
My issue is that I find the behavior of a certain function weird.
But maybe this is not a problem with the code but I didn't unerstand how I am supposed to use it.
Here the faulty code:

iapi = new GitLabApi(…).createIssue(26, "test", "yo");
val issue = iapi.createIssue(26, "test", "yo");
iapi.estimateTime(issue.getProjectId(), issue.getIid(), "3mo 2w");

At this point an issue is created but it displays an estimated time of 5 months!

Then

println(org.gitlab4j.api.models.Duration(api.getTimeTrackingStats(issue.getProjectId(), issue.getIid()).getTimeEstimate())))

display 1mo3d8h

Thus I finnd the utilisation really not intuitive
It appears to me that the problem come from the fact that you are using real time value whereas gitlab use a day = 8h etc. But as this is an api for gitlab, I found a pity that you does not use the same standard as gitlab. I imagine that I would have to do a adapter that would go back and forth between your standard and the one of gitlab. But I think this is also a pity since you already ave those variables
as the two first lines of DurationUtils but that are private.

I feel that the project would benefit to:

  • adding a second TIME_UNIT_MULTIPLIERS that would meet with gitlab
  • use a singleton pattern for accessing to DurationUtil rather than using the plain class
  • Parameterize this singleton to choose which unit multiplier it should uses
  • Allow to define this parameter (set) in the class Duration

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions