Skip to content

Commit

Permalink
Update update_commit.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Hunterdii authored Nov 6, 2024
1 parent a9c1e64 commit 58df49b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/update_commit.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import requests
import sys
import os
import re # This is missing in your original script
import re
from datetime import datetime

def get_latest_solution_file(directory: str):
Expand All @@ -12,7 +12,7 @@ def get_latest_solution_file(directory: str):
solution_files = [file for file in files if file.endswith('.md') and re.match(r"\d{2}\([A-Za-z]{3}\).+\.md", file)]

# Sort the files based on date, assuming filenames are in the format "DD(Month)Name.md"
solution_files.sort(key=lambda f: datetime.strptime(f[:6], "%d(%b)"))
solution_files.sort(key=lambda f: datetime.strptime(f[:6], "%d(%b)")) # Fix format to include parentheses

# Return the most recent file
return solution_files[-1] if solution_files else None
Expand Down

0 comments on commit 58df49b

Please sign in to comment.