Fix CourseBook term validation to accept uppercase semesters and reject partial matches
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 82/100
Hướng nghiên cứu
Bắt đầu từ khai báo termRegex và lệnh gọi MatchString của nó trong scrapers/coursebook.go, nơi ScrapeCoursebook kiểm tra term trước khi thiết lập. Đọc ví dụ trong README dùng -term 24F để xác nhận đầu vào mong đợi. Hoàn thành khi 24F, 24f, 26S và 26u được chấp nhận và chuẩn hóa thành chữ thường, còn 4f, 124f, 24fextra, abc24f và 24X bị từ chối với thông báo lỗi rõ ràng trước khi trình duyệt khởi động.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
CourseBook term validation uses the unanchored regex [0-9]{1,2}[sfu] in scrapers/coursebook.go.
This causes two problems:
- Uppercase terms such as
24F, as documented in the README, are rejected. - Malformed terms such as
4f,124f, and24fextrapass validation because the regex accepts a matching substring.
Expected behavior:
- Accept exactly two digits followed by
S,U, orF, case-insensitively. - Normalize accepted terms to the lowercase format used by the CourseBook scraper before further processing.
- Reject malformed terms with a clear error before initializing the browser or making requests.
Steps To Reproduce
- Build the executable with
make build(orbuild.bat buildon Windows). - Run the documented command:
./api-tools -scrape -coursebook -term 24F - Observe that validation rejects the uppercase semester.
- Inspect
termRegexand itsMatchStringcall inscrapers/coursebook.go: the pattern also accepts4f,124f, and24fextra.
Malformed values that pass validation proceed toward browser initialization, so inspecting the regex is sufficient to confirm that behavior without starting a scrape.
Additional Context
Starting points:
- scrapers/coursebook.go:
termRegexandScrapeCoursebook. - README.md: the scraping example uses
-term 24F.
Suggested manual checks:
- Accept
24F,24f,26S, and26u. - Reject
4f,124f,24fextra,abc24f, and24X. - Confirm accepted terms reach scraper setup in the same normalized format.
Keep this task limited to term validation and normalization. Broader scraper error handling is covered by #192.
Environment
Identified by source inspection of commit 3f3585e; not reproduced by executing the scraper. The regex behavior is platform-independent.
- Ngôn ngữ chính
- Go
- Star
- 12
- Fork
- 54
- Merge trung bình
- 14 ngày 1 giờ
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của UTDNebula/api-tools
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Improve unit tests in sectionParser_test.goCó thể đã có người làm @Sidd-Pelluru đã nhận 43 ngày trước. Đang mởL1 recommended for recruits
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
Improve unit tests in discountsParser_test.goCó thể làm lại được @LikithInam đã nhận 29 ngày trước và không có pull request nào đang mở. Đang mởL1 recommended for recruits
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
L1 recommended for recruits
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
-
Comet Calendar events with multiple locationsCó thể đã có người làm @azythromycin đã nhận 23 ngày trước. Đang mởL1 Type: Bug Report
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Tất cả issue của UTDNebula/api-tools
Issue tương tự
-
enhancement needs:sonnet ready-for-agent
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
microsoft/TypeScript#65370 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
docs: data-ownership invites vendors to build add-ons around the OSCó thể đã có người làm @brandli đã nhận hôm nay. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
gentian-org/gentian-os#894 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug tech debt testing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
aws/amazon-vpc-cni-k8s#3976 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug raised-by:desk
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
medici-finance/assay#5678 ·
Maintainer thường phản hồi trong vòng 1 ngày