이수빈

test3

[{"C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\App.js":"1","C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\Home.js":"2","C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\test.js":"3","C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\index.js":"4"},{"size":450,"mtime":1606585705558,"results":"5","hashOfConfig":"6"},{"size":493,"mtime":1606590087333,"results":"7","hashOfConfig":"6"},{"size":2628,"mtime":1606613746724,"results":"8","hashOfConfig":"6"},{"size":238,"mtime":1606589880919,"results":"9","hashOfConfig":"6"},{"filePath":"10","messages":"11","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"pqxpq",{"filePath":"12","messages":"13","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"14","messages":"15","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"16","messages":"17","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\App.js",[],"C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\Home.js",[],"C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\test.js",[],"C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\index.js",[]]
\ No newline at end of file
[{"C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\App.js":"1","C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\Home.js":"2","C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\test.js":"3","C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\index.js":"4"},{"size":450,"mtime":1606585705558,"results":"5","hashOfConfig":"6"},{"size":493,"mtime":1606590087333,"results":"7","hashOfConfig":"6"},{"size":2796,"mtime":1606623443075,"results":"8","hashOfConfig":"6"},{"size":238,"mtime":1606589880919,"results":"9","hashOfConfig":"6"},{"filePath":"10","messages":"11","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"pqxpq",{"filePath":"12","messages":"13","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"14","messages":"15","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"16","messages":"17","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\App.js",[],"C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\Home.js",[],"C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\test.js",[],"C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\index.js",[]]
\ No newline at end of file
......
......@@ -45,40 +45,47 @@ const Test = ( { history } ) =>
const handleAnswerOptionClick = (isCorrect) => {
if (isCorrect) {
setScore_cool(score_c + 1); //c,c,w,w
handlePersonalScore(score_c,score_w);
}
else{
setScore_warm(score_w + 1);
setScore_warm(score_w + 1);
handlePersonalScore(score_c,score_w);
}
const nextQuestion = currentQuestion + 1;
if (nextQuestion < questions.length) {
setCurrentQuestion(nextQuestion); //0,0 -> 0,1 -> 1,2 -> 2,3
} else if(nextQuestion === questions.length){
if(score_c>score_w){
setPersonal('cool');
}
else if(score_c<score_w){
setPersonal('warm');
}
else{
setPersonal('restart');
}
isTrue = 1;
handlePersonalScore(score_c,score_w);
}
if(isTrue===1)
{
setShowScore(true);
else{
isTrue = 1;
if(isTrue===1)
{
setShowScore(true);
}
}
};
const handlePersonalScore = (score_c,score_w) => {
if(score_c>score_w){
setPersonal('cool');
}
else if(score_c<score_w){
setPersonal('warm');
}
else{
setPersonal('restart');
}
}
return (
<div className='app'>
{showScore ? (
<span className='score-section'>
You scored {currentQuestion}{questions.length}{score} out of {questions.length}
You scored {score_c}{score_w}{score} out of {questions.length}
</span>
) : (
<>
......