diff --git a/src/components/GenerateCourse/AICourseContent.tsx b/src/components/GenerateCourse/AICourseContent.tsx
index ba484cd76..1e253eb54 100644
--- a/src/components/GenerateCourse/AICourseContent.tsx
+++ b/src/components/GenerateCourse/AICourseContent.tsx
@@ -25,6 +25,7 @@ import { AICourseFooter } from './AICourseFooter';
import { ForkCourseAlert } from './ForkCourseAlert';
import { ForkCourseConfirmation } from './ForkCourseConfirmation';
import { useAuth } from '../../hooks/use-auth';
+import { getPercentage } from '../../lib/number';
type AICourseContentProps = {
courseSlug?: string;
@@ -134,8 +135,9 @@ export function AICourseContent(props: AICourseContentProps) {
);
const totalDoneLessons = (course?.done || []).length;
- const finishedPercentage = Math.round(
- (totalDoneLessons / totalCourseLessons) * 100,
+ const finishedPercentage = getPercentage(
+ totalDoneLessons,
+ totalCourseLessons,
);
const modals = (
@@ -313,7 +315,7 @@ export function AICourseContent(props: AICourseContentProps) {
)}
- {finishedPercentage > 0 && (
+ {finishedPercentage > 0 && !isLoading && (
<>
•