mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-09-13 15:28:13 +02:00
[Debt] RecentLoginList construction, add Formatter
Added Formatter<Long> to RecentLoginList constructor.
This commit is contained in:
parent
f26294d9dd
commit
57377ece82
@ -269,8 +269,8 @@ public class AnalysisContainer extends DataContainer {
|
||||
putSupplier(AnalysisKeys.SESSION_ACCORDION_FUNCTIONS, () -> getUnsafe(sessionAccordion).toViewScript());
|
||||
|
||||
putSupplier(AnalysisKeys.RECENT_LOGINS, () -> new RecentLoginList(
|
||||
serverContainer.getValue(ServerKeys.PLAYERS).orElse(new ArrayList<>())
|
||||
).toHtml()
|
||||
serverContainer.getValue(ServerKeys.PLAYERS).orElse(new ArrayList<>()),
|
||||
secondLongFormatter).toHtml()
|
||||
);
|
||||
putSupplier(AnalysisKeys.SESSION_TABLE, () -> tables.serverSessionTable(
|
||||
getUnsafe(AnalysisKeys.PLAYER_NAMES), getUnsafe(AnalysisKeys.SESSIONS_MUTATOR).all()).parseHtml()
|
||||
|
@ -5,7 +5,6 @@ import com.djrapitops.plan.data.container.Session;
|
||||
import com.djrapitops.plan.data.store.containers.PlayerContainer;
|
||||
import com.djrapitops.plan.data.store.keys.PlayerKeys;
|
||||
import com.djrapitops.plan.data.store.keys.SessionKeys;
|
||||
import com.djrapitops.plan.data.store.objects.DateHolder;
|
||||
import com.djrapitops.plan.utilities.comparators.SessionStartComparator;
|
||||
import com.djrapitops.plan.utilities.formatting.Formatter;
|
||||
|
||||
@ -23,13 +22,13 @@ import java.util.concurrent.TimeUnit;
|
||||
*/
|
||||
public class RecentLoginList {
|
||||
|
||||
// TODO
|
||||
private Formatter<DateHolder> secondFormatter;
|
||||
|
||||
private final List<PlayerContainer> players;
|
||||
|
||||
public RecentLoginList(List<PlayerContainer> players) {
|
||||
private final Formatter<Long> secondLongFormatter;
|
||||
|
||||
public RecentLoginList(List<PlayerContainer> players, Formatter<Long> secondLongFormatter) {
|
||||
this.players = players;
|
||||
this.secondLongFormatter = secondLongFormatter;
|
||||
}
|
||||
|
||||
public String toHtml() {
|
||||
@ -49,7 +48,7 @@ public class RecentLoginList {
|
||||
String name = recentLogin.name;
|
||||
String url = PlanAPI.getInstance().getPlayerInspectPageLink(name);
|
||||
boolean isNew = recentLogin.isNew;
|
||||
String start = secondFormatter.apply(recentLogin);
|
||||
String start = secondLongFormatter.apply(recentLogin.date);
|
||||
|
||||
html.append("<li><a class=\"col-").append(isNew ? "light-green" : "blue").append(" font-bold\" href=\"").append(url)
|
||||
.append("\">").append(name).append("</a><span class=\"pull-right\">").append(start).append("</span></li>");
|
||||
@ -87,7 +86,7 @@ public class RecentLoginList {
|
||||
return recentLogins;
|
||||
}
|
||||
|
||||
class RecentLogin implements DateHolder {
|
||||
class RecentLogin {
|
||||
final long date;
|
||||
final boolean isNew;
|
||||
final String name;
|
||||
@ -112,11 +111,6 @@ public class RecentLoginList {
|
||||
public int hashCode() {
|
||||
return Objects.hash(date, isNew, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getDate() {
|
||||
return date;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user