곰픽 채점 알고리즘/채점기준표 수정
This commit is contained in:
@@ -53,12 +53,12 @@ function getGpdpScore(gpdpData, scoringJson, index) {
|
||||
layerList.forEach((layer, layerIndex) => {
|
||||
const childNodes = Array.from(layer.childNodes);
|
||||
childNodes.forEach(child => {
|
||||
console.log("🚀 ~ child node:", child);
|
||||
// console.log("🚀 ~ child node:", child);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// gpdp 필요한 데이터 필터링
|
||||
function getLayerData( gpdpXmlDoc ) {
|
||||
function getLayerData(gpdpXmlDoc) {
|
||||
/**
|
||||
* 3)레이어 마스크 여부
|
||||
* 도형
|
||||
@@ -79,7 +79,7 @@ function getGpdpScore(gpdpData, scoringJson, index) {
|
||||
* 18) 외곽선(두께 : 7.00px)
|
||||
* 19) 외곽선(색상 : 008878)
|
||||
* 20) 그림자(두께 : 5.00px, 거리 : 3.00px, 분산도 : 1px, 각도 : 320°)
|
||||
* */
|
||||
* */
|
||||
|
||||
|
||||
}
|
||||
@@ -115,9 +115,57 @@ function getGpdpScore(gpdpData, scoringJson, index) {
|
||||
console.log(`example number: ${key}`)
|
||||
console.log("🚀 ~ getGpdpScore ~ ele:", ele)
|
||||
|
||||
|
||||
// if (type == "effects") {
|
||||
// // Layer/Effects/Item요소를 가져옴
|
||||
// const items = xpath.select(ele, gpdpXmlDoc);
|
||||
|
||||
// // let isRight = false;
|
||||
// // 각 Item 요소별 이름과 속성값을 구하고 정답과 비교
|
||||
// items.forEach((item) => {
|
||||
// const name = xpath.select1('Name/@value', item)?.value;
|
||||
// const value = xpath.select1(`EffectData/${option?.replace(/"/g, '')}/@value`, item)?.value;
|
||||
// const resultArray = [name, value];
|
||||
// // if (isRight) return;
|
||||
// if (JSON.stringify(resultArray) === JSON.stringify(rightAnswer)) {
|
||||
// totalScore += point;
|
||||
// scoringResult[key] = point;
|
||||
// console.log("🚀 ~ 정답 일치:", rightAnswer);
|
||||
// // isRight = true;
|
||||
// return;
|
||||
// } else {
|
||||
// scoringResult[key] = 0;
|
||||
// console.log("🚀 ~ 오답:", rightAnswer);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
if (type == "multiValue") {
|
||||
// 이펙트 효과의 이름과 속성값을 비교
|
||||
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;
|
||||
matched = true;
|
||||
console.log("✅ 정답 일치:", rightAnswer);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!matched) {
|
||||
scoringResult[key] = 0;
|
||||
console.log("❌ 정답 없음:", rightAnswer);
|
||||
}
|
||||
}
|
||||
|
||||
else if (type == "multiValue") {
|
||||
if (Array.isArray(rightAnswer)) {
|
||||
const result = ele ? xpath.select(ele, gpdpXmlDoc) : [];
|
||||
const resultValues = Array.isArray(result) ? result.map(r => (typeof r === 'object' ? r.value : r)) : [result];
|
||||
@@ -149,10 +197,10 @@ function getGpdpScore(gpdpData, scoringJson, index) {
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (type == "isExist" ) {
|
||||
else if (type == "isExist") {
|
||||
const result = xpath.select(ele, gpdpXmlDoc);
|
||||
const isMatch = result.some( v => {
|
||||
if ( v.value === rightAnswer ) {
|
||||
const isMatch = result.some(v => {
|
||||
if (v.value === rightAnswer) {
|
||||
totalScore += point;
|
||||
scoringResult[key] = point;
|
||||
console.log("🚀 ~ result.forEach ~ 정답 일치:", rightAnswer)
|
||||
|
||||
Reference in New Issue
Block a user