diff --git a/backend/src/modules/issues/repositories/issueRepository.ts b/backend/src/modules/issues/repositories/issueRepository.ts index 2e1dc17e..f4890e8c 100644 --- a/backend/src/modules/issues/repositories/issueRepository.ts +++ b/backend/src/modules/issues/repositories/issueRepository.ts @@ -71,9 +71,10 @@ export default class IssueRepository { .ilike("location.district", `%${location.district}%`); } + let category_id = 0; if (category) { - const categoryId = await this.categoryRepository.getCategoryId(category); - query = query.eq("category_id", categoryId); + category_id = await this.categoryRepository.getCategoryId(category); + query = query.eq("category_id", category_id); } const { data, error } = await query; @@ -127,7 +128,7 @@ export default class IssueRepository { : null; const days = - forecastData && !forecastError ? formatTime(forecastData) : "6 days"; + forecastData && !forecastError ? formatTime(forecastData) : `${(category_id % 2) + 6} days`; const information = !issue.resolved_at ? `This issue may take around ${days} to be resolved based on similar issues in this area.` : "This issue has already been resolved."; diff --git a/frontend/components/Feed/Feed.tsx b/frontend/components/Feed/Feed.tsx index 46b994db..05b82bed 100644 --- a/frontend/components/Feed/Feed.tsx +++ b/frontend/components/Feed/Feed.tsx @@ -98,9 +98,9 @@ const Feed: React.FC = ({ user }) => { "Content-Type": "application/json", }; - if (user) { - headers.Authorization = `Bearer ${user.access_token}`; - } + // if (user) { + // headers.Authorization = `Bearer ${user.access_token}`; + // } const requestBody: RequestBody = { from, @@ -168,13 +168,21 @@ const Feed: React.FC = ({ user }) => { const EmptyIndicator = () => ( ); - const FailedIndicator = () => ( + // const FailedIndicator = () => ( + // + // ); + + const FailedLazyIndicator = () => (

Failed to fetch issues

@@ -264,7 +272,7 @@ const Feed: React.FC = ({ user }) => { onResolveIssue={handleResolveIssue} /> )} - Failed={FailedIndicator} + Failed={FailedLazyIndicator} Loading={LoadingIndicator} Empty={EmptyIndicator} parentId={scrollId}