Skip to content

Commit

Permalink
包含今天的提交内容
Browse files Browse the repository at this point in the history
  • Loading branch information
DerickIT committed Jun 28, 2024
1 parent e1125bf commit 7b1bc31
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions sync_status_readme.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,24 @@
date_range = [(start_date + timedelta(days=x)).strftime("%m.%d") for x in range((end_date - start_date).days + 1)]

# 获取当前北京时间
current_date = datetime.now(beijing_tz).replace(hour=0, minute=0, second=0, microsecond=0)
current_date = datetime.now(beijing_tz)

# 获取每个用户在每一天的提交状态
user_commits = {user: {} for user in contributors}
for date in date_range:
day = datetime.strptime(date, "%m.%d").replace(year=2024, tzinfo=beijing_tz)
if day > current_date:
day_start = datetime.strptime(date, "%m.%d").replace(year=2024, tzinfo=beijing_tz)
day_end = day_start + timedelta(days=1)
if day_end > current_date:
day_end = current_date
if day_start >= current_date:
continue # 跳过未来的日期
next_day = day + timedelta(days=1)
if day == current_date:
next_day = datetime.now(beijing_tz) # 如果是今天,使用当前时间作为结束时间
commits = repo.get_commits(since=day, until=next_day)

commits = repo.get_commits(since=day_start, until=day_end)
for commit in commits:
if commit.author:
user_commits[commit.author.login][date] = "✅"
commit_date = commit.commit.author.date.astimezone(beijing_tz)
commit_date_str = commit_date.strftime("%m.%d")
user_commits[commit.author.login][commit_date_str] = "✅"

# 检查是否有人在一周内超过两天没有提交
def check_weekly_status(user_commits, user, date):
Expand Down

0 comments on commit 7b1bc31

Please sign in to comment.