Redmine:使用API​​的错误问题内容

时间:2017-06-08 15:55:10

标签: ruby-on-rails redmine redmine-plugins redmine-api

更新Redmine问题后,我们将使用API​​获取新数据。在某些情况下,我们不会获取正确的数据:更新的数据不会出现在结果中。可能有什么不对?

为了详细解释,我们正在使用自定义Redmine插件在更新问题时调用远程Web服务。

Issue.after_update do |obj|
    logger.info "####REF OBJ :#{obj.inspect}"
    logger.info "####REF DB  :#{Issue.find(obj.id).inspect}"
    client.updated_ticket_event_request(obj)
end

我们确切的Redmine环境是Redmine版本2.6.1.stable,Ruby版本2.0.0-p648(2015-12-16),Rails版本3.2.22.2。 远程Web服务是一个Java应用程序,它使用Java Redmine API(https://github.com/taskadapter/redmine-java-api)获取更新的问题。

final Issue redmineIssue = fetchIssue(context, id, includes ); // RedmineManager.getIssueManager().getIssueById(id, includes)
final Ticket ticket = buildTicket(context, redmineIssue); // Building our own object
LOGGER.debug("Fetched ticket: "+ticket);

现在,在以下日志中,请注意受让人标识符。

在Redmine日志中:

####REF OBJ :#<Issue id: 5510, tracker_id: 5, project_id: 27, subject: "TEST08", description: "desc test 08", due_date: nil, category_id: nil, status_id: 1, assigned_to_id: 176, priority_id: 2, fixed_version_id: nil, author_id: 1, lock_version: 2, created_on: "2017-06-08 14:47:19", updated_on: "2017-06-08 14:48:21", start_date: nil, done_ratio: 0, estimated_hours: nil, parent_id: nil, root_id: 5510, lft: 10165, rgt: 10166, is_private: false, closed_on: nil, sprint_id: nil, position: 4764>
####REF DB  :#<Issue id: 5510, tracker_id: 5, project_id: 27, subject: "TEST08", description: "desc test 08", due_date: nil, category_id: nil, status_id: 1, assigned_to_id: 176, priority_id: 2, fixed_version_id: nil, author_id: 1, lock_version: 2, created_on: "2017-06-08 14:47:19", updated_on: "2017-06-08 14:48:21", start_date: nil, done_ratio: 0, estimated_hours: nil, parent_id: nil, root_id: 5510, lft: 10165, rgt: 10166, is_private: false, closed_on: nil, sprint_id: nil, position: 4764>

在Java应用程序日志中:

16:48:21.591 DEBUG Fetched ticket: [Ticket - Id = 5510 - Title = TEST08 - Description = desc test 08 - Assignees = PersonId{110} - Priority = 2 - Creator = 1 - Creation date = 2017-06-08T14:47:19Z]

虽然在Redmine数据库中我们确实有受让人= 176,但是通过网络服务API我们得到了受让人= 110,这是更新前的值。 第二次获得该问题,我们得到了该分配的正确值。

行为并不总是可重复的。大多数时候,我们都有正确的行为。

0 个答案:

没有答案