Fix BugsnagSLF4JLogger and sort staff response by rank weight

This commit is contained in:
Francisco Saldanha 2016-05-09 16:36:14 -03:00
parent 0c6ac74792
commit 7a10f1f70d
3 changed files with 14 additions and 8 deletions

View File

@ -39,7 +39,7 @@ import net.frozenorb.apiv3.routes.users.*;
import net.frozenorb.apiv3.serialization.DateTypeAdapter;
import net.frozenorb.apiv3.serialization.FollowAnnotationExclusionStrategy;
import net.frozenorb.apiv3.serialization.ObjectIdTypeAdapter;
import net.frozenorb.apiv3.unsorted.BugsnagSLF4jLogger;
import net.frozenorb.apiv3.unsorted.BugsnagSLF4JLogger;
import net.frozenorb.apiv3.unsorted.LoggingExceptionHandler;
import org.bson.types.ObjectId;
import org.mongodb.morphia.Datastore;
@ -144,7 +144,7 @@ public final class APIv3 {
Client bugsnag = new Client(config.getProperty("bugsnag.apiKey"));
bugsnag.setReleaseStage(config.getProperty("general.releaseStage"));
bugsnag.setProjectPackages("net.frozenorb.apiv3");
bugsnag.setLogger(new BugsnagSLF4jLogger());
bugsnag.setLogger(new BugsnagSLF4JLogger());
}
private void setupHttp() {

View File

@ -8,10 +8,7 @@ import spark.Request;
import spark.Response;
import spark.Route;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.*;
public final class GETStaff implements Route {
@ -24,7 +21,16 @@ public final class GETStaff implements Route {
}
});
Map<String, Set<User>> result = new HashMap<>();
Map<String, Set<User>> result = new TreeMap<>((Comparator<String>) (first, second) -> {
Rank firstRank = Rank.byId(first);
Rank secondRank = Rank.byId(second);
if (firstRank.getWeight() > secondRank.getWeight()) {
return -1;
}
return 1;
});
APIv3.getDatastore().createQuery(Grant.class).field("rank").in(staffRanks.keySet()).forEach(grant -> {
if (grant.isActive()) {

View File

@ -4,7 +4,7 @@ import com.bugsnag.Logger;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class BugsnagSLF4jLogger extends Logger {
public class BugsnagSLF4JLogger extends Logger {
public void debug(String message) {
log.debug(message);