improved discount parser#147
Merged
mikehquan19 merged 2 commits intoUTDNebula:developfrom Mar 30, 2026
Merged
Conversation
* addresses are now parsed into a []string of addresses * phonenumber package is used to normalize phone numbers to 1XXXXXXXXXX where 1 is country code * discount parser test cases updated and passed
mikehquan19
requested changes
Mar 29, 2026
Contributor
mikehquan19
left a comment
There was a problem hiding this comment.
Hey @bvaic, your code works but i give some extra small sub-issues so can you look into them for me?
Also, can you include the github of your co-author here?
parser/discountsParser.go
Outdated
| @@ -135,21 +136,24 @@ func parseDiscountItem(s *goquery.Selection, category string) *schema.DiscountPr | |||
|
|
|||
| // Check if it's a phone number | |||
| if containsPhonePattern(line) || isNumericPhone(line) { | |||
Contributor
There was a problem hiding this comment.
These may be some extra tasks, but can you dig into these two checking functions and see if there is a way of rewriting it using regex instead of for-loop or string matching?
Contributor
Author
There was a problem hiding this comment.
Yeah sure, I think it would be possible to put some regex into the containsPhonePattern() and maybe just leave isNumericPhone() as a fallback in case none of the regex matches
* the phonenumber package now handles checking if a line is a phone number * removed the containsPhonePattern() and isNumericPhone() functions as they are no longer needed * the extractEmail() function now uses regex to extract emails instead of for loops * discountParser_test.go updated to remove tests that are no longer needed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Co-authored-by: kimbow231 kimbow685@gmail.com
Fixes: #144