diff --git a/JavaSource/org/unitime/timetable/action/SchedulingSubpartEditAction.java b/JavaSource/org/unitime/timetable/action/SchedulingSubpartEditAction.java index 6a4d05d685..efae4d8c2f 100644 --- a/JavaSource/org/unitime/timetable/action/SchedulingSubpartEditAction.java +++ b/JavaSource/org/unitime/timetable/action/SchedulingSubpartEditAction.java @@ -340,10 +340,10 @@ private void doLoad(SchedulingSubpart ss, String subpartId ) { form.setCreditType(credit.getCreditType().getUniqueId()); form.setCreditUnitType(credit.getCreditUnitType().getUniqueId()); if (credit instanceof FixedCreditUnitConfig){ - form.setUnits(((FixedCreditUnitConfig) credit).getFixedUnits()); + form.setUnits(float2string(((FixedCreditUnitConfig) credit).getFixedUnits())); } else if (credit instanceof VariableFixedCreditUnitConfig){ - form.setUnits(((VariableFixedCreditUnitConfig) credit).getMinUnits()); - form.setMaxUnits(((VariableFixedCreditUnitConfig) credit).getMaxUnits()); + form.setUnits(float2string(((VariableFixedCreditUnitConfig) credit).getMinUnits())); + form.setMaxUnits(float2string(((VariableFixedCreditUnitConfig) credit).getMaxUnits())); if (credit instanceof VariableRangeCreditUnitConfig){ form.setFractionalIncrementsAllowed(((VariableRangeCreditUnitConfig) credit).isFractionalIncrementsAllowed()); } @@ -444,18 +444,27 @@ private void doUpdate(SchedulingSubpart ss, SchedulingSubpartDAO sdao, boolean t CourseCreditUnitConfig origConfig = ss.getCredit(); ss.setCredit(null); sdao.getSession().remove(origConfig); - ss.setCredit(CourseCreditUnitConfig.createCreditUnitConfigOfFormat(form.getCreditFormat(), form.getCreditType(), form.getCreditUnitType(), form.getUnits(), form.getMaxUnits(), form.getFractionalIncrementsAllowed(), Boolean.valueOf(false))); + ss.setCredit(CourseCreditUnitConfig.createCreditUnitConfigOfFormat( + form.getCreditFormat(), form.getCreditType(), form.getCreditUnitType(), + string2float(form.getUnits()), string2float(form.getMaxUnits()), + form.getFractionalIncrementsAllowed(), Boolean.valueOf(false))); ss.getCredit().setOwner(ss); } } else { CourseCreditUnitConfig origConfig = ss.getCredit(); ss.setCredit(null); sdao.getSession().remove(origConfig); - ss.setCredit(CourseCreditUnitConfig.createCreditUnitConfigOfFormat(form.getCreditFormat(), form.getCreditType(), form.getCreditUnitType(), form.getUnits(), form.getMaxUnits(), form.getFractionalIncrementsAllowed(), Boolean.valueOf(false))); + ss.setCredit(CourseCreditUnitConfig.createCreditUnitConfigOfFormat( + form.getCreditFormat(), form.getCreditType(), form.getCreditUnitType(), + string2float(form.getUnits()), string2float(form.getMaxUnits()), + form.getFractionalIncrementsAllowed(), Boolean.valueOf(false))); ss.getCredit().setOwner(ss); } } else { - ss.setCredit(CourseCreditUnitConfig.createCreditUnitConfigOfFormat(form.getCreditFormat(), form.getCreditType(), form.getCreditUnitType(), form.getUnits(), form.getMaxUnits(), form.getFractionalIncrementsAllowed(), Boolean.valueOf(false))); + ss.setCredit(CourseCreditUnitConfig.createCreditUnitConfigOfFormat( + form.getCreditFormat(), form.getCreditType(), form.getCreditUnitType(), + string2float(form.getUnits()), string2float(form.getMaxUnits()), + form.getFractionalIncrementsAllowed(), Boolean.valueOf(false))); ss.getCredit().setOwner(ss); } } @@ -485,6 +494,19 @@ private void doUpdate(SchedulingSubpart ss, SchedulingSubpartDAO sdao, boolean t sdao.getSession().flush(); } + protected static Float string2float(String value) { + try { + return Float.valueOf(value); + } catch (Exception e) { + return 0f; + } + } + + protected static String float2string(Float value) { + if (value == null) return ""; + return value.toString(); + } + protected void setupChildren(SchedulingSubpart ss) { DatePattern selectedDatePattern = (form.getDatePattern() < 0 ? (ss.canInheritParentPreferences() ? ss.getParentSubpart().effectiveDatePattern() : ss.getSession().getDefaultDatePatternNotNull()) : DatePatternDAO.getInstance().get(form.getDatePattern())); try { diff --git a/WebContent/help/Release-Notes.xml b/WebContent/help/Release-Notes.xml index 35f5903a5c..b5f5ec7561 100644 --- a/WebContent/help/Release-Notes.xml +++ b/WebContent/help/Release-Notes.xml @@ -44,6 +44,13 @@ + + Edit Scheduling Subpart: Subpart Credit + + Max Units made editable when editing Variable Min/Max credit without the need to change the credit type first (when editing existing credit information). + Fixed an issue when no units or max units are provided (for a type that requires units/max units) or when the provided units are not a number. + + Course Timetabling Solver: Optimization diff --git a/WebContent/user/schedulingSubpartEdit.jsp b/WebContent/user/schedulingSubpartEdit.jsp index 5cf3def90a..b724783a6f 100644 --- a/WebContent/user/schedulingSubpartEdit.jsp +++ b/WebContent/user/schedulingSubpartEdit.jsp @@ -209,7 +209,7 @@ + disabled="%{form.creditFormat != 'variableRange' && form.creditFormat != 'variableMinMax'}"/>