Skip to content

feat: Add Interview Streak Tracking Feature (#625) - #1513

Open
Aasritha-sure wants to merge 1 commit into
Canopus-Labs:mainfrom
Aasritha-sure:issue-625
Open

feat: Add Interview Streak Tracking Feature (#625)#1513
Aasritha-sure wants to merge 1 commit into
Canopus-Labs:mainfrom
Aasritha-sure:issue-625

Conversation

@Aasritha-sure

@Aasritha-sure Aasritha-sure commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR introduces an Interview Streak Tracking feature to encourage users to practice consistently.

Changes Made

  • Added interview streak tracking.
  • Displays current streak and longest streak.
  • Resets streak after missed practice days.
  • Added milestone badges for 3, 7, and 30-day streaks.
  • Prevented duplicate streak increments on the same day.
  • Integrated streak information into the dashboard.
  • Added/updated tests covering streak calculations and badge unlocking.
  • Kept the implementation consistent with the existing project architecture.

Fixes #625

Looks good to me. Ready to merge.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

Thank you for your contribution!

To keep reviews manageable and maintain repository quality, contributors may have a maximum of 3 open Issues and 3 open Pull Requests at any given time.

Please wait until one of your existing submissions is reviewed or closed before opening additional ones.

If you believe this was closed by mistake, feel free to contact the maintainers.

@github-actions github-actions Bot added the rate-limited Closed automatically: contributor rate limit reached label Aug 7, 2026
@github-actions github-actions Bot closed this Aug 7, 2026
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 455a2693-f247-497e-ba23-d2963f35c116

📥 Commits

Reviewing files that changed from the base of the PR and between 945ed5e and 4172f3a.

⛔ Files ignored due to path filters (1)
  • backend/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (14)
  • backend/.env.example
  • backend/config/validateEnv.js
  • backend/controllers/googleCalendarController.js
  • backend/controllers/sessionController.js
  • backend/models/User.js
  • backend/package.json
  • backend/routes/googleCalendarRoutes.js
  • backend/server.js
  • backend/services/googleCalendarService.js
  • backend/tests/googleCalendarController.unit.test.js
  • backend/tests/interviewStreak.unit.test.js
  • backend/utils/interviewStreak.js
  • frontend/src/pages/Home/CreateSessionForm.jsx
  • frontend/src/pages/Home/Dashboard.jsx

📝 Walkthrough

Walkthrough

The PR adds interview streak tracking across session creation and the dashboard. It also adds optional Google Calendar OAuth, encrypted token storage, protected API routes, connection status reporting, and event synchronization.

Changes

Interview streak tracking

Layer / File(s) Summary
Streak calculation and validation
backend/utils/interviewStreak.js, backend/tests/interviewStreak.unit.test.js
Calculates consecutive and longest streaks, handles duplicate or invalid dates, and awards milestone badges.
Session persistence and response
backend/controllers/sessionController.js
Updates streak fields during session creation and returns a streakSummary. Missing users return HTTP 404.
Dashboard streak display
frontend/src/pages/Home/CreateSessionForm.jsx, frontend/src/pages/Home/Dashboard.jsx
Updates shared user state after session creation and displays streak totals and badges.

Google Calendar integration

Layer / File(s) Summary
OAuth configuration and credential storage
backend/.env.example, backend/config/validateEnv.js, backend/package.json, backend/models/User.js, backend/services/googleCalendarService.js
Adds optional OAuth configuration, Google API support, Calendar metadata fields, and AES-256-GCM token encryption.
OAuth and connection endpoints
backend/controllers/googleCalendarController.js, backend/routes/googleCalendarRoutes.js, backend/server.js, backend/tests/googleCalendarController.unit.test.js
Exposes connection, callback, status, and event-sync endpoints with authentication protection except for the OAuth callback.
Calendar event synchronization
backend/services/googleCalendarService.js, backend/controllers/googleCalendarController.js
Builds UTC event payloads, refreshes expired tokens, creates or updates events, records sync time, and returns validation or expiration errors.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant googleCalendarRoutes
  participant googleCalendarController
  participant googleCalendarService
  participant GoogleOAuth
  participant User
  Client->>googleCalendarRoutes: Request Calendar connection
  googleCalendarRoutes->>googleCalendarController: Call connectGoogleCalendar
  googleCalendarController->>googleCalendarService: Generate authorization URL
  googleCalendarService-->>Client: Return authorization URL
  Client->>GoogleOAuth: Approve Calendar access
  GoogleOAuth->>googleCalendarRoutes: Redirect with code and state
  googleCalendarRoutes->>googleCalendarController: Call handleGoogleCalendarCallback
  googleCalendarController->>googleCalendarService: Exchange authorization code
  googleCalendarService->>GoogleOAuth: Return OAuth tokens
  googleCalendarController->>User: Store encrypted tokens and metadata
Loading

Possibly related PRs

Suggested reviewers: karanunique

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.


const router = express.Router();

router.get("/connect", protect, connectGoogleCalendar);
const router = express.Router();

router.get("/connect", protect, connectGoogleCalendar);
router.get("/callback", handleGoogleCalendarCallback);

router.get("/connect", protect, connectGoogleCalendar);
router.get("/callback", handleGoogleCalendarCallback);
router.get("/status", protect, getGoogleCalendarStatus);
router.get("/connect", protect, connectGoogleCalendar);
router.get("/callback", handleGoogleCalendarCallback);
router.get("/status", protect, getGoogleCalendarStatus);
router.post("/events", protect, syncGoogleCalendarEvent);
router.get("/connect", protect, connectGoogleCalendar);
router.get("/callback", handleGoogleCalendarCallback);
router.get("/status", protect, getGoogleCalendarStatus);
router.post("/events", protect, syncGoogleCalendarEvent);
@KaranUnique KaranUnique reopened this Aug 7, 2026
@KaranUnique

Copy link
Copy Markdown
Contributor

@Aasritha-sure Please take look github actions suggestions, once it is addressed, I'll merge this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rate-limited Closed automatically: contributor rate limit reached

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TAdd Interview Streak Tracking Feature

3 participants