ubiquity-os-marketplace / text-conversation-rewards

1 stars 33 forks source link

Implement Differential Reward Distribution for Reopened Issues #301

Open 0x4007 opened 3 days ago

0x4007 commented 3 days ago

When an issue is reopened and closed again, the reward system should calculate and distribute only the difference between previously granted rewards and new rewards.

Requirements:

  1. Track Previous Rewards

    • Store transaction history with amounts per beneficiary
    • Record payment mode (direct/permit) used for each distribution
  2. Differential Calculation

    • Compare new reward amounts with previously distributed amounts
    • Calculate positive differences only (additional rewards)
    • Skip beneficiaries with no change in rewards
  3. Distribution Logic

    • Only process transactions for beneficiaries with positive reward differences
    • Handle cases where original payment failed but issue was reopened
  4. Error Handling

    • Validate transaction history before processing
    • Handle missing or incomplete previous distribution data
    • Log detailed comparison between old and new reward amounts

Technical Considerations:

Example Scenario:

// Original distribution
{
  "user1": { total: 100, paid: true },
  "user2": { total: 50, paid: true }
}

// New calculation
{
  "user1": { total: 150, difference: 50 },
  "user2": { total: 50, difference: 0 },
  "user3": { total: 25, difference: 25 }
}

Success Criteria:

Originally posted by @ubiquity-os-beta in https://github.com/ubiquity-os-marketplace/text-conversation-rewards/pull/235#issuecomment-2722879064

ubiquity-os-beta[bot] commented 3 days ago

[!CAUTION] No recognized labels were found to set the price of this task.

ubiquity-os-beta[bot] commented 3 days ago

[!NOTE] The following contributors may be suitable for this task:

devpanther

75% Match ubiquity/ubiquibot#704 75% Match ubiquity/ubiquibot#686

gentlementlegen

73% Match ubiquity-os-marketplace/text-conversation-rewards#155

0x4007 commented 3 days ago

Depends on #226