fixed fetchplantimes

main
Said Gedik 2024-02-28 15:47:41 +01:00
parent bfd6f04c63
commit e7db977a63
1 changed files with 8 additions and 5 deletions

View File

@ -87,10 +87,10 @@ public class PlanTimes {
var minutes = change.get(queryChanges.getFieldId("PlanTimeMinutes")).toString(); var minutes = change.get(queryChanges.getFieldId("PlanTimeMinutes")).toString();
var hours = change.get(queryChanges.getFieldId("PlanTimeHours")).toString(); var hours = change.get(queryChanges.getFieldId("PlanTimeHours")).toString();
double plantime = convertPlanTime(hours, minutes); double plantime = convertPlanTime(hours, minutes);
System.out.println(plantime);
planTimePerWeek += plantime; planTimePerWeek += plantime;
} }
} }
System.out.println(planTimePerWeek);
week.setPlanTime((int) Math.ceil(planTimePerWeek)); week.setPlanTime((int) Math.ceil(planTimePerWeek));
} }
} catch (Exception e) { } catch (Exception e) {
@ -110,14 +110,17 @@ public class PlanTimes {
public double convertPlanTime(String hours, String minutes) throws ARException { public double convertPlanTime(String hours, String minutes) throws ARException {
double mins = 0.0; double mins = 0.0;
double hrs = 0.0; double hrs = 0.0;
if (minutes != null) if (minutes != null) {
mins = (Double.valueOf(minutes) / 60.0); mins = (Double.valueOf(minutes) / 60.0); // Convert minutes to hours
if (hours != null) }
Double.valueOf(hours); if (hours != null) {
hrs = Double.valueOf(hours); // Correctly assign the value to hrs
}
double totalHours = hrs + mins; double totalHours = hrs + mins;
return totalHours; return totalHours;
} }
/** /**
* Converts a timestamp string to a LocalDate object. * Converts a timestamp string to a LocalDate object.
* *