diff --git a/250414_DIC_0000A_채점결과.xlsx b/250414_DIC_0000A_채점결과.xlsx new file mode 100644 index 0000000..bca8da1 Binary files /dev/null and b/250414_DIC_0000A_채점결과.xlsx differ diff --git a/DIC_0000A.json b/DIC_0000A.json index 3de8024..706cde3 100644 --- a/DIC_0000A.json +++ b/DIC_0000A.json @@ -452,7 +452,7 @@ "desc": "자유 변형 문항은 채점 불가" }, "3": { - "type": "isExist", + "type": "exists", "ele": "//Layer/Name/@value", "value": "Germs", "point": 5, @@ -476,7 +476,7 @@ "desc": "올가미 도구/이미지 문항은 채점 불가" }, "6": { - "type": "isExist", + "type": "exists", "ele": "//Layer/Effects/Item/Name/@value", "value": "세피아", "point": 6, @@ -509,7 +509,7 @@ "10": { "type" : "multiValue", "ele": "//Layer/BlendOp/@value | //Layer/Opacity/@value", - "value" : [ + "value": [ "중첩", "75" ], @@ -544,7 +544,7 @@ "desc": "배경색 문항은 채점 불가" }, "3": { - "type": "isExist", + "type": "exists", "ele": "//Layer/MaskOpType/@value", "value": "Layering", "point": 6 @@ -555,7 +555,7 @@ "desc": "가로방향 흐릿하게 문항은 채점 불가" }, "5": { - "type": "isExist", + "type": "exists", "ele": "//Layer//shape_type/@value", "value": "ROUNDED_RECTANGLE", "point": 3 @@ -582,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/Italic/@value", + "type": "exists", + "ele": "//Layer//Shape[shape_type/@value='TEXT']/font/{style}/@value", + "style": "Italic", "value": "True", "point": 3 }, "11": { - "type": "exact", + "type": "exists", "ele": "//Layer//Shape[shape_type/@value='TEXT']/font/Size/@value", "value": "32", "point": 3 @@ -613,7 +614,7 @@ "desc": "색상 코드 비교 시 소문자로 입력할 것" }, "13": { - "type": "exact", + "type": "exists", "ele": "//Layer//Shape[shape_type/@value='TEXT']/outline_peninfo/Width/@value", "value": "3", "point": 3 @@ -626,12 +627,14 @@ "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 5')]//shape_type/@value", + "type": "exists", + "ele": "//Layer/Shapes/Shape/shape_type/@value", "value": "RECTANGLE", "point": 3 }, @@ -646,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": "7", "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": "008878", "point": 3, "desc": "색상 코드 비교 시 소문자로 입력할 것(채우기:secondary_color, 외곽선:primary_color)" @@ -660,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": "5", diff --git a/DIC_0000B.json b/DIC_0000B.json index f132521..d45bb2d 100644 --- a/DIC_0000B.json +++ b/DIC_0000B.json @@ -251,7 +251,10 @@ "ele2": "sum(//CRTrackList[@Name='텍스트' or @Name='비디오2']/CRTrackClip[not(@ClipIndex='-1')][@ClipIndex={clipIndex}]/preceding-sibling::CRTrackClip/@Length)", "search": "숲 속으로 떠나는 여행", "type": "videoIsExist", - "value": [179, 180], + "value": [ + 179, + 180 + ], "point": 2, "desc": "출제 오류로 인해 두 가지 정답 모두 인정" }, @@ -454,7 +457,7 @@ "desc": "자유 변형 문항은 채점 불가" }, "3": { - "type": "isExist", + "type": "exists", "ele": "//Layer/Name/@value", "value": "Tracking", "point": 5, @@ -478,7 +481,7 @@ "desc": "올가미 도구/이미지 문항은 채점 불가" }, "6": { - "type": "isExist", + "type": "exists", "ele": "//Layer/Effects/Item/Name/@value", "value": "세피아", "point": 6, @@ -493,8 +496,7 @@ }, "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": 80, "height": 80 @@ -547,7 +549,9 @@ "desc": "배경색 문항은 채점 불가" }, "3": { - "ele": "//Layer[contains(Name/@value, 'Layer 2')][MaskOpType/@value='Layering']", + "type": "exists", + "ele": "//Layer/MaskOpType/@value", + "value": "Layering", "point": 6 }, "4": { @@ -556,14 +560,14 @@ "desc": "가로방향 흐릿하게 문항은 채점 불가" }, "5": { - "ele": "//Layer[contains(Name/@value, 'Layer 3')]//shape_type/@value", - "answer": "RECTANGLE", + "type": "exists", + "ele": "//Layer//shape_type/@value", + "value": "RECTANGLE", "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": 300, "height": 50 @@ -573,8 +577,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": "fff000", "endColor": "009998" @@ -582,25 +587,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/Bold/@value", + "type": "exists", + "ele": "//Layer//Shape[shape_type/@value='TEXT']/font/{style}/@value", + "style": "Bold", "value": "True", "point": 3 }, "11": { - "type": "exact", + "type": "exists", "ele": "//Layer//Shape[shape_type/@value='TEXT']/font/Size/@value", "value": "24", "point": 3 @@ -613,7 +619,7 @@ "desc": "색상 코드 비교 시 소문자로 입력할 것" }, "13": { - "type": "exact", + "type": "exists", "ele": "//Layer//Shape[shape_type/@value='TEXT']/outline_peninfo/Width/@value", "value": "5", "point": 3 @@ -626,19 +632,20 @@ "desc": "색상 코드 비교 시 소문자로 입력할 것" }, "15": { + "type": "boolean", "ele": "//Layer[MaskOpType/@value='Clipping'][last()]", "point": 6, "desc": "클리핑 마스크 항목은 별도 레이어로 추가되고 해당 속성을 추가해놓은 레이어가 있는지 여부 체크 함" }, "16": { - "ele": "//Layer[contains(Name/@value, 'Layer 5')]//shape_type/@value", + "type": "exists", + "ele": "//Layer/Shapes/Shape/shape_type/@value", "value": "ELLIPSE", "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": 150, "height": 150 @@ -647,13 +654,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": "3", "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": "40EEAB", "point": 3, "desc": "색상 코드 비교 시 소문자로 입력할 것(채우기:secondary_color, 외곽선:primary_color)" @@ -661,11 +669,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": "5", diff --git a/gpdpScoring.js b/gpdpScoring.js index 05e6cd5..7df1d65 100644 --- a/gpdpScoring.js +++ b/gpdpScoring.js @@ -97,9 +97,11 @@ function getGpdpScore(gpdpData, scoringJson, index) { const layer = scoringData[key].layer; const option = scoringData[key].option; + const style = scoringData[key].style; ele = typeof ele === 'string' ? ele.replace(/{layer}/g, layer) : ele; ele = typeof ele === 'string' ? ele.replace(/{option}/g, option) : ele; + ele = typeof ele === 'string' ? ele.replace(/{style}/g, style) : ele; if (search !== undefined) { let result = findSimilarString(gpdpXmlDoc, search, 0.8) @@ -118,7 +120,7 @@ function getGpdpScore(gpdpData, scoringJson, index) { // if (type == "effects") { // // Layer/Effects/Item요소를 가져옴 // const items = xpath.select(ele, gpdpXmlDoc); - + // // let isRight = false; // // 각 Item 요소별 이름과 속성값을 구하고 정답과 비교 // items.forEach((item) => { @@ -138,19 +140,32 @@ function getGpdpScore(gpdpData, scoringJson, index) { // } // }); // } + if (type == "boolean") { + const items = xpath.select(ele, gpdpXmlDoc); + + // xpath 결과값을 반환하는 요소가 있을 경우 + if (items) { + totalScore += point; + scoringResult[key] = point; + console.log("✅ 찾는 요소 존재함"); + } + else { + scoringResult[key] = 0; + console.log("❌ 찾는 요소 없음"); + } + } // 이펙트 효과의 이름과 속성값을 비교 - if (type == "effects") { + else if (type == "effects") { const items = xpath.select(ele, gpdpXmlDoc); let matched = false; - - + // 각 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]; - + if (JSON.stringify(resultArray) === JSON.stringify(rightAnswer)) { totalScore += point; scoringResult[key] = point; @@ -159,7 +174,7 @@ function getGpdpScore(gpdpData, scoringJson, index) { break; } } - + if (!matched) { scoringResult[key] = 0; console.log("❌ 정답 없음:", rightAnswer); @@ -198,13 +213,13 @@ function getGpdpScore(gpdpData, scoringJson, index) { } } } - else if (type == "isExist") { + else if (type == "exists") { const result = xpath.select(ele, gpdpXmlDoc); const isMatch = result.some(v => { if (v.value === rightAnswer) { totalScore += point; scoringResult[key] = point; - console.log("🚀 ~ result.forEach ~ 정답 일치:", rightAnswer) + console.log(`✅ 정답 일치 > [작성답안]:${v.value} [정답]:${rightAnswer}`); return true; } return false; @@ -212,7 +227,7 @@ function getGpdpScore(gpdpData, scoringJson, index) { if (!isMatch) { scoringResult[key] = 0; - console.log("🚀 ~ result.forEach ~ 오답:", rightAnswer) + console.log(`❌ 정답 없음 > [정답]:${rightAnswer}`); } } @@ -231,24 +246,29 @@ function getGpdpScore(gpdpData, scoringJson, index) { console.log('ele not matched, ' + result[0].value); } } - else if (type == "color") { - let result = xpath.select(ele, gpdpXmlDoc); - if (result.length == 0) { - scoringResult[key] = 0; - console.log('ele not found'); - continue; - } - const hexColor = parseColorToHex(result[0].value); - if (hexColor === rightAnswer) { - totalScore += point; - scoringResult[key] = point; - console.log('color matched, ' + hexColor); - } else { + else if (type === "color") { + const items = xpath.select(ele, gpdpXmlDoc); + let matched = false; + + for (const item of items) { + const color = parseColorToHex(item.value); + // console.log("🚀 ~ getGpdpScore ~ color:", color); + // console.log("🚀 ~ getGpdpScore ~ rightColor:", rightAnswer); + if (color === rightAnswer) { + totalScore += point; + scoringResult[key] = point; + matched = true; + console.log(`✅ 정답 일치 > [작성답안]:${color} [정답]:${rightAnswer}`); + break; + } + } + if (!matched) { scoringResult[key] = 0; - console.log('color not matched, ' + hexColor); + console.log(`❌ 정답 없음 > [정답]:${rightAnswer}`); } } + else if (type == "multi") { try { const result = xpath.select(ele, gpdpXmlDoc); @@ -308,7 +328,7 @@ function getGpdpScore(gpdpData, scoringJson, index) { const width = Math.round(Math.abs(x2 - x1)); const height = Math.round(Math.abs(y2 - y1)); - if ( width === rightAnswer["width"] && height === rightAnswer["height"]) { + if (width === rightAnswer["width"] && height === rightAnswer["height"]) { totalScore += point; scoringResult[key] = point; matched = true; @@ -327,13 +347,13 @@ function getGpdpScore(gpdpData, scoringJson, index) { const endColorXpath = scoringData[key].endColor; let matched = false; - for ( const item of items) { + for (const item of items) { const startColor = parseColorToHex(xpath.select1(startColorXpath, item)?.value); const endColor = parseColorToHex(xpath.select1(endColorXpath, item)?.value); console.log(startColor + ":" + rightAnswer["startColor"], endColor + ":" + rightAnswer["endColor"]); - if ( startColor === rightAnswer["startColor"] && endColor === rightAnswer["endColor"]) { + if (startColor === rightAnswer["startColor"] && endColor === rightAnswer["endColor"]) { totalScore += point; scoringResult[key] = point; matched = true; diff --git a/z.xbook b/z.xbook index b336228..41d66b1 100644 --- a/z.xbook +++ b/z.xbook @@ -1 +1 @@ -[{"kind":2,"language":"xpath","value":"//Layer[Name[@value='Tracking']]/Effects/Item/Name/@value"},{"kind":2,"language":"xpath","value":"//Layer/Shapes/Shape[*[starts-with(name(), 'gradient')]]"},{"kind":2,"language":"xpath","value":"//Layer/Shapes/Shape"}] \ No newline at end of file +[{"kind":2,"language":"xpath","value":"//Layer[Name[@value='Tracking']]/Effects/Item/Name/@value"},{"kind":2,"language":"xpath","value":"//Layer/Shapes/Shape[*[starts-with(name(), 'gradient')]]"},{"kind":2,"language":"xpath","value":"//Layer/Shapes/Shape/shape_type/@value"}] \ No newline at end of file diff --git a/회차별채점자료/0000/excel_채점기준표/DIC_0000A.xlsx b/회차별채점자료/0000/excel_채점기준표/DIC_0000A.xlsx index 571c6b5..1bd2874 100644 Binary files a/회차별채점자료/0000/excel_채점기준표/DIC_0000A.xlsx and b/회차별채점자료/0000/excel_채점기준표/DIC_0000A.xlsx differ