|
@@ -23,7 +23,7 @@ import java.util.stream.Collectors;
|
|
|
@Component
|
|
|
public class ViewMultiplierStrategy implements ScoreStrategy {
|
|
|
|
|
|
- @Resource(name="programDataJdbcTemplate")
|
|
|
+ @Resource(name = "programDataJdbcTemplate")
|
|
|
NamedParameterJdbcTemplate programDataJdbcTemplate;
|
|
|
private JSONObject jsonObject;
|
|
|
|
|
@@ -52,7 +52,7 @@ public class ViewMultiplierStrategy implements ScoreStrategy {
|
|
|
if (Objects.nonNull(articleDTO) && Objects.nonNull(datastatDTO)) {
|
|
|
double avgReadCount = getAvgReadCount(articleDTO.getAccountId(), articleDTO.getItemIndex());
|
|
|
Integer readCount = datastatDTO.getReadCount();
|
|
|
- score.setScore(NormalizationUtils.min(readCount / avgReadCount - 1));
|
|
|
+ score.setScore(NormalizationUtils.min(Math.max(readCount, 0) / avgReadCount - 1));
|
|
|
} else {
|
|
|
score.setScore(-1.0);
|
|
|
}
|