File tree Expand file tree Collapse file tree 2 files changed +27
-3
lines changed Expand file tree Collapse file tree 2 files changed +27
-3
lines changed Original file line number Diff line number Diff line change @@ -27,13 +27,15 @@ def get_issues_by_owner_id_v2(owner, issue):
27
27
28
28
dmp_issue_id = SUPABASE_DB .client .table ('dmp_issues' ).select ('*' ).like ('issue_url' , f'%{ url } %' ).eq ('id' , issue ).execute ()
29
29
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
31
32
32
33
dmp_issue_id = dmp_issue_id .data [0 ]
33
34
response = SUPABASE_DB .client .table ('dmp_issue_updates' ).select ('*' ).eq ('dmp_id' , dmp_issue_id ['id' ]).execute ()
34
35
35
36
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
37
39
38
40
data = response .data
39
41
Original file line number Diff line number Diff line change @@ -27,7 +27,29 @@ def define_link_data(usernames):
27
27
logging .info (f"{ e } ---define_link_data" )
28
28
return []
29
29
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 ]
30
45
46
+ return cleaned_text
47
+ except Exception as e :
48
+ print (e )
49
+ return text
50
+
51
+
52
+
31
53
32
54
def week_data_formatter (html_content , type ):
33
55
@@ -46,7 +68,7 @@ def week_data_formatter(html_content, type):
46
68
task_list_html = tasks_per_week [i ] if i < len (tasks_per_week ) else ""
47
69
weekly_updates .append ({
48
70
'week' : i + 1 ,
49
- 'content' : re . sub ( r'<[^>]+>' , '' , task_list_html ). strip ( )
71
+ 'content' : remove_unmatched_tags ( task_list_html )
50
72
51
73
})
52
74
return weekly_updates
You can’t perform that action at this time.
0 commit comments