@@ -340,10 +340,10 @@ private void doLoad(SchedulingSubpart ss, String subpartId ) {
340
340
form .setCreditType (credit .getCreditType ().getUniqueId ());
341
341
form .setCreditUnitType (credit .getCreditUnitType ().getUniqueId ());
342
342
if (credit instanceof FixedCreditUnitConfig ){
343
- form .setUnits ((( FixedCreditUnitConfig ) credit ).getFixedUnits ());
343
+ form .setUnits (float2string ((( FixedCreditUnitConfig ) credit ).getFixedUnits () ));
344
344
} else if (credit instanceof VariableFixedCreditUnitConfig ){
345
- form .setUnits ((( VariableFixedCreditUnitConfig ) credit ).getMinUnits ());
346
- form .setMaxUnits ((( VariableFixedCreditUnitConfig ) credit ).getMaxUnits ());
345
+ form .setUnits (float2string ((( VariableFixedCreditUnitConfig ) credit ).getMinUnits () ));
346
+ form .setMaxUnits (float2string ((( VariableFixedCreditUnitConfig ) credit ).getMaxUnits () ));
347
347
if (credit instanceof VariableRangeCreditUnitConfig ){
348
348
form .setFractionalIncrementsAllowed (((VariableRangeCreditUnitConfig ) credit ).isFractionalIncrementsAllowed ());
349
349
}
@@ -444,18 +444,27 @@ private void doUpdate(SchedulingSubpart ss, SchedulingSubpartDAO sdao, boolean t
444
444
CourseCreditUnitConfig origConfig = ss .getCredit ();
445
445
ss .setCredit (null );
446
446
sdao .getSession ().remove (origConfig );
447
- ss .setCredit (CourseCreditUnitConfig .createCreditUnitConfigOfFormat (form .getCreditFormat (), form .getCreditType (), form .getCreditUnitType (), form .getUnits (), form .getMaxUnits (), form .getFractionalIncrementsAllowed (), Boolean .valueOf (false )));
447
+ ss .setCredit (CourseCreditUnitConfig .createCreditUnitConfigOfFormat (
448
+ form .getCreditFormat (), form .getCreditType (), form .getCreditUnitType (),
449
+ string2float (form .getUnits ()), string2float (form .getMaxUnits ()),
450
+ form .getFractionalIncrementsAllowed (), Boolean .valueOf (false )));
448
451
ss .getCredit ().setOwner (ss );
449
452
}
450
453
} else {
451
454
CourseCreditUnitConfig origConfig = ss .getCredit ();
452
455
ss .setCredit (null );
453
456
sdao .getSession ().remove (origConfig );
454
- ss .setCredit (CourseCreditUnitConfig .createCreditUnitConfigOfFormat (form .getCreditFormat (), form .getCreditType (), form .getCreditUnitType (), form .getUnits (), form .getMaxUnits (), form .getFractionalIncrementsAllowed (), Boolean .valueOf (false )));
457
+ ss .setCredit (CourseCreditUnitConfig .createCreditUnitConfigOfFormat (
458
+ form .getCreditFormat (), form .getCreditType (), form .getCreditUnitType (),
459
+ string2float (form .getUnits ()), string2float (form .getMaxUnits ()),
460
+ form .getFractionalIncrementsAllowed (), Boolean .valueOf (false )));
455
461
ss .getCredit ().setOwner (ss );
456
462
}
457
463
} else {
458
- ss .setCredit (CourseCreditUnitConfig .createCreditUnitConfigOfFormat (form .getCreditFormat (), form .getCreditType (), form .getCreditUnitType (), form .getUnits (), form .getMaxUnits (), form .getFractionalIncrementsAllowed (), Boolean .valueOf (false )));
464
+ ss .setCredit (CourseCreditUnitConfig .createCreditUnitConfigOfFormat (
465
+ form .getCreditFormat (), form .getCreditType (), form .getCreditUnitType (),
466
+ string2float (form .getUnits ()), string2float (form .getMaxUnits ()),
467
+ form .getFractionalIncrementsAllowed (), Boolean .valueOf (false )));
459
468
ss .getCredit ().setOwner (ss );
460
469
}
461
470
}
@@ -485,6 +494,19 @@ private void doUpdate(SchedulingSubpart ss, SchedulingSubpartDAO sdao, boolean t
485
494
sdao .getSession ().flush ();
486
495
}
487
496
497
+ protected static Float string2float (String value ) {
498
+ try {
499
+ return Float .valueOf (value );
500
+ } catch (Exception e ) {
501
+ return 0f ;
502
+ }
503
+ }
504
+
505
+ protected static String float2string (Float value ) {
506
+ if (value == null ) return "" ;
507
+ return value .toString ();
508
+ }
509
+
488
510
protected void setupChildren (SchedulingSubpart ss ) {
489
511
DatePattern selectedDatePattern = (form .getDatePattern () < 0 ? (ss .canInheritParentPreferences () ? ss .getParentSubpart ().effectiveDatePattern () : ss .getSession ().getDefaultDatePatternNotNull ()) : DatePatternDAO .getInstance ().get (form .getDatePattern ()));
490
512
try {
0 commit comments