Add setReviewed method to build repository
This commit is contained in:
parent
99027258ee
commit
1141a05310
@ -93,7 +93,7 @@ public class MavericksRepository
|
|||||||
try (Connection conn = DBPool.getAccount().getConnection())
|
try (Connection conn = DBPool.getAccount().getConnection())
|
||||||
{
|
{
|
||||||
String filter = onlyUnreviewed ? "WHERE Reviewed=0 " : "";
|
String filter = onlyUnreviewed ? "WHERE Reviewed=0 " : "";
|
||||||
PreparedStatement stmt = conn.prepareStatement("SELECT (SELECT uuid FROM accounts WHERE accounts.id=mavericksMasterBuildersBuilds.accountId),BuildTheme,Points,Place,Date,Schematic FROM mavericksMasterBuildersBuilds " + filter + " ORDER BY Points LIMIT " + limit + " OFFSET " + offset);
|
PreparedStatement stmt = conn.prepareStatement("SELECT (SELECT uuid FROM accounts WHERE accounts.id=" + TABLE + ".accountId),BuildTheme,Points,Place,Date,Schematic FROM " + TABLE + " " + filter + " ORDER BY Points LIMIT " + limit + " OFFSET " + offset);
|
||||||
|
|
||||||
ResultSet set = stmt.executeQuery();
|
ResultSet set = stmt.executeQuery();
|
||||||
List<MavericksBuildWrapper> list = new ArrayList<>();
|
List<MavericksBuildWrapper> list = new ArrayList<>();
|
||||||
@ -116,4 +116,24 @@ public class MavericksRepository
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CompletableFuture<Boolean> setReviewed(long dateStamp, boolean reviewed)
|
||||||
|
{
|
||||||
|
return CompletableFuture.supplyAsync(() ->
|
||||||
|
{
|
||||||
|
try (Connection conn = DBPool.getAccount().getConnection())
|
||||||
|
{
|
||||||
|
|
||||||
|
PreparedStatement stmt = conn.prepareStatement("UPDATE " + TABLE + " SET Reviewed=? WHERE Date=?");
|
||||||
|
stmt.setInt(1, reviewed? 1 : 0);
|
||||||
|
stmt.setLong(2, dateStamp);
|
||||||
|
|
||||||
|
return stmt.executeUpdate() > 0;
|
||||||
|
}
|
||||||
|
catch(SQLException e)
|
||||||
|
{
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user