bin/crashreportScraper.py |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

New commits:
commit 55eef24a55afb3708f2e02abf65b6934bed7f3de
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Tue Sep 5 12:23:20 2023 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Sep 5 16:53:44 2023 +0200

    crashreportScraper: Add ratio column
    
    it makes sense to sort the sheet by this column
    
    Change-Id: I05603dac80289605c18e86fbf27c3d899f9862c2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156562
    Tested-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/bin/crashreportScraper.py b/bin/crashreportScraper.py
index 54477f6c4c28..876570d3a028 100755
--- a/bin/crashreportScraper.py
+++ b/bin/crashreportScraper.py
@@ -28,9 +28,7 @@ def convert_str_to_date(value):
     value = value.replace('Sept', 'Sep')
     # reset the time leaving the date
     value = ", ".join(value.split(", ")[:-1])
-    dtDate = datetime.strptime(value, '%b %d, %Y')
-
-    return dtDate.strftime('%y/%m/%d')
+    return datetime.strptime(value, '%b %d, %Y')
 
 def parse_version_url(url):
     crashReports = {}
@@ -201,7 +199,7 @@ if __name__ == '__main__':
 
     with open(fileName, "a") as f:
         if bInsertHeader:
-            line = '\t'.join(["Name", "Count", "First report", "Last Report",
+            line = '\t'.join(["Name", "Ratio", "Count", "First report", "Last 
Report",
                 "ID", "Version", "Reason", "OS", "Stack", "Code Lines", "Last 
4 UNO Commands", '\n'])
             f.write(line)
             f.flush()
@@ -214,7 +212,8 @@ if __name__ == '__main__':
                             
"https://crashreport.libreoffice.org/stats/signature/"; + urllib.parse.quote(k))
                     crashReason, crashStack, codeLine, unoCommands = 
parse_details_and_get_info(
                             
"https://crashreport.libreoffice.org/stats/crash_details/"; + crashID, 
args.repository)
-                    line = '\t'.join([k, str(crashCount), lDate[1], lDate[2],
+                    ratio = round(crashCount / ((lDate[2] - lDate[1]).days + 
1), 2)
+                    line = '\t'.join([k, str(ratio), str(crashCount) , 
lDate[1].strftime('%y/%m/%d'), lDate[2].strftime('%y/%m/%d'),
                             crashID, crashVersion, crashReason, crashOS, 
crashStack, codeLine, unoCommands, '\n'])
                     f.write(line)
                     f.flush()

Reply via email to