곰픽 JSON 채점기준표, 소스코드 수정

This commit is contained in:
2025-04-15 17:44:45 +09:00
parent 547cd05a8b
commit d03361bebf
7 changed files with 62 additions and 53 deletions

View File

@@ -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] = "확인필요";