diff --git a/250415_DIC_0000A_채점결과.xlsx b/250415_DIC_0000A_채점결과.xlsx new file mode 100644 index 0000000..cbcecf6 Binary files /dev/null and b/250415_DIC_0000A_채점결과.xlsx differ diff --git a/250415_DIC_0000B_채점결과.xlsx b/250415_DIC_0000B_채점결과.xlsx new file mode 100644 index 0000000..f028de8 Binary files /dev/null and b/250415_DIC_0000B_채점결과.xlsx differ diff --git a/250415_DIC_0000C_채점결과.xlsx b/250415_DIC_0000C_채점결과.xlsx new file mode 100644 index 0000000..b92a8fd Binary files /dev/null and b/250415_DIC_0000C_채점결과.xlsx differ diff --git a/DIC_0000B.json b/DIC_0000B.json index d45bb2d..0033c55 100644 --- a/DIC_0000B.json +++ b/DIC_0000B.json @@ -662,7 +662,7 @@ "19": { "type": "color", "ele": "//Layer//Shape[contains(draw_type/@value, 'Outline')]/primary_color/@value", - "value": "40EEAB", + "value": "40eeab", "point": 3, "desc": "색상 코드 비교 시 소문자로 입력할 것(채우기:secondary_color, 외곽선:primary_color)" }, @@ -676,8 +676,8 @@ "angle": "//Layer//Shape[contains(draw_type/@value, 'Shadow')]/shadow_angle/@value" }, "value": { - "width": "5", - "distance": "3", + "width": "7", + "distance": "5", "blur": "1", "angle": "320" }, diff --git a/DIC_0000C.json b/DIC_0000C.json index b0f7ccb..155d77b 100644 --- a/DIC_0000C.json +++ b/DIC_0000C.json @@ -452,14 +452,14 @@ "desc": "자유 변형 문항은 채점 불가" }, "3": { - "type" : "isExist", + "type" : "exists", "ele": "//Layer/Name/@value", "value": "Leaf", "point": 5, "desc": "Leaf 레이어가 있는지 여부 체크" }, "4": { - "type" : "multiValue", + "type" : "effects", "ele": "//Layer[Name[@value='{layer}']]/Effects/Item", "layer" : "Leaf", "option" : "Lift", @@ -476,7 +476,7 @@ "desc": "올가미 도구/이미지 문항은 채점 불가" }, "6": { - "type" : "isExist", + "type" : "exists", "ele": "//Layer/Effects/Item/Name/@value", "value" : "세피아", "point": 6, @@ -491,11 +491,10 @@ }, "8": { "type": "size", - "posX": "//Layer//op_points[Item]/Item[last()]/X/@value - //Layer//op_points[Item]/Item[1]/X/@value", - "posY": "//Layer//op_points[Item]/Item[last()]/Y/@value - //Layer//op_points[Item]/Item[1]/Y/@value", + "ele": "//Layer//op_points", "value": { "width": 650, - "height": 80 + "height": 50 }, "point": 3, "desc": "레이어 쉐이프 X, Y 좌표를 가지고 너비, 높이 계산하여 정답 채점" @@ -545,7 +544,9 @@ "desc": "배경색 문항은 채점 불가" }, "3": { - "ele": "//Layer[contains(Name/@value, 'Layer 2')][MaskOpType/@value='Layering']", + "type": "exists", + "ele": "//Layer/MaskOpType/@value", + "value": "Layering", "point": 6 }, "4": { @@ -554,14 +555,14 @@ "desc": "가로방향 흐릿하게 문항은 채점 불가" }, "5": { - "ele": "//Layer[contains(Name/@value, 'Layer 3')]//shape_type/@value", - "answer": "RECTANGLE", + "type": "exists", + "ele": "//Layer//shape_type/@value", + "value": "ELLIPSE", "point": 3 }, "6": { "type": "size", - "posX": "//Layer[contains(Name/@value, 'Layer 3')]//op_points[Item]/Item[last()]/X/@value - //Layer[contains(Name/@value, 'Layer 3')]//op_points[Item]/Item[1]/X/@value", - "posY": "//Layer[contains(Name/@value, 'Layer 3')]//op_points[Item]/Item[last()]/Y/@value - //Layer[contains(Name/@value, 'Layer 3')]//op_points[Item]/Item[1]/Y/@value", + "ele": "//Layer//op_points", "value": { "width": 450, "height": 85 @@ -571,8 +572,9 @@ }, "7": { "type": "gradient", - "startColor": "//Layer[contains(Name/@value, 'Layer 3')]//gradient_start_color/@value", - "endColor": "//Layer[contains(Name/@value, 'Layer 3')]//gradient_end_color/@value", + "ele": "//Layer/Shapes/Shape", + "startColor": "gradient_start_color/@value", + "endColor": "gradient_end_color/@value", "value": { "startColor": "ffe000", "endColor": "995555" @@ -580,25 +582,26 @@ "point": 6 }, "8": { - "type": "exact", + "type": "exists", "ele": "//Layer//Shape[shape_type/@value='TEXT']/lines/Item/@value", "value": "예쁜 노란 꽃", "point": 5 }, "9": { - "type": "exact", + "type": "exists", "ele": "//Layer//Shape[shape_type/@value='TEXT']/font/Name/@value", "value": "맑은 고딕", "point": 3 }, "10": { - "type": "exact", - "ele": "//Layer//Shape[shape_type/@value='TEXT']/font/Underline/@value", + "type": "exists", + "ele": "//Layer//Shape[shape_type/@value='TEXT']/font/{style}/@value", + "style": "Underline", "value": "True", "point": 3 }, "11": { - "type": "exact", + "type": "exists", "ele": "//Layer//Shape[shape_type/@value='TEXT']/font/Size/@value", "value": "30", "point": 3 @@ -611,7 +614,7 @@ "desc": "색상 코드 비교 시 소문자로 입력할 것" }, "13": { - "type": "exact", + "type": "exists", "ele": "//Layer//Shape[shape_type/@value='TEXT']/outline_peninfo/Width/@value", "value": "7", "point": 3 @@ -624,19 +627,20 @@ "desc": "색상 코드 비교 시 소문자로 입력할 것" }, "15": { - "ele": "//Layer[MaskOpType/@value='Clipping'][last()]", + "type":"boolean", + "ele": "//Layer[MaskOpType/@value='Clipping']", "point": 6, "desc": "클리핑 마스크 항목은 별도 레이어로 추가되고 해당 속성을 추가해놓은 레이어가 있는지 여부 체크 함" }, "16": { - "ele": "//Layer[contains(Name/@value, 'Layer 3')]//shape_type/@value", + "type": "exists", + "ele": "//Layer/Shapes/Shape/shape_type/@value", "value": "ROUNDED_RECTANGLE", "point": 3 }, "17": { "type": "size", - "posX": "//Layer[contains(Name/@value, 'Layer 5')]//op_points[Item]/Item[last()]/X/@value - //Layer[contains(Name/@value, 'Layer 5')]//op_points[Item]/Item[1]/X/@value", - "posY": "//Layer[contains(Name/@value, 'Layer 5')]//op_points[Item]/Item[last()]/Y/@value - //Layer[contains(Name/@value, 'Layer 5')]//op_points[Item]/Item[1]/Y/@value", + "ele": "//Layer//op_points", "value": { "width": 120, "height": 150 @@ -645,13 +649,14 @@ "desc": "레이어 쉐이프 X, Y 좌표를 가지고 너비, 높이 계산하여 정답 채점" }, "18": { - "ele": "//Layer[contains(Name/@value, 'Layer 5')]//outline_peninfo/Width/@value", + "type": "exists", + "ele": "//Layer//outline_peninfo/Width/@value", "value": "5", "point": 3 }, "19": { "type": "color", - "ele": "//Layer//Shape[shape_type/@value='RECTANGLE'][contains(draw_type/@value, 'Outline')]/primary_color/@value", + "ele": "//Layer//Shape[contains(draw_type/@value, 'Outline')]/primary_color/@value", "value": "901651", "point": 3, "desc": "색상 코드 비교 시 소문자로 입력할 것(채우기:secondary_color, 외곽선:primary_color)" @@ -659,11 +664,11 @@ "20": { "type": "shadow", "ele": { - "shadow": "//Layer//Shape[shape_type/@value='RECTANGLE'][contains(draw_type/@value, 'Shadow')]", - "width": "//Layer//Shape[shape_type/@value='RECTANGLE'][contains(draw_type/@value, 'Shadow')]/shadow_width/@value", - "distance": "//Layer//Shape[shape_type/@value='RECTANGLE'][contains(draw_type/@value, 'Shadow')]/shadow_distance/@value", - "blur": "//Layer//Shape[shape_type/@value='RECTANGLE'][contains(draw_type/@value, 'Shadow')]/shadow_blur/@value", - "angle": "//Layer//Shape[shape_type/@value='RECTANGLE'][contains(draw_type/@value, 'Shadow')]/shadow_angle/@value" + "shadow": "//Layer//Shape[contains(draw_type/@value, 'Shadow')]", + "width": "//Layer//Shape[contains(draw_type/@value, 'Shadow')]/shadow_width/@value", + "distance": "//Layer//Shape[contains(draw_type/@value, 'Shadow')]/shadow_distance/@value", + "blur": "//Layer//Shape[contains(draw_type/@value, 'Shadow')]/shadow_blur/@value", + "angle": "//Layer//Shape[contains(draw_type/@value, 'Shadow')]/shadow_angle/@value" }, "value": { "width": "3", diff --git a/gpdpScoring.js b/gpdpScoring.js index 7df1d65..4c95ee4 100644 --- a/gpdpScoring.js +++ b/gpdpScoring.js @@ -143,16 +143,16 @@ function getGpdpScore(gpdpData, scoringJson, index) { if (type == "boolean") { const items = xpath.select(ele, gpdpXmlDoc); - // xpath 결과값을 반환하는 요소가 있을 경우 - if (items) { + // xpath 결과값을 반환하는 요소가 없을 경우 + if (!items) { + scoringResult[key] = 0; + console.log("❌ 찾는 요소 없음"); + } + else { totalScore += point; scoringResult[key] = point; console.log("✅ 찾는 요소 존재함"); } - else { - scoringResult[key] = 0; - console.log("❌ 찾는 요소 없음"); - } } // 이펙트 효과의 이름과 속성값을 비교 @@ -163,10 +163,9 @@ function getGpdpScore(gpdpData, scoringJson, index) { // 각 Item 요소별 이름과 속성값을 구하고 정답과 비교 for (const item of items) { const name = xpath.select1('Name/@value', item)?.value; - const value = xpath.select1(`EffectData/${option?.replace(/"/g, '')}/@value`, item)?.value; - const resultArray = [name, value]; + const attr = xpath.select1(`EffectData/${option?.replace(/"/g, '')}/@value`, item)?.value; - if (JSON.stringify(resultArray) === JSON.stringify(rightAnswer)) { + if (name === rightAnswer[0] && attr === rightAnswer[1]) { totalScore += point; scoringResult[key] = point; matched = true; @@ -369,7 +368,7 @@ function getGpdpScore(gpdpData, scoringJson, index) { // 그림자 속성이 있는지 여부 파악해서 그림자 속성 별로 점수 1 점씩 부여 else if (type == "shadow") { - let result = xpath.select(ele["shadow"], gpdpXmlDoc); + const result = xpath.select(ele["shadow"], gpdpXmlDoc); let shadowScore = 0; if (result.length == 0) { scoringResult[key] = 0; @@ -378,10 +377,10 @@ function getGpdpScore(gpdpData, scoringJson, index) { } shadowScore += 1; - let width = xpath.select(ele["width"], gpdpXmlDoc); - let distance = xpath.select(ele["distance"], gpdpXmlDoc); - let blur = xpath.select(ele["blur"], gpdpXmlDoc); - let angle = xpath.select(ele["angle"], gpdpXmlDoc); + const width = xpath.select(ele["width"], gpdpXmlDoc); + const distance = xpath.select(ele["distance"], gpdpXmlDoc); + const blur = xpath.select(ele["blur"], gpdpXmlDoc); + const angle = xpath.select(ele["angle"], gpdpXmlDoc); if (width.length !== 0 && width[0].value == rightAnswer["width"]) { shadowScore += 1; @@ -403,9 +402,9 @@ function getGpdpScore(gpdpData, scoringJson, index) { scoringResult[key] = shadowScore; } else { - let result = xpath.select(ele, gpdpXmlDoc); - let result2 = null; - let isCheck = false; + const result = xpath.select(ele, gpdpXmlDoc); + const result2 = null; + const isCheck = false; if (ele === 'none') { scoringResult[key] = "확인필요"; diff --git a/psdExport_2.js b/psdExport_2.js index 4ff182a..dd5a53a 100644 --- a/psdExport_2.js +++ b/psdExport_2.js @@ -14,8 +14,8 @@ const todayDate = getToday(); const examRound = '0000'; const examTypes = [ 'A', - // 'B', - // 'C', + 'B', + 'C', // 'D' ]; @@ -127,7 +127,12 @@ examTypes.forEach(type => { XLSX.writeFile(workbook, outputExcelFile); outputExcelFiles.push(outputExcelFile); }); -console.log('채점 결과가 ' + outputExcelFiles + ' 파일에 저장되었습니다.'); + +console.log('채점 결과'); +outputExcelFiles.forEach( (outputFile, index) => { + console.log(`[${index+1}] : ${outputFile}`); +}); + // xml 형식의 gmep 파일을 읽어서 점수를 계산 // scoring.json 파일 내에 있는 ele 요소는 xpath 형식으로 접근하여 요소를 탐색하고 나오는 값을 value와 비교하여 점수를 계산