Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Yinnii committed May 24, 2024
2 parents b7574ee + 324695e commit fba37a1
Showing 1 changed file with 29 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,6 @@ public boolean llm_feedback(@PathParam("label1") String label1, @PathParam("labe
System.out.println("Block " + label1);
JSONObject error = new JSONObject();
JSONObject newText = new JSONObject();

CodecRegistry pojoCodecRegistry = fromProviders(PojoCodecProvider.builder().automatic(true).build());
CodecRegistry codecRegistry = fromRegistries(MongoClientSettings.getDefaultCodecRegistry(), pojoCodecRegistry);
MongoClientSettings settings = MongoClientSettings.builder()
Expand All @@ -446,40 +445,27 @@ public boolean llm_feedback(@PathParam("label1") String label1, @PathParam("labe
@Override
public void run() {
String[] courseAndTask = label2.split("-");
int basisId = 0;
int courseId = Integer.parseInt(courseAndTask[0]);
Connection conn = null;
PreparedStatement stmt = null;
ResultSet rs = null;

storeFileLocally(label1, body.getText(), body.getType());
System.out.println("Upload text");

try {
int basisId = 0;

conn = service.getConnection();
stmt = conn.prepareStatement("SELECT * FROM course WHERE id = ? ORDER BY id ASC");
stmt.setInt(1, courseId);
rs = stmt.executeQuery();
basisId = rs.getInt("basecourseid");
} catch (SQLException e) {
e.printStackTrace();
} finally {
try {
if (rs != null) {
rs.close();
}
if (stmt != null) {
stmt.close();
}
if (conn != null) {
conn.close();
}
} catch (SQLException ex) {
System.out.println(ex.getMessage());
while (rs.next()) {
basisId = rs.getInt("basecourseid");
System.out.println("BasecourseID is: " + basisId);
}
}

storeFileLocally(label1, body.getText(), body.getType());
System.out.println("Upload text");

try {
String taskNr = basisId + "-" + courseAndTask[1];
System.out.println("New taskNr is: " + taskNr);
// Store usertext with label
String wordspec = body.getWordSpec();
String fileName = createFileName(label1, body.getType());
Expand All @@ -504,7 +490,7 @@ public void run() {
newText.put("studentInput", userTexts.get(label1));
}

newText.put("taskNr", basisId+"-"+courseAndTask[1]);
newText.put("taskNr", taskNr);
newText.put("timestamp", System.currentTimeMillis());
System.out.println("New Text is:" + newText);

Expand Down Expand Up @@ -608,14 +594,29 @@ public void run() {
isActive.put(label1, false);
error.put("error", e.toString());
callBack(callbackUrl, label1, label1, label2, error);
}
catch (Exception e) {
} catch (SQLException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
isActive.put(label1, false);
error.put("error", e.toString());
callBack(callbackUrl, label1, label1, label2, error);
} finally {
try {
if (rs != null) {
rs.close();
}
if (stmt != null) {
stmt.close();
}
if (conn != null) {
conn.close();
}
} catch (SQLException ex) {
System.out.println(ex.getMessage());
}
}
}
}
}).start();
return true;
} catch (Exception e) {
Expand Down

0 comments on commit fba37a1

Please sign in to comment.