Skip to content

fix(learn-token): append claim records to history in batch_claim_reward - #513

Open
lmduy2612 wants to merge 1 commit into
ChainLearnOfficial:mainfrom
lmduy2612:fix/batch-claim-append-history-502
Open

lmduy2612 wants to merge 1 commit into
ChainLearnOfficial:mainfrom
lmduy2612:fix/batch-claim-append-history-502

Conversation

@lmduy2612

Copy link
Copy Markdown

Description

Resolves #502.

In batch_claim_reward (contracts/learn-token/src/lib.rs), each successful quiz claim in the batch now appends a ClaimRecord to the learner's claim history via storage::append_claim_record, matching the behavior of claim_reward. This ensures get_claim_history returns complete claim records regardless of whether rewards were claimed individually or in a batch.

Changes

  • contracts/learn-token/src/lib.rs: Added storage::append_claim_record call inside the batch loop for each claimed quiz.
  • tests/unit/token_tests.rs: Added unit test test_batch_claim_reward_appends_claim_records_to_history verifying that claims from batch_claim_reward are properly recorded in get_claim_history.
  • tests/unit/token_tests.rs: Cleaned up spliced function signatures and sequence numbers from recent upstream merge.

Testing

  • cargo test --test token_tests: All 79 tests passed green.
  • cargo clippy --test token_tests: 0 warnings.

…rd (ChainLearnOfficial#502)

- Call storage::append_claim_record inside the batch loop for each claimed quiz
- Add test_batch_claim_reward_appends_claim_records_to_history to verify history is populated
- Repair test setup syntax and sequence alignment in token_tests.rs
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.

batch_claim_reward does not append claim records to history -- get_claim_history is incomplete

2 participants