mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-02-15 20:02:13 +01:00
Removed lastSeen from UserInfo
This variable has not been in use since the date is not stored on a specific field, instead plan_sessions should be used.
This commit is contained in:
parent
40a1325c48
commit
19336d77df
@ -29,7 +29,6 @@ public class UserInfo {
|
||||
private final UUID uuid;
|
||||
private String name;
|
||||
private long registered;
|
||||
private long lastSeen;
|
||||
private boolean banned;
|
||||
private boolean opped;
|
||||
|
||||
@ -39,7 +38,6 @@ public class UserInfo {
|
||||
this.registered = registered;
|
||||
this.opped = opped;
|
||||
this.banned = banned;
|
||||
lastSeen = 0L;
|
||||
}
|
||||
|
||||
public UUID getUuid() {
|
||||
@ -54,14 +52,6 @@ public class UserInfo {
|
||||
return registered;
|
||||
}
|
||||
|
||||
public long getLastSeen() {
|
||||
return lastSeen;
|
||||
}
|
||||
|
||||
public void setLastSeen(long lastSeen) {
|
||||
this.lastSeen = lastSeen;
|
||||
}
|
||||
|
||||
public boolean isBanned() {
|
||||
return banned;
|
||||
}
|
||||
@ -76,7 +66,6 @@ public class UserInfo {
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
UserInfo userInfo = (UserInfo) o;
|
||||
return registered == userInfo.registered &&
|
||||
lastSeen == userInfo.lastSeen &&
|
||||
banned == userInfo.banned &&
|
||||
opped == userInfo.opped &&
|
||||
Objects.equals(uuid, userInfo.uuid) &&
|
||||
@ -85,7 +74,7 @@ public class UserInfo {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(uuid, name, registered, lastSeen, banned, opped);
|
||||
return Objects.hash(uuid, name, registered, banned, opped);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -94,7 +83,6 @@ public class UserInfo {
|
||||
"uuid=" + uuid +
|
||||
", name='" + name + '\'' +
|
||||
", registered=" + registered +
|
||||
", lastSeen=" + lastSeen +
|
||||
", banned=" + banned +
|
||||
", opped=" + opped +
|
||||
'}';
|
||||
|
@ -17,6 +17,7 @@
|
||||
package com.djrapitops.plan.db.access.transactions;
|
||||
|
||||
import com.djrapitops.plan.db.Database;
|
||||
import com.djrapitops.plan.db.SQLDB;
|
||||
import com.djrapitops.plan.db.access.Executable;
|
||||
import com.djrapitops.plan.db.access.Query;
|
||||
import com.djrapitops.plan.db.sql.queries.LargeFetchQueries;
|
||||
@ -102,7 +103,7 @@ public class BackupCopyTransaction extends RemoveEverythingTransaction {
|
||||
}
|
||||
|
||||
private void copyUsers() {
|
||||
UsersTable fromTable = db.getUsersTable();
|
||||
UsersTable fromTable = ((SQLDB) sourceDB).getUsersTable();
|
||||
UsersTable toTable = db.getUsersTable();
|
||||
|
||||
toTable.insertUsers(sourceDB.query(LargeFetchQueries.fetchAllCommonUserInformation()));
|
||||
|
@ -1,34 +0,0 @@
|
||||
/*
|
||||
* This file is part of Player Analytics (Plan).
|
||||
*
|
||||
* Plan is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License v3 as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Plan is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Plan. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.djrapitops.plan.utilities.comparators;
|
||||
|
||||
import com.djrapitops.plan.data.container.UserInfo;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
/**
|
||||
* Comparator for UserInfo so that most recently seen is first.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class UserInfoLastPlayedComparator implements Comparator<UserInfo> {
|
||||
|
||||
@Override
|
||||
public int compare(UserInfo u1, UserInfo u2) {
|
||||
return Long.compare(u2.getLastSeen(), u1.getLastSeen());
|
||||
}
|
||||
}
|
@ -78,19 +78,6 @@ public class ComparatorTest {
|
||||
assertEquals(expected, result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void userDataLastPlayedComparator() {
|
||||
List<UserInfo> userInfo = RandomData.randomUserData();
|
||||
|
||||
List<Long> expected = userInfo.stream().map(UserInfo::getLastSeen)
|
||||
.sorted(Long::compare).collect(Collectors.toList());
|
||||
Collections.reverse(expected);
|
||||
|
||||
userInfo.sort(new UserInfoLastPlayedComparator());
|
||||
List<Long> result = userInfo.stream().map(UserInfo::getLastSeen).collect(Collectors.toList());
|
||||
assertEquals(expected, result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void userDataNameComparator() {
|
||||
List<UserInfo> userInfo = RandomData.randomUserData();
|
||||
|
@ -90,7 +90,6 @@ public class RandomData {
|
||||
List<UserInfo> test = new ArrayList<>();
|
||||
for (int i = 0; i < 20; i++) {
|
||||
UserInfo info = new UserInfo(UUID.randomUUID(), randomString(10), r.nextLong(), r.nextBoolean(), r.nextBoolean());
|
||||
info.setLastSeen(r.nextLong());
|
||||
test.add(info);
|
||||
}
|
||||
return test;
|
||||
|
Loading…
Reference in New Issue
Block a user