From 5aec6e7414f7eb54b33ca807c31d9f6ad9291eca Mon Sep 17 00:00:00 2001 From: Louis Elkner-Alfaro Date: Fri, 25 Oct 2024 09:55:17 -0700 Subject: [PATCH 1/3] Update function name --- generate_issues.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/generate_issues.py b/generate_issues.py index 1f9f41a..d9c5153 100644 --- a/generate_issues.py +++ b/generate_issues.py @@ -43,8 +43,7 @@ def get_issue_title_and_url(issue_number): issues_and_urls += [issue_title, issue_url] return [issue_title, issue_url] -def prompt_for_file(file): - file = input("Enter harvest report: ") +def check_for_file(file): if not os.path.exists(file): print("THAT FILE DOES NOT EXIST, EXITING PROGRAM") quit() From fb6f226371a5362d85e103ef3922faf210941f9b Mon Sep 17 00:00:00 2001 From: Louis Elkner-Alfaro Date: Fri, 25 Oct 2024 09:55:44 -0700 Subject: [PATCH 2/3] Update tests to use issues that still exist --- tests.py | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/tests.py b/tests.py index e081be7..5e6ade5 100644 --- a/tests.py +++ b/tests.py @@ -1,36 +1,47 @@ import generate_issues import re -def test_split_issues_into_columns(): - issues_string = 'Resolved Issue #363, #362 and Issue 361' - issues = generate_issues.parse_notes_section(issues_string) - solution = {'First Issue Title': 'Little slow downs are happening - these often signal that the server memory is getting overwhelmed?', 'First Issue URL': 'https://git.agaric.com/housingworks/app-housingworks-net/issues/363', 'Second Issue Title': 'Little slow downs are happening - these often signal that the server memory is getting overwhelmed?', 'Second Issue URL': 'https://git.agaric.com/housingworks/app-housingworks-net/issues/363', 'Third Issue Title': 'the csv Importer has quit working on both the live and test sites???', 'Third Issue URL': 'https://git.agaric.com/housingworks/app-housingworks-net/issues/362'} - if (generate_issues.split_issues_into_columns(issues) == solution): +def test_split_issues_into_columns(): + issues_string = "Resolved Issue #679, #678 and Issue 677" + issues = generate_issues.parse_notes_section(issues_string) + solution = { + "First Issue Title": "Update 'Same as mailing address' label in step 1 of client wizard", + "First Issue URL": "https://git.agaric.com/housingworks/app-housingworks-net/issues/679", + "Second Issue Title": "People filtering the programs listing by county can see which state the county is in", + "Second Issue URL": "https://git.agaric.com/housingworks/app-housingworks-net/issues/678", + "Third Issue Title": "Fatal error on viewing Client Households", + "Third Issue URL": "https://git.agaric.com/housingworks/app-housingworks-net/issues/677", + } + + if generate_issues.split_issues_into_columns(issues) == solution: print("TEST SPLIT ISSUES INTO COLUMNS PASSED") else: print("TEST SPLIT ISSUES INTO COLUMNS FAILED") + def test_parse_notes_section(): - if (generate_issues.parse_notes_section('Resolved Issue #4, #5 and Issue 6') == ['4', '5', '6']): + if generate_issues.parse_notes_section("Resolved Issue #4, #5 and Issue 6") == ["4","5","6"]: print("TEST PARSE NOTES SECTION PASSED") else: print("TEST PARSE NOTES SECTION FAILED") + def test_get_issue_title_and_url(): solution = [ - "Little slow downs are happening - these often signal that the server memory is getting overwhelmed?", - "https://git.agaric.com/housingworks/app-housingworks-net/issues/363" + "Update 'Same as mailing address' label in step 1 of client wizard", + "https://git.agaric.com/housingworks/app-housingworks-net/issues/679", ] - if generate_issues.get_issue_title_and_url(363) == solution: + if generate_issues.get_issue_title_and_url(679) == solution: print("TEST GET ISSUE TITLE AND URL PASSED") else: print("TEST GET ISSUE TITLE AND URL FAILED") + def run_tests(): test_parse_notes_section() test_get_issue_title_and_url() test_split_issues_into_columns() -run_tests() +run_tests() From 41031470cf916820aad51bb4a95745ffeecf493a Mon Sep 17 00:00:00 2001 From: Louis Elkner-Alfaro Date: Fri, 25 Oct 2024 09:56:47 -0700 Subject: [PATCH 3/3] Add warnings to readme --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index de2eea8..6e4a7d9 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ We do not yet do summing of time per issue, but could with a fair amount of work In the meantime this can be done with a spreadsheet: ## Usage + For use with Forgejo Include your API token in .env as FORGEJO_API_TOKEN={token} - Token can be generated here if you do not have one: https://git.agaric.com/user/settings/applications @@ -24,3 +25,10 @@ python generate_issues.py FILE ``` The program outputs to 'modified_report.csv' + +## ⚠️ Warnings! ⚠️ + +This only parses three issues out of the harvest comment, if you have more issues in the comment it ignores them + +Until some fundamental issues are resolved regarding error handling when failing to connect to Forgejo or if a fetched issue returns 404 +this whole thing will quit on you in an unhelpful and frustrating manner.