Fixed ORDER BY gaffe. Because I'm dumb.

This commit is contained in:
Aleksei 2020-02-19 23:44:42 -05:00
parent 504630e191
commit 9b2a22727c

View File

@ -49,7 +49,7 @@ public class OutfitController {
public static Outfit findRandom() throws SQLException { public static Outfit findRandom() throws SQLException {
Outfit outfit = new Outfit(); Outfit outfit = new Outfit();
try (ResultSet rs = FSDB.get().select("SELECT * FROM outfits WHERE deleted = 0 ORDERBY random() LIMIT 1")) { try (ResultSet rs = FSDB.get().select("SELECT * FROM outfits WHERE deleted = 0 ORDER BY random() LIMIT 1")) {
if (rs.next()) { if (rs.next()) {
outfit = mapObject(rs); outfit = mapObject(rs);
} }
@ -62,7 +62,7 @@ public class OutfitController {
public static Outfit findRandomByTag(String tag) { public static Outfit findRandomByTag(String tag) {
Outfit outfit = new Outfit(); Outfit outfit = new Outfit();
try (ResultSet rs = FSDB.get().select("SELECT * FROM outfits WHERE tag = ? AND deleted = 0 ORDERBY random() LIMIT 1", tag)) { try (ResultSet rs = FSDB.get().select("SELECT * FROM outfits WHERE tag = ? AND deleted = 0 ORDER BY random() LIMIT 1", tag)) {
if (rs.next()) { if (rs.next()) {
outfit = mapObject(rs); outfit = mapObject(rs);
} }
@ -75,7 +75,7 @@ public class OutfitController {
public static Outfit findRandomBySubmitter(String submitterId) { public static Outfit findRandomBySubmitter(String submitterId) {
Outfit outfit = new Outfit(); Outfit outfit = new Outfit();
try (ResultSet rs = FSDB.get().select("SELECT * FROM outfits WHERE submitter = ? AND deleted = 0 ORDERBY random() LIMIT 1", submitterId)) { try (ResultSet rs = FSDB.get().select("SELECT * FROM outfits WHERE submitter = ? AND deleted = 0 ORDER BY random() LIMIT 1", submitterId)) {
if (rs.next()) { if (rs.next()) {
outfit = mapObject(rs); outfit = mapObject(rs);
} }