Patch #25526

Revert API change in spent_hours field in issue#show

Added by Holger Just 5 months ago. Updated 4 months ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:REST API
Target version:3.2.6

Description

When preloading the spent_hours of issues (as e.g. done for #20661, they default to 0 instead of the previous default 0.0. This results in a change of the issue#show API which now also returns an Integer instead of a Float. Previously (in Redmine 3.2), the API used to return the data the following way:

{
  "issue": {
    "id": 15,
    ...
    "spent_hours": 0.0,
    ...
  }
}

While later versions (including the current trunk) return them as follows:

{
  "issue": {
    "id": 15,
    ...
    "spent_hours": 0,
    ...
  }
}

This appears to break strict API clients which expect a float there. In our tests, this change appears to break the current Android version of RedminePM, probably due to some internal type exceptions. The attached patch was extracted from Planio and fixes this behavior. With it, we follow the previous behavior of always sending Floats.

0001-Always-set-spent_hours-instance-variables-to-a-Float.patch Magnifier (1.93 KB) Holger Just, 2017-04-05 15:28


Related issues

Related to Redmine - Patch #20661: Show visible spent time link for users allowed to view ti... Closed

Associated revisions

Revision 16491
Added by Jean-Philippe Lang 5 months ago

Always set spent_hours instance variables to a Float in Issue instances (#25526).

Patch by Holger Just.

Revision 16492
Added by Jean-Philippe Lang 5 months ago

Adds a test for #25526.

Revision 16510
Added by Jean-Philippe Lang 5 months ago

total_spent_hours not returned in 3.2 (#25526).

History

#1 Updated by Jean-Philippe Lang 5 months ago

  • Status changed from New to Closed
  • Assignee set to Jean-Philippe Lang

Patch committed with an API test, thanks.

#2 Updated by Jean-Philippe Lang 5 months ago

  • Related to Patch #20661: Show visible spent time link for users allowed to view time entries. added

#3 Updated by Go MAEDA 5 months ago

  • Target version set to 3.2.6

#4 Updated by Toshi MARUYAMA 4 months ago

  • Description updated (diff)

Also available in: Atom PDF