Kroro1208 / hojo-for-freelancer

フリーランスのために税金関連クイズアプリ開発中(Drizzle, NeonDB使用)
0 stars 0 forks source link

レッスン終了後の「次へ」を押すとおめでとうアクションが一瞬しか表示されないで次の問題に遷移してしまう #1

Open Kroro1208 opened 4 months ago

Kroro1208 commented 4 months ago

本来なら一度、/learnページへredirectして、レッスンボタンを押してから次のレッスンに進む

Kroro1208 commented 4 months ago

challengeの値を要確認

if(true || !challenge){ // trueを入れて確認してみると、画面が表示されてリダイレクトもされるのでchallengeの値を確認する必要がある
        return (
          <>
            {finishAudio}
            <Confetti width={width} height={height} recycle={false} numberOfPieces={500} tweenDuration={10000}/>
            <div className="flex flex-col gap-y-4 lg:gap-y-8 max-w-lg mx-auto text-center items-center justify-center h-full">
              <Image src="/star.gif" alt="finish" className="hidden lg:block" height={100} width={100} />
              <Image src="/star.gif" alt="finish" className="block lg:hidden" height={50} width={50} />
              <h1 className="text-xl lg:text-3xl font-bold text-neutral-700">
                よくできました!<br/>このレッスンは終了です!
              </h1>
              <div className="flex items-center gap-x-4 w-full">
                <ResultCard variant="points" value={challenges.length * 10}/>
                <ResultCard variant="hearts" value={hearts}/>
              </div>
            </div>
            <Footer lessonId={lessonId} status="completed" onCheck={() => router.push("/learn")}/>
          </>
        );
      }
Kroro1208 commented 4 months ago

全ての問題正解後もcompletedがtrueになっていない

スクリーンショット 2024-05-11 18 43 45
Kroro1208 commented 4 months ago

challgneProgress.tsxでinsertは正しく行われている

await db.insert(challengeProgress).values({
    challengeId,
    userId,
    completed: true
});
Kroro1208 commented 4 months ago

DBでも正解した問題は全てcompleted: trueになっていることが確認できる