feat: add weekly goal setter widget to [SYS_TARGETS] card (#113)#233
feat: add weekly goal setter widget to [SYS_TARGETS] card (#113)#233manjiri27 wants to merge 1 commit into
Conversation
|
Thank you for submitting a pull request. Please ensure your changes comply with the project's contribution guidelines and that all workflow checks pass successfully. Formatting and Branching
|
|
Hey @jagdish-15, could you please review this when you get a chance? thank you |
jagdish-15
left a comment
There was a problem hiding this comment.
Sorry, it just slipped through my notifications. I've checked the implementation, and the progress bar isn't updating due to the following issue. Please apply the suggested change below.
Also, could you merge the latest main branch into your branch before pushing the changes?
| if (metric === "easy") return data.easySolved ?? 0; | ||
| if (metric === "medium") return data.mediumSolved ?? 0; | ||
| if (metric === "hard") return data.hardSolved ?? 0; | ||
| return data.totalSolved ?? 0; |
There was a problem hiding this comment.
| if (metric === "easy") return data.easySolved ?? 0; | |
| if (metric === "medium") return data.mediumSolved ?? 0; | |
| if (metric === "hard") return data.hardSolved ?? 0; | |
| return data.totalSolved ?? 0; | |
| var history = data.history; | |
| if (!Array.isArray(history) || history.length === 0) return 0; | |
| var latest = history[history.length - 1]; | |
| if (metric === "easy") return Number(latest.easy) || 0; | |
| if (metric === "medium") return Number(latest.medium) || 0; | |
| if (metric === "hard") return Number(latest.hard) || 0; | |
| return ( | |
| (Number(latest.easy) || 0) + | |
| (Number(latest.medium) || 0) + | |
| (Number(latest.hard) || 0) | |
| ); |
This API endpoint doesn't return the fields you're looking for. Use the following approach instead.
354df35 to
9646881
Compare
Description
Adds a weekly goal-setting widget to the [SYS_TARGETS] card on the user profile page. Users can set a weekly problem-solving target (by difficulty: Total / Easy / Medium / Hard), track their progress via a retro terminal-style progress bar, and reset their goal at any time. Goals persist across sessions via localStorage and auto-reset every Monday.
Linked Issue
Fixes #113
Changes Made
Populated the empty [SYS_TARGETS] card in frontend/user.html with goal setter UI (metric selector, number input, [SET] button)
Added progress display view showing [=====>..........] X% bar, current count, and a celebration message on goal completion
Created frontend/js/user/goal-setter.js to handle all goal logic: save/load/reset via localStorage, weekly auto-reset every Monday, live solved count fetched from /api/user/:username
Type of Change
Testing
Checklist
npx prettier --write .before submittingfeature/*branch, not themainbranchScreenshots / Screen Recording
Goal setter (no goal set):

Progress bar (after setting goal):
