-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: progress on problems #36
Conversation
…ature/progress-on-problems
src/app/lib/actions.ts
Outdated
} | ||
} | ||
|
||
export async function getUserSolvedProblems( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
個人的な感覚なので変更するかはお任せしたいですが、dbアクセスするので get
より fetchUserSolvedProblems
のほうがしっくりくる気がしました
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed 7496165
@@ -36,6 +52,15 @@ const CoursePage: NextPage<{ params: { courseId: string } }> = ({ params }) => { | |||
const inputValue = event.target.value; | |||
setLanguageIdToSessionStorage(inputValue); | |||
setSelectedLanguageId(inputValue); | |||
getUserSolvedProblems(userId, courseId).then((data) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
この処理を handleSelectLanguage
内でやってるのて何か理由ありますか?
問題を正解してから科目一覧に戻ってきた時、言語を再選択しないと最新の進捗が表示されない気がします。useEffect内で動かすといいかもと思いました
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
最初 useEffect でやってたんですけど、連鎖で使うと renderしまくりでパフォーマンスがよくなくて。。
言語を再選択しないと最新の進捗が表示されない気がします。
これに対応しつつサーバーサイドでフェッチなどするようにして改善してみましたー
4b9d503
userId String | ||
courseId String | ||
programId String | ||
languageId String |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
programIdやcourseIdはハードコーディングしてるから、問題IDやコースIDの変更は基本できない(やる場合はUserSolvedProblemのレコードも更新する)のは気をつけないといけないですね・・・💡
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ですね! どこかでDBを使用するように改善する余地もあるかもしれません!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Close #33
Self Check
All checks have passed
on PR page. (You may leave this box unchecked due to long workflows.)WIP:
.yarn test
) is passed.yarn lint
) is passed.