From f9a423b45727961d7263254852870aad4e87e5cd Mon Sep 17 00:00:00 2001 From: Colin McDonald Date: Sun, 17 Jul 2016 00:20:27 -0400 Subject: [PATCH] Make converter changes for push to production --- .../java/net/frozenorb/apiv3/dataImport/V2Importer.java | 3 ++- .../apiv3/dataImport/converters/GrantConverter.java | 4 +++- .../apiv3/dataImport/converters/PunishmentConverter.java | 8 ++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/frozenorb/apiv3/dataImport/V2Importer.java b/src/main/java/net/frozenorb/apiv3/dataImport/V2Importer.java index 03d7de0..c747c0f 100644 --- a/src/main/java/net/frozenorb/apiv3/dataImport/V2Importer.java +++ b/src/main/java/net/frozenorb/apiv3/dataImport/V2Importer.java @@ -39,7 +39,8 @@ public final class V2Importer { importFrom.getCollection("punishment").find().forEach(new PunishmentConverter(oidToUniqueId), new MongoToVertxCallback<>(punishmentsFuture)); importFrom.getCollection("grant").find().forEach(new GrantConverter(oidToUniqueId), new MongoToVertxCallback<>(grantsFuture)); - importFrom.getCollection("iplog").find().forEach(new IpLogConverter(oidToUniqueId), new MongoToVertxCallback<>(ipLogFuture)); + //importFrom.getCollection("iplog").find().forEach(new IpLogConverter(oidToUniqueId), new MongoToVertxCallback<>(ipLogFuture)); + ipLogFuture.complete(); CompositeFuture.all(punishmentsFuture, grantsFuture, ipLogFuture).setHandler((result) -> { if (result.succeeded()) { diff --git a/src/main/java/net/frozenorb/apiv3/dataImport/converters/GrantConverter.java b/src/main/java/net/frozenorb/apiv3/dataImport/converters/GrantConverter.java index 1ddb6cd..b516beb 100644 --- a/src/main/java/net/frozenorb/apiv3/dataImport/converters/GrantConverter.java +++ b/src/main/java/net/frozenorb/apiv3/dataImport/converters/GrantConverter.java @@ -36,11 +36,13 @@ public final class GrantConverter implements Block { if (rank.equalsIgnoreCase("unban") || rank.equalsIgnoreCase("pass") || rank.equalsIgnoreCase("pink") || rank.equalsIgnoreCase("jrdev")) { return; } else if (rank.equalsIgnoreCase("high_roller")) { - rank = "high-roller"; + rank = "highroller"; } else if (rank.equalsIgnoreCase("dev")) { rank = "developer"; } else if (rank.equalsIgnoreCase("coowner")) { rank = "owner"; + } else if (rank.equalsIgnoreCase("youtuber")) { + rank = "famous"; } Grant created = new Grant( diff --git a/src/main/java/net/frozenorb/apiv3/dataImport/converters/PunishmentConverter.java b/src/main/java/net/frozenorb/apiv3/dataImport/converters/PunishmentConverter.java index e302e98..e098378 100644 --- a/src/main/java/net/frozenorb/apiv3/dataImport/converters/PunishmentConverter.java +++ b/src/main/java/net/frozenorb/apiv3/dataImport/converters/PunishmentConverter.java @@ -9,9 +9,11 @@ import net.frozenorb.apiv3.util.SyncUtils; import org.bson.Document; import org.bson.types.ObjectId; +import java.time.Instant; import java.util.List; import java.util.Map; import java.util.UUID; +import java.util.concurrent.TimeUnit; @Slf4j public final class PunishmentConverter implements Block { @@ -36,6 +38,12 @@ public final class PunishmentConverter implements Block { return; } + Instant twoWeeks = Instant.now().minusSeconds(TimeUnit.DAYS.toSeconds(14)); + + if (punishment.getDate("created").toInstant().isBefore(twoWeeks)) { + return; + } + Punishment created = new Punishment( new ObjectId().toString(), target,