mirror of
https://github.com/tiennm99/store-scraper-bot-java.git
synced 2026-05-14 11:53:03 +00:00
feat(app score): round score
This commit is contained in:
@@ -26,6 +26,7 @@ dependencies {
|
||||
implementation("com.couchbase.client:java-client:3.7.6")
|
||||
implementation("com.google.code.gson:gson:2.11.0")
|
||||
implementation("com.google.guava:guava:33.4.0-jre")
|
||||
implementation("org.apache.commons:commons-math3:3.6.1")
|
||||
implementation("org.apache.logging.log4j:log4j-core:2.24.3")
|
||||
implementation("org.apache.logging.log4j:log4j-slf4j2-impl:2.24.3")
|
||||
implementation("org.telegram:telegrambots-client:8.0.0")
|
||||
|
||||
@@ -6,12 +6,14 @@ import com.miti99.storescraperbot.bot.StoreScrapeBotTelegramClient;
|
||||
import com.miti99.storescraperbot.bot.table.Table;
|
||||
import com.miti99.storescraperbot.repository.AdminRepository;
|
||||
import com.miti99.storescraperbot.repository.GroupRepository;
|
||||
import org.apache.commons.math3.util.Precision;
|
||||
import org.telegram.telegrambots.meta.api.objects.User;
|
||||
import org.telegram.telegrambots.meta.api.objects.chat.Chat;
|
||||
import org.telegram.telegrambots.meta.generics.TelegramClient;
|
||||
|
||||
public class CheckAppScoreCommand extends BaseStoreScraperBotCommand {
|
||||
public static final CheckAppScoreCommand INSTANCE = new CheckAppScoreCommand();
|
||||
public static final int SCORE_ROUNDING_SCALE = 1;
|
||||
|
||||
CheckAppScoreCommand() {
|
||||
super("checkappscore", "Kiểm tra điểm đánh giá các app (sao)");
|
||||
@@ -42,7 +44,8 @@ public class CheckAppScoreCommand extends BaseStoreScraperBotCommand {
|
||||
for (var app : group.getAppleApps()) {
|
||||
var appId = app.appId();
|
||||
var country = app.country();
|
||||
double score = AppStoreScraper.getAppScore(appId, country);
|
||||
double score =
|
||||
Precision.round(AppStoreScraper.getAppScore(appId, country), SCORE_ROUNDING_SCALE);
|
||||
long ratings = AppStoreScraper.getAppRatings(appId, country);
|
||||
appleTable.addRow(appId, score, ratings);
|
||||
}
|
||||
@@ -55,7 +58,8 @@ public class CheckAppScoreCommand extends BaseStoreScraperBotCommand {
|
||||
for (var app : group.getGoogleApps()) {
|
||||
var appId = app.appId();
|
||||
var country = app.country();
|
||||
double score = GooglePlayScraper.getAppScore(appId, country);
|
||||
double score =
|
||||
Precision.round(GooglePlayScraper.getAppScore(appId, country), SCORE_ROUNDING_SCALE);
|
||||
long ratings = GooglePlayScraper.getAppRatings(appId, country);
|
||||
googleTable.addRow(appId, score, ratings);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user