Project

General

Profile

Actions

Defect #41819

closed

Time entry API returning `hours` as Rational instead of Float

Added by Łukasz Szczepański about 1 month ago. Updated 30 days ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
REST API
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

Before Redmine 6, the “hours” field returned data in double (float) format, like 0.25. Currently, Redmine 6 returns this field in weird fraction format 9/1 (as 9 hours).
This change wasn't stated in changelog. Is this an intentional change? It breaks integration that uses REST API from Redmine.

Response from Redmine 5.0.11:

{
      "id": 57818,
      "project": {
        "id": 120,
        "name": "Project Name" 
      },
      "issue": {
        "id": 50271
      },
      "user": {
        "id": 534,
        "name": "User Name" 
      },
      "activity": {
        "id": 27,
        "name": "Implementation" 
      },
      "hours": 0.25,
      "comments": "Comment",
      "spent_on": "2024-10-23",
      "created_on": "2024-10-23T08:03:14Z",
      "updated_on": "2024-10-23T08:03:14Z" 
    },

Response from Redmine 6.0.1
{
      "id": 153263,
      "project": {
        "id": 524,
        "name": "Project Name" 
      },
      "issue": {
        "id": 56753
      },
      "user": {
        "id": 636,
        "name": "User Name" 
      },
      "activity": {
        "id": 10,
        "name": "Implementation" 
      },
      "hours": "8/1",
      "comments": "",
      "spent_on": "2022-04-13",
      "created_on": "2022-04-27T10:55:22Z",
      "updated_on": "2022-04-27T10:55:22Z" 
    },


Files

41819.patch (2.84 KB) 41819.patch Go MAEDA, 2024-11-21 15:25

Related issues

Related to Redmine - Defect #40914: Fix precision issues in TimeEntry#hours calculation by returning Rational instead of FloatClosedGo MAEDA

Actions
Actions

Also available in: Atom PDF