Skip to content

Commit

Permalink
revert changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobasco99 committed Aug 14, 2024
1 parent 61770ec commit 30d063a
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import java.nio.file.Files;
import java.nio.file.Paths;

import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import services.tmitocar.pojo.LrsCredentials;
import services.tmitocar.pojo.TmitocarResponse;
import services.tmitocar.pojo.TmitocarText;
Expand Down Expand Up @@ -463,8 +462,7 @@ public ResponseEntity<String> getAnalyzedText(@PathVariable("label1") String lab
*
* @param label1 the first label (user text)
* @param label2 the second label (expert or second user text)
* @param textInputStream the InputStream containing the text to compare
* @param textFileDetail the file details of the text file
* @param file the InputStream containing the text to compare
* @param type the type of text (text, pdf or docx)
* @param template the template to use for the PDF report
* @param wordSpec the word specification for the PDF report
Expand All @@ -478,7 +476,7 @@ public ResponseEntity<String> getAnalyzedText(@PathVariable("label1") String lab
@ApiResponse(responseCode = "500", description = "Response failed.")
})
@PostMapping(value = "/compareText" , consumes = MediaType.MULTIPART_FORM_DATA, produces = MediaType.APPLICATION_JSON)
public ResponseEntity<String> compareText(@RequestParam("label1") String label1, @RequestParam("label2") String label2, @FormDataParam("file") InputStream textInputStream, @FormDataParam("file") FormDataContentDisposition textFileDetail,
public ResponseEntity<String> compareText(@RequestParam("label1") String label1, @RequestParam("label2") String label2, @FormDataParam("file") MultipartFile file,
@FormDataParam("type") String type, @FormDataParam("template") String template,
@FormDataParam("wordSpec") String wordSpec,@FormDataParam("email") String email,@FormDataParam("courseId") int courseId, @FormDataParam("sbfmURL") String sbfmURL) throws ParseException, IOException {
if (service.isActive.getOrDefault(label1, false)) {
Expand All @@ -499,6 +497,7 @@ public ResponseEntity<String> compareText(@RequestParam("label1") String label1,
service.isActive.put(label1, true);

String topic = service.getTaskNameByIds(courseId, Integer.parseInt(label2));
InputStream textInputStream = file.getInputStream();

String encodedByteString = service.convertInputStreamToBase64(textInputStream);
TmitocarText tmitoBody = new TmitocarText();
Expand All @@ -509,7 +508,7 @@ public ResponseEntity<String> compareText(@RequestParam("label1") String label1,
tmitoBody.setText(encodedByteString);
tmitoBody.setUuid(email);
byte[] bytes = Base64.getDecoder().decode(encodedByteString);
String fname = textFileDetail.getFileName();
String fname = file.getOriginalFilename();
String fileEnding = "txt";
int dotIndex = fname.lastIndexOf('.');
if (dotIndex > 0 && dotIndex < fname.length() - 1) {
Expand Down

0 comments on commit 30d063a

Please sign in to comment.