mirror of
https://github.com/MewoLab/AquaDX.git
synced 2026-02-15 01:37:28 +08:00
[F] Fix ongeki upsert all: UserData might be empty list
This commit is contained in:
@@ -98,11 +98,17 @@ public class UpsertUserAllHandler implements BaseHandler {
|
||||
|
||||
// All the field should exist, no need to check now.
|
||||
// UserData
|
||||
UserData newUserData;
|
||||
{
|
||||
UserData userData;
|
||||
UserData newUserData = upsertUserAll.getUserData().get(0);
|
||||
|
||||
Optional<UserData> userOptional = userDataRepository.findByCard_ExtId(userId);
|
||||
|
||||
// UserData might be empty on later runs
|
||||
if (userOptional.isEmpty() && upsertUserAll.getUserData().isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (userOptional.isPresent()) {
|
||||
userData = userOptional.get();
|
||||
} else {
|
||||
@@ -111,6 +117,9 @@ public class UpsertUserAllHandler implements BaseHandler {
|
||||
userData.setCard(card);
|
||||
}
|
||||
|
||||
// If new data exists, use new data. Otherwise, use old data
|
||||
newUserData = !upsertUserAll.getUserData().isEmpty() ? upsertUserAll.getUserData().get(0) : userData;
|
||||
|
||||
newUserData.setId(userData.getId());
|
||||
newUserData.setCard(userData.getCard());
|
||||
|
||||
@@ -119,6 +128,7 @@ public class UpsertUserAllHandler implements BaseHandler {
|
||||
newUserData.setCmEventWatchedDate(userData.getLastPlayDate());
|
||||
|
||||
userDataRepository.save(newUserData);
|
||||
}
|
||||
|
||||
|
||||
// UserOption
|
||||
|
||||
Reference in New Issue
Block a user