Skip to content

Conversation

@konard
Copy link
Member

@konard konard commented Sep 14, 2025

Summary

Implements sorting by intermediate votes functionality to address issue #51.

What is "intermediate votes"?

Intermediate votes refer to pending supporter/opponent votes that haven't yet been converted to actual karma points. In the current system:

  • Users collect supporters and opponents through collective voting
  • When enough supporters/opponents accumulate, they convert to karma
  • Before conversion, these are "intermediate votes"

Changes Made

  • New DataBuilder functions:

    • calculate_intermediate_votes() - calculates pending votes value
    • get_users_sorted_by_intermediate_votes() - sorts users by intermediate votes only
  • New Commands:

    • top votes / топ голоса - shows users with highest intermediate votes
    • bottom votes / низ голоса - shows users with lowest intermediate votes
  • Pattern Recognition: Added support for Russian and English vote commands

  • Comprehensive Testing: Added tests and validation scripts

Examples

top votes      # Show users with most pending votes
top votes 5    # Show top 5 users with most pending votes  
bottom votes   # Show users with least/most negative pending votes
голоса         # Russian equivalent

Technical Details

The intermediate votes calculation is: supporters/2 - opponents/3

  • Where supporters need 2 votes per karma point
  • Opponents need 3 votes per karma point
  • This matches the existing karma conversion ratios

Test Results

✅ All existing tests pass
✅ New functionality validated with test script
✅ Properly handles edge cases (no votes, mixed votes)

Test plan

  • Implement core functionality
  • Add command patterns and registration
  • Create comprehensive tests
  • Validate with test script
  • Ensure existing functionality unaffected

🤖 Generated with Claude Code


Resolves #51

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #51
@konard konard self-assigned this Sep 14, 2025
- Add calculate_intermediate_votes function to DataBuilder
- Add get_users_sorted_by_intermediate_votes function to sort users by pending votes only
- Add top_votes command method to Commands class for displaying intermediate vote rankings
- Add TOP_VOTES and BOTTOM_VOTES patterns for command recognition
- Register new commands in main bot module
- Add comprehensive tests for new functionality
- Include experiment script to validate intermediate votes calculation

This allows users to see rankings based only on pending supporters/opponents votes,
separate from actual karma scores, addressing the requested "sort by intermediate votes" feature.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] Sort by intermediate votes Add sort by intermediate votes functionality Sep 14, 2025
@konard konard marked this pull request as ready for review September 14, 2025 00:09
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.

Sort by intermediate votes

2 participants