File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,15 +25,17 @@ def get_issues_by_owner_id_v2(owner, issue):
2525 url = f"https://github.com/{ repo_owner } " if repo_owner else None
2626
2727
28- dmp_issue_id = SUPABASE_DB .client .table ('dmp_issues' ).select ('*' ).like ( 'issue_url' , f'% { url } %' ). eq ('id' , issue ).execute ()
28+ dmp_issue_id = SUPABASE_DB .client .table ('dmp_issues' ).select ('*' ).eq ('id' , issue ).execute ()
2929 if not dmp_issue_id .data :
30- return jsonify ({'error' : "No data found" }), 500
30+ print (f"url....{ url } ....{ issue } " )
31+ return jsonify ({'error' : "No data found in dmp_issue" }), 500
3132
3233 dmp_issue_id = dmp_issue_id .data [0 ]
3334 response = SUPABASE_DB .client .table ('dmp_issue_updates' ).select ('*' ).eq ('dmp_id' , dmp_issue_id ['id' ]).execute ()
3435
3536 if not response .data :
36- return jsonify ({'error' : "No data found" }), 500
37+ print (f"dmp_issue_id....{ response } ....{ dmp_issue_id } " )
38+ return jsonify ({'error' : "No data found in dmp_issue_updates" }), 500
3739
3840 data = response .data
3941
Original file line number Diff line number Diff line change @@ -27,7 +27,29 @@ def define_link_data(usernames):
2727 logging .info (f"{ e } ---define_link_data" )
2828 return []
2929
30+ def remove_unmatched_tags (text ):
31+ try :
32+ # Remove unmatched closing tags at the beginning of the string
33+ text = re .sub (r'^\s*</[^>]+>\s*' , '' , text )
34+
35+ # Regex pattern to find matched or unmatched tags
36+ pattern = re .compile (r'(<([^>]+)>.*?</\2>)|(<[^/][^>]*>.*)' , re .DOTALL )
37+ matches = pattern .findall (text )
38+
39+ cleaned_text = ''
40+ for match in matches :
41+ if match [0 ]: # Full matched <tag>...</tag> pairs
42+ cleaned_text += match [0 ]
43+ elif match [2 ]: # Unmatched opening <tag> tags
44+ cleaned_text += match [2 ]
3045
46+ return cleaned_text
47+ except Exception as e :
48+ print (e )
49+ return text
50+
51+
52+
3153
3254def week_data_formatter (html_content , type ):
3355
@@ -46,7 +68,8 @@ def week_data_formatter(html_content, type):
4668 task_list_html = tasks_per_week [i ] if i < len (tasks_per_week ) else ""
4769 weekly_updates .append ({
4870 'week' : i + 1 ,
49- 'content' : task_list_html .strip ()
71+ 'content' : remove_unmatched_tags (task_list_html )
72+
5073 })
5174 return weekly_updates
5275
You can’t perform that action at this time.
0 commit comments