Skip to content

Commit

Permalink
Merge pull request #24 from Code4GovTech/sasi_dev_v2fix
Browse files Browse the repository at this point in the history
org details fix
  • Loading branch information
karntrehan authored Jun 25, 2024
2 parents facbeaa + 2350586 commit 6f597e4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def get_issues():
issues = org['dmp_issues']
obj['org_id'] = org['id']
obj['org_name'] = org['name']
renamed_issues = [{"id": issue["issue_number"], "name": issue["title"]} for issue in issues]
renamed_issues = [{"id": issue["id"], "name": issue["title"]} for issue in issues]
obj['issues'] = renamed_issues

res.append(obj)
Expand Down
9 changes: 4 additions & 5 deletions v2_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def get_issues_by_owner_id_v2(owner, issue):
url = f"https://github.com/{repo_owner}" if repo_owner else None


dmp_issue_id = SUPABASE_DB.client.table('dmp_issues').select('*').like('issue_url', f'%{url}%').eq('issue_number', issue).execute()
dmp_issue_id = SUPABASE_DB.client.table('dmp_issues').select('*').like('issue_url', f'%{url}%').eq('id', issue).execute()
if not dmp_issue_id.data:
return jsonify({'error': "No data found"}), 500

Expand All @@ -46,9 +46,8 @@ def get_issues_by_owner_id_v2(owner, issue):
# week_avg ,cont_name,cont_id,w_goal,w_learn,weekby_avgs,org_link = find_week_avg(issue_url)
# mentors_data = find_mentors(val['issue_url']) if val['issue_url'] else {'mentors': [], 'mentor_usernames': []}

if val['body_text']:
# and ("@"+val['created_by'].lower() == dmp_issue_id['mentor_username'].lower())
if ("Weekly Goals" in val['body_text'] and not w_goal_url):
if val['body_text']:
if ("Weekly Goals" in val['body_text'] and not w_goal_url) and ("@"+val['created_by'].lower() == dmp_issue_id['mentor_username'].lower() if dmp_issue_id['mentor_username'] else None):
w_goal_url = val['body_text']
plain_text_body = markdown2.markdown(val['body_text'])
tasks = re.findall(r'\[(x| )\]', plain_text_body)
Expand All @@ -73,7 +72,7 @@ def get_issues_by_owner_id_v2(owner, issue):
"mentor_id": dmp_issue_id['mentor_username'] ,
"contributor":define_link_data(cont_details),
# "contributor_id": cont_details[0]['contributor_id'],
"org": define_link_data(dmp_issue_id['mentor_username'])[0] if dmp_issue_id['mentor_username'] else [],
"org": define_link_data(repo_owner),
"weekly_goals_html": w_goal_url,
"weekly_learnings_html": w_learn_url,
"overall_progress":calculate_overall_progress(week_data,12),
Expand Down

0 comments on commit 6f597e4

Please sign in to comment.