Skip to content

Commit

Permalink
lectureNumber 문자도 가능
Browse files Browse the repository at this point in the history
  • Loading branch information
Hank-Choi committed Aug 10, 2024
1 parent 9f7f043 commit 6491137
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class VacancyNotifierServiceImpl(
}

private val log = LoggerFactory.getLogger(javaClass)
private val courseNumberRegex = """(?<courseNumber>.*)\((?<lectureNumber>\d+)\)""".toRegex()
private val courseNumberRegex = """(?<courseNumber>.*)\((?<lectureNumber>.+)\)""".toRegex()
private val isFreshmanRegistrationCompleted = Calendar.getInstance() > Calendar.getInstance().apply {
set(Calendar.MONTH, Calendar.FEBRUARY)
set(Calendar.DAY_OF_MONTH, 14)
Expand Down Expand Up @@ -152,7 +152,8 @@ class VacancyNotifierServiceImpl(
course.select("div.course-info-item ul.course-info").first()!!
.let { info ->
val (courseNumber, lectureNumber) = info
.select("ul.course-info > li:nth-of-type(1) > span:nth-of-type(3)").text()
.select("li:nth-of-type(1) > span:nth-of-type(3)").text()
.also { log.info("강좌번호: {}", it) }
.takeIf { courseNumberRegex.matches(it) }!!
.let { courseNumberRegex.find(it)!!.groups }
.let { it["courseNumber"]!!.value to (it["lectureNumber"]!!.value) }
Expand Down

0 comments on commit 6491137

Please sign in to comment.