Skip to content

Commit 362a72e

Browse files
committed
fix(series import): extract price when it ends with a dollar sign.
Fix #1274
1 parent d48d36c commit 362a72e

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/main/java/ru/mystamps/web/feature/series/importing/SeriesInfoExtractorServiceImpl.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,10 @@ public SeriesExtractedInfo extract(String pageUrl, RawParsedDataDto data) {
404404
if (candidate.contains(",")) {
405405
candidate = StringUtils.replaceChars(candidate, ',', '.');
406406
}
407+
// "10$" -> "10"
408+
if (candidate.endsWith("$") && candidate.length() > 2) {
409+
candidate = candidate.substring(0, candidate.length() - 1);
410+
}
407411
try {
408412
BigDecimal price = new BigDecimal(candidate);
409413
log.debug("Price is {}", price);

src/test/groovy/ru/mystamps/web/feature/series/importing/SeriesInfoExtractorServiceImplTest.groovy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,7 @@ class SeriesInfoExtractorServiceImplTest extends Specification {
611611
service.extractPrice(fragment) == BigDecimal.TEN
612612
where:
613613
fragment | _
614+
'10$' | _
614615
'10 EUR' | _
615616
'10.0 EUR' | _
616617
'10.00 EUR' | _

0 commit comments

Comments
 (0)