From 3b40174a6470b3de538d0c13d15a3dcb5fbcee01 Mon Sep 17 00:00:00 2001
From: BoYanZh <boyanzh233@gmail.com>
Date: Fri, 4 Oct 2024 18:46:48 -0400
Subject: [PATCH] feat: sort failed table by time

---
 joint_teapot/utils/joj3.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/joint_teapot/utils/joj3.py b/joint_teapot/utils/joj3.py
index bc84b29..319d825 100644
--- a/joint_teapot/utils/joj3.py
+++ b/joint_teapot/utils/joj3.py
@@ -1,6 +1,5 @@
 import bisect
 import csv
-import enum
 import json
 import os
 from datetime import datetime
@@ -145,7 +144,7 @@ def update_failed_table_from_score_file(
 
 
 def write_failed_table_into_file(data: List[List[str]], table_file_path: str) -> None:
-    data = sorted(data, key=lambda x: x[1])
+    data.sort(key=lambda x: datetime.strptime(x[0], "%Y-%m-%d %H:%M"), reverse=True)
     text = "|date|repository|failure|\n"
     text += "|----|----|----|\n"
     for row in data: