SEBSERV-527

This commit is contained in:
anhefti 2024-05-02 12:52:57 +02:00
parent 91212c65be
commit 4b675bc717
3 changed files with 44 additions and 6 deletions

View file

@ -76,6 +76,11 @@ public class ExamConfigXMLParser extends DefaultHandler {
"whitelistURLFilter",
"URLFilterIgnoreList"));
private static final Set<String> DECIMAL_TYPES = Utils.immutableSetOf(Arrays.asList(
"defaultPageZoomLevel",
"defaultTextZoomLevel",
"screenProctoringImageDownscale"));
private static final Set<String> VALUE_ELEMENTS = Utils.immutableSetOf(Arrays.asList(
Constants.XML_PLIST_BOOLEAN_FALSE,
Constants.XML_PLIST_BOOLEAN_TRUE,
@ -456,8 +461,7 @@ public class ExamConfigXMLParser extends DefaultHandler {
}
}
case INTEGER:
case RADIO_SELECTION:
case SINGLE_SELECTION: {
case RADIO_SELECTION: {
try {
Integer.parseInt(value);
return value;
@ -470,6 +474,33 @@ public class ExamConfigXMLParser extends DefaultHandler {
return attribute.defaultValue;
}
}
case SINGLE_SELECTION: {
if (DECIMAL_TYPES.contains(attribute.name)) {
try {
Double.parseDouble(value);
return value;
} catch (final Exception e) {
log.warn(
"Invalid attribute value detected. Name: {} type: {} value: {} : import with default value for this attribute",
attribute.name,
attribute.type,
value);
return attribute.defaultValue;
}
} else {
try {
Integer.parseInt(value);
return value;
} catch (final Exception e) {
log.warn(
"Invalid attribute value detected. Name: {} type: {} value: {} : import with default value for this attribute",
attribute.name,
attribute.type,
value);
return attribute.defaultValue;
}
}
}
case DECIMAL: {
try {
Double.parseDouble(value);

View file

@ -90,9 +90,10 @@ public class RealNumberConverter implements AttributeValueConverter {
realVal = 0;
}
// NOTE: this is a special case for screenProctoringImageDownscale selector to get the selected real value
// from the selection-index instead using the index. See SEBSERV-527
if ("screenProctoringImageDownscale".equals(attribute.name)) {
// NOTE: this is a special case for screenProctoringImageDownscale legacy data. See SEBSERV-527
// Legacy data do not affect production data but only testing data so far.
// TODO this can be removed after release of 2.0
if ("screenProctoringImageDownscale".equals(attribute.name) && realVal > 2.0) {
realVal = realVal / 10.0 + 1.0;
}

View file

@ -27,4 +27,10 @@ ADD COLUMN IF NOT EXISTS `client_configuration_id` BIGINT NULL;
-- ----------------------------------------------------------------
UPDATE orientation SET y_position=21 WHERE config_attribute_id=1578 AND template_id=0;
INSERT IGNORE INTO orientation (config_attribute_id, template_id, view_id, group_id, x_position, y_position, width, height, title) VALUES
(1201, 0, 9, 'clipboardPolicy', 7, 18, 5, 2, 'NONE');
(1201, 0, 9, 'clipboardPolicy', 7, 18, 5, 2, 'NONE');
-- ----------------------------------------------------------------
-- Fix SEBSERV-527
-- ----------------------------------------------------------------
UPDATE configuration_attribute SET resources='1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,2.0', default_value='1.0' WHERE name='screenProctoringImageDownscale';