Compare commits

..

1 commit

Author SHA1 Message Date
43cc5ee430 Update dependency pytest-cov to v7
Some checks failed
Test, Build and Publish / test (pull_request) Failing after 17s
Test, Build and Publish / build-and-push-images (pull_request) Has been skipped
2025-09-24 06:00:14 +00:00
2 changed files with 7 additions and 9 deletions

View file

@ -1,6 +1,6 @@
"""Store bot state"""
import os
from datetime import datetime, timedelta
from datetime import datetime
from schema import Schema, Use, Optional
from collections.abc import Generator
from typing import Protocol
@ -243,20 +243,18 @@ class _State():
def get_history_timestamps(self, users: list[Member]) -> list[datetime]:
"""Grab all timestamps in the history"""
ids = [int(m.id) for m in users]
others = [m.id for m in users]
# Fetch all the interaction times in history
# But only for interactions in the given user group
times = set()
for data in (data for id, data in self._users.items() if id in ids):
for data in (data for id, data in self._users.items() if int(id) in others):
matches = data.get(_Key.MATCHES, {})
for ts in (ts for id, ts in matches.items() if id in ids):
for ts in (ts for id, ts in matches.items() if int(id) in others):
times.add(ts)
# Convert to datetimes and sort
datetimes = [ts_to_datetime(ts) for ts in times]
# Remove any entries older than 6 months ago
datetimes = [t for t in datetimes if t >= datetime.now() - timedelta(months=3)]
datetimes.sort()
return datetimes

View file

@ -1,8 +1,8 @@
coverage==7.12.0
coverage==7.6.10
discord.py==2.4.0
dpytest==0.7.0
flake8==7.1.1
pytest==8.4.2
pytest==8.3.3
pytest-asyncio==0.25.2
pytest-cov==7.0.0
schema==0.7.8
schema==0.7.7