Skip to content

Commit 0568406

Browse files
authored
Merge pull request #15 from Code4GovTech/fix/backend-structuring
week updates condition removed
2 parents d2f937b + 47114ff commit 0568406

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

app.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# app.py
22
from quart import Quart
33
import httpx
4-
import os
4+
import os,markdown2
55
from db import SupabaseInterface
66
from apscheduler.schedulers.asyncio import AsyncIOScheduler
77
from dotenv import load_dotenv
@@ -138,12 +138,14 @@ async def dmp_updates():
138138
async with httpx.AsyncClient() as client:
139139
comments_response = await client.get(comments_url, headers=headers)
140140
if comments_response.status_code == 200:
141+
week_update_status = False
141142
# Loop through comments
142143
for val in comments_response.json():
143-
144-
# Handle if any of the comments are week data
145-
handle_week_data(
146-
val, dmp['issue_url'], dmp_id, issue_update['mentor_username'])
144+
# Handle if any of the comments are week data
145+
plain_text_body = markdown2.markdown(val['body'])
146+
if "Weekly Goals" in plain_text_body and not week_update_status:
147+
week_update_status = handle_week_data(val, dmp['issue_url'], dmp_id, issue_update['mentor_username'])
148+
147149
# Parse comments
148150
comment_update = define_issue_update(
149151
val, dmp_id=dmp_id)

utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ def parse_issue_description(issue_body):
3636
def handle_week_data(comment, issue_url, dmp_id, mentor_name):
3737
try:
3838
# Get writer of comment and if it is not the selected mentor, return right away
39-
writter = "@"+comment['user']['login']
40-
if writter != mentor_name:
41-
return False
39+
# writter = "@"+comment['user']['login']
40+
# if writter != mentor_name:
41+
# return False
4242

4343
plain_text_body = markdown2.markdown(comment['body'])
4444

0 commit comments

Comments
 (0)