Skip to content

Fix: shadowed currentstreak - #1457

Merged
JiyaBatra merged 7 commits into
JiyaBatra:mainfrom
Saubhagya1621:fix/1451-shadowed-currentstreak
Aug 10, 2026
Merged

Fix: shadowed currentstreak#1457
JiyaBatra merged 7 commits into
JiyaBatra:mainfrom
Saubhagya1621:fix/1451-shadowed-currentstreak

Conversation

@Saubhagya1621

Copy link
Copy Markdown
Contributor

🛠️ Related Issue

Closes: #1451

📌 Description

Fixes a variable-shadowing bug in completeLesson where the streak used to calculate the XP multiplier was different from the streak actually persisted to the database. This could cause a user's XP bonus to be based on one streak value while their saved/displayed currentStreak reflected a different one.

✨ Changes Made

  • Removed the inner const currentStreak = getLearningStreak(events) block that shadowed the outer, already-computed currentStreak (date-diff based).
  • XP multiplier now reuses the single outer currentStreak, so the reward and the persisted streak can no longer diverge.
  • No other logic, routes, or behavior changed — kept the diff minimal.

📷 Screenshots

N/A - backend logic fix, no UI change

🧪 Type of Change

  • Bug fix
  • New feature
  • UI/UX improvement
  • Documentation update

✔️ Checklist

  • My code follows project style guidelines
  • I have tested my changes
  • I have linked the related issue
  • No unnecessary files are included

🚨 Notes for Contributors

  • Please ensure PR is linked to an issue before submission
  • Incomplete PRs may not be reviewed

@vercel

vercel Bot commented Aug 9, 2026

Copy link
Copy Markdown

@Saubhagya1621 is attempting to deploy a commit to the jiya's projects Team on Vercel.

A member of the Team first needs to authorize it.

@netlify

netlify Bot commented Aug 9, 2026

Copy link
Copy Markdown

Deploy Preview for codevibeforyou ready!

Name Link
🔨 Latest commit 66a3fd2
🔍 Latest deploy log https://app.netlify.com/projects/codevibeforyou/deploys/6a78abb30cf3f30008ecc96d
😎 Deploy Preview https://deploy-preview-1457--codevibeforyou.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@JiyaBatra
JiyaBatra merged commit 9afbd76 into JiyaBatra:main Aug 10, 2026
6 of 7 checks passed
@JiyaBatra JiyaBatra added gssoc:approved Approved Pr under GSSoC'26 level:beginner Beginner level -easy issue or Pr labels Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved Approved Pr under GSSoC'26 level:beginner Beginner level -easy issue or Pr

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: completeLesson: XP multiplier uses stale/shadowed streak, diverges from persisted streak

2 participants