Skip to content

Conversation

pan93412
Copy link
Member

  • feat: add logout and logout_all event
  • feat(events): implement submit_answer points
  • docs(event): document points

Closed DBP-85 第一名獎勵點數
Closed DBP-71 嘗試做題獎勵點數
Closed DBP-67 每日做題獎勵點數
Closed DBP-66 答對獎勵點數
@pan93412 pan93412 self-assigned this Sep 30, 2025
Copy link

linear bot commented Sep 30, 2025

@pan93412 pan93412 requested a review from Copilot September 30, 2025 19:10
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements a comprehensive points system for question submissions and adds logout event tracking. The changes include logout events for token revocation, a detailed points granting system for various submission scenarios, and comprehensive documentation for the events system.

  • Add logout and logout_all events for token management
  • Implement points granting for question submissions (first attempt, daily attempt, correct answer, first place)
  • Document the complete events and points system

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
internal/useraccount/token.go Add event triggering for logout and logout_all when revoking tokens
internal/useraccount/token_test.go Add tests for logout event triggering in token revocation
internal/events/constants.go Add new logout event type constants
internal/events/points.go Implement comprehensive points granting system for submissions
internal/events/points_test.go Add extensive test coverage for all points granting scenarios
internal/events/README.md Document all events and points granting rules
httpapi/auth/revoke.go Update to use useraccount context for token revocation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copilot: Using time.Now().AddDate(0, 0, -1) for daily checks is problematic because it checks for the last 24 hours, not for 'today'. This could miss or incorrectly grant points near midnight. Consider using a date-based comparison instead.
@pan93412 pan93412 requested a review from Copilot September 30, 2025 19:22
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@pan93412 pan93412 requested a review from Copilot September 30, 2025 19:27
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@pan93412 pan93412 merged commit 4071a90 into main Sep 30, 2025
1 check passed
@pan93412 pan93412 deleted the pan93412/dbp-71-嘗試做題獎勵點數 branch September 30, 2025 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant