Patch #25526

Updated by Toshi MARUYAMA 7 months ago

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:

<pre><code class="json"> &lt;pre&gt;
{
"issue": {
"id": 15,
...
"spent_hours": 0.0,
...
}
}
</code></pre> &lt;/pre&gt;

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

<pre><code class="json"> &lt;pre&gt;
{
"issue": {
"id": 15,
...
"spent_hours": 0,
...
}
}
</code></pre> &lt;/pre&gt;

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":https://plan.io/redmine-hosting and fixes this behavior. With it, we follow the previous behavior of always sending Floats.

Back