Contributor Reputation Snapshot Builder#805
Conversation
|
@ObedChibunna Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
Please fix failing pytest |
Test Failures Analysis & SolutionsThanks for this contribution! The job is failing with 18 test failures across contributor reputation snapshot logic. Here's what needs to be fixed: Critical Issues1. Activity Streak Calculation (3 failing tests) Fix: Use def _calculate_activity_streak(self, timestamps: List[datetime], snapshot_date: datetime) -> int:
if not timestamps:
return 0
unique_dates = sorted(set(ts.date() for ts in timestamps), reverse=True)
if not unique_dates:
return 0
streak = 0
current_date = snapshot_date.date()
for activity_date in unique_dates:
days_diff = (current_date - activity_date).days
if days_diff == 0 or days_diff == 1: # Today or yesterday
streak += 1
current_date = activity_date
else:
break
return streak2. Mock Data Generation (1 failing test) address = f"G{('A' if i % 2 == 0 else 'B')}{'X' * 54}" # Only 2 addresses!Fix: Generate truly random unique addresses: import random
hex_chars = ''.join(random.choices('ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', k=54))
address = f"G{hex_chars}"3. Integration Tests - 503 Service Unavailable (9 failing tests) Fix: Ensure proper test fixtures and mocks in
4. Missing Module References (2 failing tests) Fix: Verify mocked objects have all required attributes with proper return values before use. Recommended ActionPlease update the code with the fixes above and rerun the tests. Feel free to ping me if you need clarification on any of the fixes! |
Summary
Describe what changed and why.
Linked Issue
Closes #744
Type of Change
Validation
Documentation
Checklist
feat/,fix/, ordocs/