fixed bugzilla time tracking

GitOrigin-RevId: 4ea7d8d0a8a1dd6c246837319f51063ff5aca40c
This commit is contained in:
Dmitry Avdeev
2019-10-07 13:03:29 +00:00
committed by intellij-monorepo-bot
parent 88f279ae7f
commit 6ffb2dc80f
2 changed files with 4 additions and 8 deletions
@@ -61,7 +61,7 @@ public abstract class TaskRepository {
*/
public static final int NATIVE_SEARCH = 0x0010;
public static final Pattern TIME_SPENT_PATTERN = Pattern.compile("([0-9]+)d ([0-9]+)h ([0-9]+)m");
public static final Pattern TIME_SPENT_PATTERN = Pattern.compile("([0-9]+)h ([0-9]+)m");
/**
* URL of the server to be used in requests. For more human-readable name of repository (e.g. some imaginary URL containing name of
@@ -30,12 +30,9 @@ public class BugzillaRepository extends BaseRepositoryImpl {
private static final Logger LOG = Logger.getInstance(BugzillaRepository.class);
// Copied from SendTimeTrackingInformationDialog
private Version myVersion;
private boolean myAuthenticated;
private String myAuthenticationToken;
private String myProductName = "";
private String myComponentName = "";
@@ -245,14 +242,13 @@ public class BugzillaRepository extends BaseRepositoryImpl {
task.getLastPost(), task.getTimeSpentFromLastPost(), timeSpent));
Matcher matcher = TIME_SPENT_PATTERN.matcher(timeSpent);
if (matcher.find()) {
int days = Integer.valueOf(matcher.group(1));
int hours = Integer.valueOf(matcher.group(2));
int minutes = Integer.valueOf(matcher.group(3));
int hours = Integer.valueOf(matcher.group(1));
int minutes = Integer.valueOf(matcher.group(2));
BugzillaXmlRpcRequest request = new BugzillaXmlRpcRequest("Bug.update")
.requireAuthentication(true)
.withParameter("ids", newVector(task.getId()))
// the number of hours worked on the bug as double
.withParameter("work_time", days * 24 + hours + minutes / 60.0);
.withParameter("work_time", hours + minutes / 60.0);
if (!StringUtil.isEmptyOrSpaces(comment)) {
request.withParameter("comment", newHashTable("body", comment, "is_private", false));
}