Skip to content

Commit

Permalink
Fixed bug where role_id was attemping to be set to null causing a fai…
Browse files Browse the repository at this point in the history
…led contraint check
  • Loading branch information
cicchr committed Jan 21, 2019
1 parent 0246f77 commit c637756
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion libaris/src/main/resources/edu/rpi/aris/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.161
0.0.162
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public String getClassName() {
public ErrorType processMessage(@NotNull Connection connection, @NotNull User user, @NotNull ServerPermissions permissions) throws SQLException {
try (PreparedStatement insertClass = connection.prepareStatement("INSERT INTO class (name) VALUES(?);");
PreparedStatement selectClassId = connection.prepareStatement("SELECT id FROM class ORDER BY id DESC LIMIT 1;");
PreparedStatement insertUserClass = connection.prepareStatement("INSERT INTO user_class VALUES(?, ?);")) {
PreparedStatement insertUserClass = connection.prepareStatement("INSERT INTO user_class VALUES(?, ?, ?);")) {
insertClass.setString(1, name);
insertClass.executeUpdate();
try (ResultSet rs = selectClassId.executeQuery()) {
Expand All @@ -49,6 +49,7 @@ public ErrorType processMessage(@NotNull Connection connection, @NotNull User us
}
insertUserClass.setInt(1, user.uid);
insertUserClass.setInt(2, cid);
insertUserClass.setInt(3, user.defaultRole.getId());
insertUserClass.executeUpdate();
}
return null;
Expand Down
2 changes: 1 addition & 1 deletion libassign/src/main/resources/edu/rpi/aris/assign/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.161
0.0.162

0 comments on commit c637756

Please sign in to comment.