곰픽 일부 수정

This commit is contained in:
2025-03-24 17:24:25 +09:00
parent 6fe41f783e
commit b52d9b7dd9
3 changed files with 108 additions and 11 deletions

View File

@@ -435,7 +435,9 @@
},
"4": {
"type" : "multiValue",
"ele": "//Layer[Name[@value='Germs']]/Effects/Item/Name/@value | //Layer[Name[@value='Germs']]/Effects/Item/EffectData/amount/@value",
"ele": "//Layer[Name[@value='{layer}']]/Effects/Item/Name/@value | //Layer[Name[@value='{layer}']]/Effects/Item/EffectData/{option}/@value",
"layer" : "Germs",
"option" : "amount",
"value" : [
"12",
"선명하게"
@@ -446,7 +448,7 @@
"5": {
"ele": "none",
"point": 6,
"desc": "올가미 도구/이미지 제거 문항은 채점 불가"
"desc": "올가미 도구/이미지 문항은 채점 불가"
},
"6": {
"type" : "isExist",

View File

@@ -408,6 +408,89 @@
}
},
"4": {
"1": {
"type": "multi",
"ele": "//Document/Width/@value | //Document/Height/@value",
"value": [
"650",
"350"
],
"point": 5,
"desc": "캔버스 사이즈 650*350"
},
"2": {
"ele": "none",
"point": 5,
"desc": "자유 변형 문항은 채점 불가"
},
"3": {
"type" : "isExist",
"ele": "//Layer/Name/@value",
"value": "Tracking",
"point": 5,
"desc": "Tracking 레이어가 있는지 여부 체크"
},
"4": {
"type" : "multiValue",
"ele": "//Layer[Name[@value='{layer}']]/Effects/Item/Name/@value | //Layer[Name[@value='{layer}']]/Effects/Item/EffectData/{option}/@value",
"layer" : "Tracking",
"option" : "brightness",
"value" : [
"30",
"밝기/대비"
],
"point": 5,
"desc": "Tracking 레이어의 효과 체크"
},
"5": {
"ele": "none",
"point": 6,
"desc": "올가미 도구/이미지 문항은 채점 불가"
},
"6": {
"type" : "isExist",
"ele": "//Layer/Effects/Item/Name/@value",
"value" : "세피아",
"point": 6,
"desc": "세피아 효과가 있는지 여부 체크"
},
"7": {
"type": "exact",
"ele": "//Layer/Shapes/Shape/shape_type/@value",
"value": "ELLIPSE",
"point": 3,
"desc": "레이어 쉐이프 타입이 타원인지 체크"
},
"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",
"value": {
"width": 80,
"height": 80
},
"point": 3,
"desc": "레이어 쉐이프 X, Y 좌표를 가지고 너비, 높이 계산하여 정답 채점"
},
"9": {
"type": "color",
"ele": "//Layer//Shape[contains(draw_type/@value, 'Interior')]/secondary_color/@value",
"value": "999999",
"point": 6,
"desc": "색상 코드 비교 시 소문자로 입력할 것"
},
"10": {
"type" : "multiValue",
"ele": "//Layer/BlendOp/@value | //Layer/Opacity/@value",
"value" : [
"색 회피율",
"80"
],
"point": 5,
"desc": "혼합모드(색 회피율, 불투명도 : 80)"
}
},
"5": {
"1": {
"type": "multi",
"ele": "//Document/Width/@value | //Document/Height/@value",
@@ -434,7 +517,7 @@
},
"5": {
"ele": "//Layer[contains(Name/@value, 'Layer 3')]//shape_type/@value",
"answer": "ROUNDED_RECTANGLE",
"answer": "RECTANGLE",
"point": 6
},
"6": {
@@ -442,8 +525,8 @@
"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",
"value": {
"width": 370,
"height": 60
"width": 300,
"height": 50
},
"point": 3,
"desc": "레이어 쉐이프 X, Y 좌표를 가지고 너비, 높이 계산하여 정답 채점"

View File

@@ -24,6 +24,7 @@ function parseColorToHex(colorString) {
}
module.exports = getGpdpScore;
/**
* /Document/Layers/Layer/Shapes/Shape/draw_type 속성값
* > Interior: 내부 채우기 / Outline: 외곽선
@@ -35,8 +36,6 @@ module.exports = getGpdpScore;
* @returns
*/
// xml 형식의 GPDP 파일을 읽어서 점수를 계산
// scoring.json 파일 내에 있는 ele 요소는 xpath 형식으로 접근하여 요소를 탐색하고 나오는 값을 value와 비교하여 점수를 계산
// scoring.json 파일 내에 있는 type은 비교할 값의 타입을 의미하며, boolean, array 등이 있음
@@ -61,6 +60,12 @@ function getGpdpScore(gpdpData, scoringJson, index) {
let type = scoringData[key].type;
let search = scoringData[key].search;
const layer = scoringData[key].layer;
const option = scoringData[key].option;
ele = typeof ele === 'string' ? ele.replace(/{layer}/g, layer) : ele;
ele = typeof ele === 'string' ? ele.replace(/{option}/g, option) : ele;
if (search !== undefined) {
let result = findSimilarString(gpdpXmlDoc, search, 0.8)
// xpath 내부 "(큰따옴표) 필터링
@@ -73,6 +78,9 @@ function getGpdpScore(gpdpData, scoringJson, index) {
}
}
console.log(`example number: ${key}`)
console.log("🚀 ~ getGpdpScore ~ ele:", ele)
if (type == "multiValue") {
if (Array.isArray(rightAnswer)) {
@@ -108,16 +116,20 @@ function getGpdpScore(gpdpData, scoringJson, index) {
}
else if (type == "isExist" ) {
const result = xpath.select(ele, gpdpXmlDoc);
result.forEach((v, i) => {
const isMatch = result.some( v => {
if ( v.value === rightAnswer ) {
totalScore += point;
scoringResult[key] = point;
console.log("🚀 ~ result.forEach ~ 정답 일치:", rightAnswer)
return;
} else {
scoringResult[key] = 0;
return true;
}
return false;
});
if (!isMatch) {
scoringResult[key] = 0;
console.log("🚀 ~ result.forEach ~ 오답:", rightAnswer)
}
}
else if (type == "exact") {