forked from Cookies_Github_mirror/AquaDX
[chuni] Update rating calculation
This commit is contained in:
@@ -50,7 +50,7 @@ public class GetUserMusicHandler implements BaseHandler {
|
||||
}
|
||||
|
||||
Page<UserMusicDetail> dbPage = userMusicDetailService
|
||||
.getByUser(userId, OffsetPageRequest.of(currentIndex, maxCount, Sort.by("musicId")));
|
||||
.getByUserId(userId, OffsetPageRequest.of(currentIndex, maxCount, Sort.by("musicId")));
|
||||
|
||||
|
||||
// Convert to result format
|
||||
|
||||
@@ -33,18 +33,14 @@ public class UserMusicDetailService {
|
||||
return userMusicDetailRepository.saveAll(userMusicDetail);
|
||||
}
|
||||
|
||||
public List<UserMusicDetail> getByUser(String userId) {
|
||||
return userMusicDetailRepository.findByUser_Card_ExtId(Integer.parseInt(userId));
|
||||
}
|
||||
|
||||
public Page<UserMusicDetail> getByUser(String userId, Pageable page) {
|
||||
return userMusicDetailRepository.findByUser_Card_ExtId(Integer.parseInt(userId), page);
|
||||
}
|
||||
|
||||
public List<UserMusicDetail> getByUserId(String userId) {
|
||||
return userMusicDetailRepository.findByUser_Card_ExtId(Integer.parseInt(userId));
|
||||
}
|
||||
|
||||
public Page<UserMusicDetail> getByUserId(String userId, Pageable page) {
|
||||
return userMusicDetailRepository.findByUser_Card_ExtId(Integer.parseInt(userId), page);
|
||||
}
|
||||
|
||||
public List<UserMusicDetail> getByUserIdAndMusicId(String userId, int musicId) {
|
||||
return userMusicDetailRepository.findByUser_Card_ExtIdAndMusicId(Integer.parseInt(userId), musicId);
|
||||
}
|
||||
|
||||
17
src/main/java/icu/samnyan/aqua/sega/util/VersionInfo.java
Normal file
17
src/main/java/icu/samnyan/aqua/sega/util/VersionInfo.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package icu.samnyan.aqua.sega.util;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author sam_nya (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class VersionInfo {
|
||||
private Integer majorVersion;
|
||||
private Integer minorVersion;
|
||||
private Integer releaseVersion;
|
||||
}
|
||||
@@ -2,6 +2,26 @@ package icu.samnyan.aqua.sega.util;
|
||||
|
||||
public class VersionUtil {
|
||||
|
||||
public static VersionInfo parseVersion(String version) {
|
||||
var vs = version.split("\\.");
|
||||
try {
|
||||
VersionInfo v = new VersionInfo();
|
||||
if (vs.length > 0) {
|
||||
v.setMajorVersion(Integer.parseInt(vs[0]));
|
||||
}
|
||||
if (vs.length > 1) {
|
||||
v.setMinorVersion(Integer.parseInt(vs[1]));
|
||||
}
|
||||
if (vs.length > 2) {
|
||||
v.setReleaseVersion(Integer.parseInt(vs[2]));
|
||||
}
|
||||
return v;
|
||||
} catch (Exception e) {
|
||||
return new VersionInfo(0, 0, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static String getTargetVersion(String savedVersion, String currentVersion) {
|
||||
var v1s = savedVersion.split("\\.");
|
||||
var v2s = currentVersion.split("\\.");
|
||||
|
||||
Reference in New Issue
Block a user