Make converter changes for push to production

This commit is contained in:
Colin McDonald 2016-07-17 00:20:27 -04:00
parent eb03636a6b
commit f9a423b457
3 changed files with 13 additions and 2 deletions

View File

@ -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()) {

View File

@ -36,11 +36,13 @@ public final class GrantConverter implements Block<Document> {
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(

View File

@ -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<Document> {
@ -36,6 +38,12 @@ public final class PunishmentConverter implements Block<Document> {
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,