Compare commits

...

9 commits

Author SHA1 Message Date
1e61b85e38 Update dependency flake8 to v7.3.0
All checks were successful
Test, Build and Publish / test (pull_request) Successful in 1m3s
Test, Build and Publish / build-and-push-images (pull_request) Successful in 58s
2025-11-30 00:00:10 +00:00
72f9b01183 Merge pull request 'Update dependency pytest to v8.4.2' (#25) from renovate/pytest-8.x into main
All checks were successful
Test, Build and Publish / test (push) Successful in 35s
Test, Build and Publish / build-and-push-images (push) Successful in 45s
Reviewed-on: #25
2025-11-29 23:15:36 +00:00
4a0f2d95c4 Merge pull request 'Update dependency coverage to v7.12.0' (#29) from renovate/coverage-7.x into main
Some checks failed
Test, Build and Publish / build-and-push-images (push) Blocked by required conditions
Test, Build and Publish / test (push) Has been cancelled
Reviewed-on: #29
2025-11-29 23:15:18 +00:00
6f80bbc0be Merge pull request 'Discount any history times older than 6 months' (#36) from limit-history into main
Some checks failed
Test, Build and Publish / build-and-push-images (push) Blocked by required conditions
Test, Build and Publish / test (push) Has been cancelled
Reviewed-on: #36
2025-11-29 23:15:07 +00:00
33bcbdd462 Merge pull request 'Update dependency schema to v0.7.8' (#34) from renovate/schema-0.x into main
Some checks failed
Test, Build and Publish / build-and-push-images (push) Blocked by required conditions
Test, Build and Publish / test (push) Has been cancelled
Reviewed-on: #34
2025-11-29 23:14:59 +00:00
3675430390 Discount any history times older than 6 months
All checks were successful
Test, Build and Publish / test (pull_request) Successful in 37s
Test, Build and Publish / build-and-push-images (pull_request) Successful in 44s
2025-11-29 23:13:03 +00:00
a89957f891 Update dependency coverage to v7.12.0
All checks were successful
Test, Build and Publish / test (pull_request) Successful in 35s
Test, Build and Publish / build-and-push-images (pull_request) Successful in 48s
2025-11-18 14:00:09 +00:00
3bc363648c Update dependency schema to v0.7.8
All checks were successful
Test, Build and Publish / test (pull_request) Successful in 37s
Test, Build and Publish / build-and-push-images (pull_request) Successful in 50s
2025-10-11 14:00:09 +00:00
47eca14fd8 Update dependency pytest to v8.4.2
All checks were successful
Test, Build and Publish / test (pull_request) Successful in 35s
Test, Build and Publish / build-and-push-images (pull_request) Successful in 42s
2025-09-04 15:00:11 +00:00
2 changed files with 10 additions and 8 deletions

View file

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

View file

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