Skip to content

Commit ce1c571

Browse files
committed
bug fixes
1 parent 5cd30e2 commit ce1c571

File tree

6 files changed

+49
-39
lines changed

6 files changed

+49
-39
lines changed

backend/apps/mentorship/api/internal/nodes/module.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,11 @@ def interested_users(self, issue_number: int) -> list[UserNode]:
7575
def task_deadline(self, issue_number: int) -> datetime | None:
7676
"""Return the earliest deadline for tasks linked to this module and issue number."""
7777
return (
78-
Task.objects.filter(issue__number=issue_number)
78+
Task.objects.filter(
79+
module=self,
80+
issue__number=issue_number,
81+
deadline_at__isnull=False,
82+
)
7983
.order_by("deadline_at")
8084
.values_list("deadline_at", flat=True)
8185
.first()
@@ -86,7 +90,9 @@ def task_assigned_at(self, issue_number: int) -> datetime | None:
8690
"""Return the earliest assignment time for tasks linked to this module and issue number."""
8791
return (
8892
Task.objects.filter(
93+
module=self,
8994
issue__number=issue_number,
95+
assigned_at__isnull=False,
9096
)
9197
.order_by("assigned_at")
9298
.values_list("assigned_at", flat=True)

backend/manage.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,10 @@
55
import os
66
import sys
77

8-
from dotenv import load_dotenv
9-
10-
load_dotenv()
118
if __name__ == "__main__":
129
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings.local")
1310
os.environ.setdefault("DJANGO_CONFIGURATION", "Local")
14-
load_dotenv()
11+
1512
from configurations.management import execute_from_command_line
1613

1714
execute_from_command_line(sys.argv)

cspell/custom-dict.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ superfences
120120
tiktok
121121
tsc
122122
turbopack
123+
unassigning
123124
unhover
124125
usefixtures
125126
winsrdf

frontend/src/app/my/mentorship/programs/[programKey]/modules/[moduleKey]/issues/[issueId]/page.tsx

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -197,41 +197,45 @@ const ModuleIssueDetailsPage = () => {
197197

198198
<SecondaryCard icon={faCodeBranch} title="Pull Requests">
199199
<div className="grid grid-cols-1 gap-3">
200-
{issue.pullRequests?.map((pr) => (
201-
<div
202-
key={pr.id}
203-
className="flex items-center justify-between gap-3 rounded-lg bg-gray-200 p-4 dark:bg-gray-700"
204-
>
205-
<div className="flex items-center gap-3">
206-
<Image
207-
src={pr.author?.avatarUrl}
208-
alt={pr.author?.login || 'Unknown'}
209-
width={32}
210-
height={32}
211-
className="rounded-full"
212-
/>
213-
<div className="min-w-0 flex-1">
214-
<Link
215-
href={pr.url}
216-
target="_blank"
217-
rel="noopener noreferrer"
218-
className="truncate font-medium text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300"
219-
title={pr.title}
220-
>
221-
{pr.title}
222-
</Link>
223-
<div className="text-sm text-gray-500 dark:text-gray-400">
224-
by {pr.author?.login || 'Unknown'}{' '}
225-
{new Date(pr.createdAt).toLocaleDateString()}
200+
{issue.pullRequests?.length ? (
201+
issue.pullRequests.map((pr) => (
202+
<div
203+
key={pr.id}
204+
className="flex items-center justify-between gap-3 rounded-lg bg-gray-200 p-4 dark:bg-gray-700"
205+
>
206+
<div className="flex items-center gap-3">
207+
<Image
208+
src={pr.author?.avatarUrl}
209+
alt={pr.author?.login || 'Unknown'}
210+
width={32}
211+
height={32}
212+
className="rounded-full"
213+
/>
214+
<div className="min-w-0 flex-1">
215+
<Link
216+
href={pr.url}
217+
target="_blank"
218+
rel="noopener noreferrer"
219+
className="truncate font-medium text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300"
220+
title={pr.title}
221+
>
222+
{pr.title}
223+
</Link>
224+
<div className="text-sm text-gray-500 dark:text-gray-400">
225+
by {pr.author?.login || 'Unknown'}{' '}
226+
{new Date(pr.createdAt).toLocaleDateString()}
227+
</div>
226228
</div>
227229
</div>
230+
<ActionButton url={pr.url} tooltipLabel="View PR">
231+
<FontAwesomeIcon icon={faLink} />
232+
<span>View PR</span>
233+
</ActionButton>
228234
</div>
229-
<ActionButton url={pr.url} tooltipLabel="View PR">
230-
<FontAwesomeIcon icon={faLink} />
231-
<span>View PR</span>
232-
</ActionButton>
233-
</div>
234-
)) || <span className="text-sm text-gray-400">No linked pull requests.</span>}
235+
))
236+
) : (
237+
<span className="text-sm text-gray-400">No linked pull requests.</span>
238+
)}
235239
</div>
236240
</SecondaryCard>
237241

frontend/src/components/ModuleCard.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ import { useState } from 'react'
1212
import type { Module } from 'types/mentorship'
1313
import { formatDate } from 'utils/dateFormatter'
1414
import { TextInfoItem } from 'components/InfoItem'
15+
import { usePathname } from 'next/navigation'
1516
import SingleModuleCard from 'components/SingleModuleCard'
1617
import { TruncatedText } from 'components/TruncatedText'
18+
import { PathnameContext } from 'next/dist/shared/lib/hooks-client-context.shared-runtime'
1719

1820
interface ModuleCardProps {
1921
modules: Module[]
@@ -68,10 +70,11 @@ const ModuleCard = ({ modules, accessLevel, admins }: ModuleCardProps) => {
6870
}
6971

7072
const ModuleItem = ({ details }: { details: Module }) => {
73+
const pathname = usePathname()
7174
return (
7275
<div className="flex h-46 w-full flex-col gap-3 rounded-lg border-1 border-gray-200 p-4 shadow-xs ease-in-out hover:shadow-md dark:border-gray-700 dark:bg-gray-800">
7376
<Link
74-
href={`${window.location.pathname}/modules/${details.key}`}
77+
href={`${pathname}/modules/${details.key}`}
7578
className="text-start font-semibold text-blue-400 hover:underline"
7679
>
7780
<TruncatedText text={details?.name} />

frontend/src/components/ProgramCard.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ const ProgramCard: React.FC<ProgramCardProps> = ({ program, onView, accessLevel,
5353
showArrow
5454
content={program.name}
5555
placement="bottom"
56-
className="w-88"
5756
isDisabled={program.name.length > 50 ? false : true}
5857
>
5958
<h3 className="mr-1 line-clamp-2 h-12 overflow-hidden text-base font-semibold text-gray-600 dark:text-white">

0 commit comments

Comments
 (0)