66import aiohttp
77from typing import Optional , Dict , Any , List
88
9- from ..constants .error_codes import NotEligibleError , ResponseStatus
9+ from ..constants .error_codes import NotEligibleError , ResponseStatus , ErrorMessages
1010from ..models .certificate import CertificateStatus
1111from ..models .project import Project , SeasonGroup , ProjectsBySeasonResponse
1212
@@ -156,14 +156,17 @@ async def verify_user_participation(
156156 user_role = "BUILDER"
157157 elif user_name in runner_names :
158158 user_role = "RUNNER"
159+ # '์๋ฃ์' ํ๋์ ์ด๋ฆ์ด ํฌํจ๋์ด ์๋์ง ํ์ธ
160+ elif any (user_name in c for c in completer_names ):
161+ user_role = "RUNNER"
159162
160163 # 2. ์ฌ์ฉ์๊ฐ ์ดํ์์ ์๋์ง ํ์ธ
161164 if user_name in dropout_names :
162- raise NotEligibleError (f"์๋ฃ ๋ช
๋จ์ ์กด์ฌํ์ง ์์ต๋๋ค. ๐ฅฒ \n ๋์ค์ฝ๋๋ฅผ ํตํด ์ง๋ฌธ๊ฒ์ํ์ ๋ฌธ์ํด์ฃผ์ธ์." )
165+ raise NotEligibleError (ErrorMessages . USER_DROPPED_OUT )
163166
164167 # 3. ์ฌ์ฉ์๊ฐ ์ฐธ์ฌ์ ๋ชฉ๋ก์ ์๋์ง ํ์ธ
165168 if user_role is None :
166- raise NotEligibleError (f"์๋ฃ ๋ช
๋จ์ ์กด์ฌํ์ง ์์ต๋๋ค. ๐ฅฒ \n ๋์ค์ฝ๋๋ฅผ ํตํด ์ง๋ฌธ๊ฒ์ํ์ ๋ฌธ์ํด์ฃผ์ธ์." )
169+ raise NotEligibleError (ErrorMessages . NO_HISTORY . format ( name = user_name ) )
167170
168171 study_status = properties .get ("๋จ๊ณ" , {}).get ("select" , {})
169172 period_raw = project .get ("properties" , {}).get ("๊ธฐ๊ฐ" , {}).get ("date" , {}) or {}
@@ -174,9 +177,7 @@ async def verify_user_participation(
174177 )
175178
176179 if study_status .get ("name" ) != "์๋ฃ" :
177- raise NotEligibleError (
178- "์๋ฃ์ฆ์ ์คํฐ๋๊ฐ ์๋ฃ๋ ์ดํ ๋ฐ๊ธ ๊ฐ๋ฅํฉ๋๋ค.\n ๋์ค์ฝ๋๋ฅผ ํตํด ์ง๋ฌธ๊ฒ์ํ์ ๋ฌธ์ํด์ฃผ์ธ์."
179- )
180+ raise NotEligibleError (ErrorMessages .STUDY_NOT_COMPLETED )
180181
181182 fallback_period = self .default_periods .get (str (season ), {})
182183 raw_start = period_raw .get ("start" )
@@ -273,7 +274,7 @@ async def verify_user_participation(
273274 "course_name" : course_name ,
274275 },
275276 )
276- raise Exception ( "ํด๋น ํ๋ก์ ํธ๊ฐ ๊ฒ์๋์ง ์์ต๋๋ค. \n ๋์ค์ฝ๋๋ฅผ ํตํด ์ง๋ฌธ๊ฒ์ํ์ ๋ฌธ์ํด์ฃผ์ธ์." )
277+ raise NotEligibleError ( ErrorMessages . PROJECT_NOT_FOUND )
277278 except Exception as e :
278279 raise e
279280
0 commit comments