Merge branch 'planned-Time'

main
manueltauber 2023-06-14 12:34:27 +02:00
commit 0b7b722ed5
2 changed files with 52 additions and 3 deletions

View File

@ -59,6 +59,8 @@ public class Change {
.addFieldId("ChangeImplementerPersonId", 610023232)
.addFieldId("PackageType", 670031016)
.addFieldId("Contract", 670031002)
.addFieldId("PlanTimeHours", 666000009)
.addFieldId("PlanTimeMinutes", 666000010)
.build();
}
@ -118,9 +120,17 @@ public class Change {
.filter(peopleFullName::equals)
.isPresent());
// var state = getValue(entry, "State").getIntValue();
// var inApproval = inApprovalList(api.getUser(), getValueStringByID(entry,
// "ChangeNr"));
/*
* var state = getValue(entry, "State").getIntValue();
* var inApproval = inApprovalList(api.getUser(), getValueStringByID(entry,
* "ChangeNr"));
*
* change.setFlagPermit(flagPermit(state));
* change.setFlagApprove(flagApproval(inApproval, state));
* change.setFlagReject(flagApproval(inApproval, state));
* change.setFlagCancel(flagCancel(getValueStringByID(entry, "SupportGroupId"),
* state));
*/
// change.setFlagPermit(flagPermit(state));
// change.setFlagApprove(flagApproval(inApproval, state));
@ -129,6 +139,11 @@ public class Change {
// state));
change.setPackageName(queryPackageName(getValueStringByID(entry, "PackageType").toString()));
var ptMinutes = getValueStringByID(entry, "PlanTimeMinutes").isEmpty() ? "00" : getValueStringByID(entry, "PlanTimeMinutes");
var ptHours = getValueStringByID(entry, "PlanTimeHours").isEmpty() ? "00" : getValueStringByID(entry, "PlanTimeHours");
change.setPlanTime(convertPlanTime(ptHours, ptMinutes));
change.setPackageName(queryPackageName(getValueStringByID(entry, "PackageType").toString()));
changes.add(change);
}
@ -173,6 +188,20 @@ public class Change {
return peopleInfos.get(0).get(queryPerson.getFieldId("FullName")).toString();
}
/**
* Converts the planned time which is passed in hours and minutes to total hours
*
* @param hours the hours as a String
* @param minutes the minutes as a String
* @return the hours and minutes as total hours
* @throws ARException
*/
public double convertPlanTime(String hours, String minutes) throws ARException {
double totalHours = Integer.valueOf(hours) + (Integer.valueOf(minutes) / 60.0);
return totalHours;
}
// #region approval flags
// /**
// * Determines if the change item can be approved based on the approval status
// * and the current state.
@ -251,6 +280,7 @@ public class Change {
// approversOI.get(0).get(queryApprovalList.getFieldId("Approvers")).toString();
// return approvers != null ? approvers.contains(user) : false;
// }
// #endregion
/**
* Queries and retrieves the package name based on the provided package type.

View File

@ -32,6 +32,7 @@ public class ChangeItem {
private Date D2;
private Date D3;
private Date D4;
private double planTime;
// private boolean flagPermit;
// private boolean flagApprove;
// private boolean flagReject;
@ -242,6 +243,24 @@ public class ChangeItem {
// this.flagCancel = flagCancel;
// }
/**
* Retrieves the planned time.
*
* @return the planned time
*/
public double getPlanTime() {
return this.planTime;
}
/**
* Sets the planned time.
*
* @param planTime the planned time to set
*/
public void setPlanTime(double planTime) {
this.planTime = planTime;
}
/**
* Retrieves the package name.
*