Skip to content

Commit

Permalink
Merge pull request #27 from zeroquinc:trophy-filter
Browse files Browse the repository at this point in the history
fix: filter recent trophies
  • Loading branch information
zeroquinc authored May 11, 2024
2 parents 965b8e0 + 587614b commit d44ad48
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/trophies.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,13 @@ async def process_trophies_embeds(client, title_ids, TROPHIES_INTERVAL):
# Calculate total trophies of the game (before filtering for earned_date_time)
total_trophies = len(all_trophies)
# Get current time and calculate cutoff time
logger.debug(f"Earned trophies before sorting: {earned_trophies}")
now = get_current_time()
logger.debug(f"Current time: {now}")
cutoff = now - timedelta(minutes=TROPHIES_INTERVAL)
# Filter out trophies that were earned before the cutoff time
logger.debug(f"Cutoff time: {cutoff}")
recent_trophies = [t for t in earned_trophies if t[0].earned_date_time >= cutoff]
logger.debug(f"Recent trophies after filtering: {recent_trophies}")
# Calculate total trophies earned (after filtering)
total_trophies_earned = len(earned_trophies)
# Calculate the starting count
Expand Down

0 comments on commit d44ad48

Please sign in to comment.