@@ -59,18 +59,26 @@ const UserProfileContent = () => {
5959 // Fetch user stats
6060 const fetchStats = async ( ) => {
6161 try {
62- const [ ratingsRes , commentsRes ] = await Promise . all ( [
62+ const [ ratingsRes , commentsRes , requestsRes ] = await Promise . all ( [
6363 fetch ( `/api/ratings?userId=${ user . id } ` ) ,
6464 fetch ( `/api/comments?userId=${ user . id } ` ) ,
65+ fetch ( `/api/project-requests?userId=${ user . id } ` ) ,
6566 ] ) ;
6667
6768 const ratings = await ratingsRes . json ( ) ;
6869 const comments = await commentsRes . json ( ) ;
70+ const requests = await requestsRes . json ( ) ;
71+
72+ // Count accepted submissions
73+ const acceptedSubmissions = requests . filter ( ( req : any ) => req . status === 'accepted' ) . length ;
74+
75+ console . log ( 'Project requests:' , requests ) ;
76+ console . log ( 'Accepted submissions count:' , acceptedSubmissions ) ;
6977
7078 setStats ( {
7179 ratings : ratings . length ,
7280 comments : comments . length ,
73- submissions : 0 , // Will be updated when we fetch project requests
81+ submissions : acceptedSubmissions ,
7482 } ) ;
7583 } catch ( error ) {
7684 console . error ( "Error fetching user stats:" , error ) ;
@@ -187,7 +195,7 @@ const UserProfileContent = () => {
187195 < div className = "flex justify-between items-center" >
188196 < div className = "flex items-center gap-2" >
189197 < FileText className = "text-green-500 w-4 h-4" />
190- < span className = "text-sm" > Submissions </ span >
198+ < span className = "text-sm" > Accepted Projects </ span >
191199 </ div >
192200 < span className = "font-semibold" > { stats . submissions } </ span >
193201 </ div >
0 commit comments