File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
src/components/GenerateCourse Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ import { AICourseFooter } from './AICourseFooter';
2525import { ForkCourseAlert } from './ForkCourseAlert' ;
2626import { ForkCourseConfirmation } from './ForkCourseConfirmation' ;
2727import { useAuth } from '../../hooks/use-auth' ;
28+ import { getPercentage } from '../../lib/number' ;
2829
2930type AICourseContentProps = {
3031 courseSlug ?: string ;
@@ -134,8 +135,9 @@ export function AICourseContent(props: AICourseContentProps) {
134135 ) ;
135136
136137 const totalDoneLessons = ( course ?. done || [ ] ) . length ;
137- const finishedPercentage = Math . round (
138- ( totalDoneLessons / totalCourseLessons ) * 100 ,
138+ const finishedPercentage = getPercentage (
139+ totalDoneLessons ,
140+ totalCourseLessons ,
139141 ) ;
140142
141143 const modals = (
@@ -313,7 +315,7 @@ export function AICourseContent(props: AICourseContentProps) {
313315 </ span >
314316 ) }
315317
316- { finishedPercentage > 0 && (
318+ { finishedPercentage > 0 && ! isLoading && (
317319 < >
318320 < span className = "text-gray-400" > •</ span >
319321 < span className = "font-medium text-green-600" >
You can’t perform that action at this time.
0 commit comments