SEBSERV-527
This commit is contained in:
		
							parent
							
								
									91212c65be
								
							
						
					
					
						commit
						4b675bc717
					
				
					 3 changed files with 44 additions and 6 deletions
				
			
		| 
						 | 
					@ -76,6 +76,11 @@ public class ExamConfigXMLParser extends DefaultHandler {
 | 
				
			||||||
            "whitelistURLFilter",
 | 
					            "whitelistURLFilter",
 | 
				
			||||||
            "URLFilterIgnoreList"));
 | 
					            "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(
 | 
					    private static final Set<String> VALUE_ELEMENTS = Utils.immutableSetOf(Arrays.asList(
 | 
				
			||||||
            Constants.XML_PLIST_BOOLEAN_FALSE,
 | 
					            Constants.XML_PLIST_BOOLEAN_FALSE,
 | 
				
			||||||
            Constants.XML_PLIST_BOOLEAN_TRUE,
 | 
					            Constants.XML_PLIST_BOOLEAN_TRUE,
 | 
				
			||||||
| 
						 | 
					@ -456,8 +461,7 @@ public class ExamConfigXMLParser extends DefaultHandler {
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            case INTEGER:
 | 
					            case INTEGER:
 | 
				
			||||||
            case RADIO_SELECTION:
 | 
					            case RADIO_SELECTION: {
 | 
				
			||||||
            case SINGLE_SELECTION: {
 | 
					 | 
				
			||||||
                try {
 | 
					                try {
 | 
				
			||||||
                    Integer.parseInt(value);
 | 
					                    Integer.parseInt(value);
 | 
				
			||||||
                    return value;
 | 
					                    return value;
 | 
				
			||||||
| 
						 | 
					@ -470,6 +474,33 @@ public class ExamConfigXMLParser extends DefaultHandler {
 | 
				
			||||||
                    return attribute.defaultValue;
 | 
					                    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: {
 | 
					            case DECIMAL: {
 | 
				
			||||||
                try {
 | 
					                try {
 | 
				
			||||||
                    Double.parseDouble(value);
 | 
					                    Double.parseDouble(value);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -90,9 +90,10 @@ public class RealNumberConverter implements AttributeValueConverter {
 | 
				
			||||||
            realVal = 0;
 | 
					            realVal = 0;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // NOTE: this is a special case for screenProctoringImageDownscale selector to get the selected real value
 | 
					        // NOTE: this is a special case for screenProctoringImageDownscale legacy data. See SEBSERV-527
 | 
				
			||||||
        //       from the selection-index instead using the index. See SEBSERV-527
 | 
					        // Legacy data do not affect production data but only testing data so far.
 | 
				
			||||||
        if ("screenProctoringImageDownscale".equals(attribute.name)) {
 | 
					        // TODO this can be removed after release of 2.0
 | 
				
			||||||
 | 
					        if ("screenProctoringImageDownscale".equals(attribute.name) && realVal > 2.0) {
 | 
				
			||||||
            realVal = realVal / 10.0 + 1.0;
 | 
					            realVal = realVal / 10.0 + 1.0;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -28,3 +28,9 @@ 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;
 | 
					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
 | 
					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';
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue