fix: add sort and limit to /my command (#94) #95

Merged
shoko merged 1 commits from fix/my-sort-limit into main 2026-04-09 16:20:19 +02:00
Owner

Summary

Add sort and limit functionality to /my command for consistency with /bounty.

Changes

The /my command now has the same behavior as /bounty:

  1. Sorting: Bounties are sorted by due date (urgent first), with no-due-date bounties at the end
  2. Limit: Default limit of 5, shows "Showing X of Y" message when results are limited
  3. "all" flag: Use /my all to show expired bounties
  4. Delete button: Added for consistency with other commands

Before

bounties = TRACKING_SERVICE.get_tracked_bounties(group_id, user_id)
lines = [format_bounty(b, ...) for b in bounties]  # No sorting, no limit

After

# Sort by due date (urgent first)
filtered_bounties.sort(key=sort_key)

# Apply limit
displayed_bounties = filtered_bounties[:limit]

# Show count message
lines.append(f"Showing {limit} of {total_count} bounties:")

Testing

All 123 tests pass.

Fixes #94

## Summary Add sort and limit functionality to `/my` command for consistency with `/bounty`. ## Changes The `/my` command now has the same behavior as `/bounty`: 1. **Sorting**: Bounties are sorted by due date (urgent first), with no-due-date bounties at the end 2. **Limit**: Default limit of 5, shows "Showing X of Y" message when results are limited 3. **"all" flag**: Use `/my all` to show expired bounties 4. **Delete button**: Added for consistency with other commands ## Before ```python bounties = TRACKING_SERVICE.get_tracked_bounties(group_id, user_id) lines = [format_bounty(b, ...) for b in bounties] # No sorting, no limit ``` ## After ```python # Sort by due date (urgent first) filtered_bounties.sort(key=sort_key) # Apply limit displayed_bounties = filtered_bounties[:limit] # Show count message lines.append(f"Showing {limit} of {total_count} bounties:") ``` ## Testing All 123 tests pass. Fixes #94
shoko added 1 commit 2026-04-09 16:09:30 +02:00
- Add same sort_key logic as /bounty (due date first, then created_at)
- Add default limit of 5 with "Showing X of Y" message
- Add "all" flag to show expired bounties
- Add delete button for consistency with /bounty

Fixes #94
han approved these changes 2026-04-09 16:19:39 +02:00
han left a comment
Collaborator

lgtm

lgtm
shoko merged commit 54a41a7250 into main 2026-04-09 16:20:19 +02:00
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shoko/jigaido#95