Search is not available for this dataset
hexsha
stringlengths
40
40
repo
stringlengths
6
126
path
stringlengths
6
1.02k
license
sequence
language
stringclasses
1 value
identifier
stringlengths
1
220
return_type
stringlengths
1
110
original_string
stringlengths
39
223k
original_docstring
stringlengths
16
34.8k
docstring
stringlengths
11
3.41k
docstring_tokens
sequence
code
stringlengths
26
223k
code_tokens
sequence
short_docstring
stringlengths
0
3.02k
short_docstring_tokens
sequence
comment
sequence
parameters
list
docstring_params
dict
input_ids
sequence
attention_mask
sequence
labels
sequence
ac4d0be1ace6d1834d45f06cf20805db8495ca4c
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/web/rest/ModelingExerciseResource.java
[ "MIT" ]
Java
importExercise
null
@PostMapping("/modeling-exercises/import/{sourceExerciseId}") @PreAuthorize("hasRole('EDITOR')") public ResponseEntity<ModelingExercise> importExercise(@PathVariable long sourceExerciseId, @RequestBody ModelingExercise importedExercise) throws URISyntaxException { if (sourceExerciseId <= 0 || (importedExercise.getCourseViaExerciseGroupOrCourseMember() == null && importedExercise.getExerciseGroup() == null)) { log.debug("Either the courseId or exerciseGroupId must be set for an import"); return badRequest(); } final var originalModelingExercise = modelingExerciseRepository.findByIdWithExampleSubmissionsAndResultsElseThrow(sourceExerciseId); importedExercise.checkCourseAndExerciseGroupExclusivity("Modeling Exercise"); var user = userRepository.getUserWithGroupsAndAuthorities(); authCheckService.checkHasAtLeastRoleForExerciseElseThrow(Role.EDITOR, importedExercise, user); authCheckService.checkHasAtLeastRoleForExerciseElseThrow(Role.EDITOR, originalModelingExercise, user); // validates general settings: points, dates exerciseService.validateGeneralSettings(importedExercise); if (importedExercise.isExamExercise()) { log.debug("REST request to import text exercise {} into exercise group {}", sourceExerciseId, importedExercise.getExerciseGroup().getId()); } else { log.debug("REST request to import text exercise with {} into course {}", sourceExerciseId, importedExercise.getCourseViaExerciseGroupOrCourseMember().getId()); } final var newModelingExercise = modelingExerciseImportService.importModelingExercise(originalModelingExercise, importedExercise); modelingExerciseRepository.save(newModelingExercise); return ResponseEntity.created(new URI("/api/modeling-exercises/" + newModelingExercise.getId())) .headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, newModelingExercise.getId().toString())).body(newModelingExercise); }
/** * POST /modeling-exercises/import: Imports an existing modeling exercise into an existing course * * This will import the whole exercise except for the participations and Dates. * Referenced entities will get cloned and assigned a new id. * Uses {@link ModelingExerciseImportService}. * * @param sourceExerciseId The ID of the original exercise which should get imported * @param importedExercise The new exercise containing values that should get overwritten in the imported exercise, s.a. the title or difficulty * @throws URISyntaxException When the URI of the response entity is invalid * * @return The imported exercise (200), a not found error (404) if the template does not exist, or a forbidden error * (403) if the user is not at least an instructor in the target course. */
POST /modeling-exercises/import: Imports an existing modeling exercise into an existing course This will import the whole exercise except for the participations and Dates. Referenced entities will get cloned and assigned a new id. @param sourceExerciseId The ID of the original exercise which should get imported @param importedExercise The new exercise containing values that should get overwritten in the imported exercise, s.a. the title or difficulty @throws URISyntaxException When the URI of the response entity is invalid @return The imported exercise (200), a not found error (404) if the template does not exist, or a forbidden error (403) if the user is not at least an instructor in the target course.
[ "POST", "/", "modeling", "-", "exercises", "/", "import", ":", "Imports", "an", "existing", "modeling", "exercise", "into", "an", "existing", "course", "This", "will", "import", "the", "whole", "exercise", "except", "for", "the", "participations", "and", "Dates", ".", "Referenced", "entities", "will", "get", "cloned", "and", "assigned", "a", "new", "id", ".", "@param", "sourceExerciseId", "The", "ID", "of", "the", "original", "exercise", "which", "should", "get", "imported", "@param", "importedExercise", "The", "new", "exercise", "containing", "values", "that", "should", "get", "overwritten", "in", "the", "imported", "exercise", "s", ".", "a", ".", "the", "title", "or", "difficulty", "@throws", "URISyntaxException", "When", "the", "URI", "of", "the", "response", "entity", "is", "invalid", "@return", "The", "imported", "exercise", "(", "200", ")", "a", "not", "found", "error", "(", "404", ")", "if", "the", "template", "does", "not", "exist", "or", "a", "forbidden", "error", "(", "403", ")", "if", "the", "user", "is", "not", "at", "least", "an", "instructor", "in", "the", "target", "course", "." ]
@PostMapping("/modeling-exercises/import/{sourceExerciseId}") @PreAuthorize("hasRole('EDITOR')") public ResponseEntity<ModelingExercise> importExercise(@PathVariable long sourceExerciseId, @RequestBody ModelingExercise importedExercise) throws URISyntaxException { if (sourceExerciseId <= 0 || (importedExercise.getCourseViaExerciseGroupOrCourseMember() == null && importedExercise.getExerciseGroup() == null)) { log.debug("Either the courseId or exerciseGroupId must be set for an import"); return badRequest(); } final var originalModelingExercise = modelingExerciseRepository.findByIdWithExampleSubmissionsAndResultsElseThrow(sourceExerciseId); importedExercise.checkCourseAndExerciseGroupExclusivity("Modeling Exercise"); var user = userRepository.getUserWithGroupsAndAuthorities(); authCheckService.checkHasAtLeastRoleForExerciseElseThrow(Role.EDITOR, importedExercise, user); authCheckService.checkHasAtLeastRoleForExerciseElseThrow(Role.EDITOR, originalModelingExercise, user); exerciseService.validateGeneralSettings(importedExercise); if (importedExercise.isExamExercise()) { log.debug("REST request to import text exercise {} into exercise group {}", sourceExerciseId, importedExercise.getExerciseGroup().getId()); } else { log.debug("REST request to import text exercise with {} into course {}", sourceExerciseId, importedExercise.getCourseViaExerciseGroupOrCourseMember().getId()); } final var newModelingExercise = modelingExerciseImportService.importModelingExercise(originalModelingExercise, importedExercise); modelingExerciseRepository.save(newModelingExercise); return ResponseEntity.created(new URI("/api/modeling-exercises/" + newModelingExercise.getId())) .headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, newModelingExercise.getId().toString())).body(newModelingExercise); }
[ "@", "PostMapping", "(", "\"/modeling-exercises/import/{sourceExerciseId}\"", ")", "@", "PreAuthorize", "(", "\"hasRole('EDITOR')\"", ")", "public", "ResponseEntity", "<", "ModelingExercise", ">", "importExercise", "(", "@", "PathVariable", "long", "sourceExerciseId", ",", "@", "RequestBody", "ModelingExercise", "importedExercise", ")", "throws", "URISyntaxException", "{", "if", "(", "sourceExerciseId", "<=", "0", "||", "(", "importedExercise", ".", "getCourseViaExerciseGroupOrCourseMember", "(", ")", "==", "null", "&&", "importedExercise", ".", "getExerciseGroup", "(", ")", "==", "null", ")", ")", "{", "log", ".", "debug", "(", "\"Either the courseId or exerciseGroupId must be set for an import\"", ")", ";", "return", "badRequest", "(", ")", ";", "}", "final", "var", "originalModelingExercise", "=", "modelingExerciseRepository", ".", "findByIdWithExampleSubmissionsAndResultsElseThrow", "(", "sourceExerciseId", ")", ";", "importedExercise", ".", "checkCourseAndExerciseGroupExclusivity", "(", "\"Modeling Exercise\"", ")", ";", "var", "user", "=", "userRepository", ".", "getUserWithGroupsAndAuthorities", "(", ")", ";", "authCheckService", ".", "checkHasAtLeastRoleForExerciseElseThrow", "(", "Role", ".", "EDITOR", ",", "importedExercise", ",", "user", ")", ";", "authCheckService", ".", "checkHasAtLeastRoleForExerciseElseThrow", "(", "Role", ".", "EDITOR", ",", "originalModelingExercise", ",", "user", ")", ";", "exerciseService", ".", "validateGeneralSettings", "(", "importedExercise", ")", ";", "if", "(", "importedExercise", ".", "isExamExercise", "(", ")", ")", "{", "log", ".", "debug", "(", "\"REST request to import text exercise {} into exercise group {}\"", ",", "sourceExerciseId", ",", "importedExercise", ".", "getExerciseGroup", "(", ")", ".", "getId", "(", ")", ")", ";", "}", "else", "{", "log", ".", "debug", "(", "\"REST request to import text exercise with {} into course {}\"", ",", "sourceExerciseId", ",", "importedExercise", ".", "getCourseViaExerciseGroupOrCourseMember", "(", ")", ".", "getId", "(", ")", ")", ";", "}", "final", "var", "newModelingExercise", "=", "modelingExerciseImportService", ".", "importModelingExercise", "(", "originalModelingExercise", ",", "importedExercise", ")", ";", "modelingExerciseRepository", ".", "save", "(", "newModelingExercise", ")", ";", "return", "ResponseEntity", ".", "created", "(", "new", "URI", "(", "\"/api/modeling-exercises/\"", "+", "newModelingExercise", ".", "getId", "(", ")", ")", ")", ".", "headers", "(", "HeaderUtil", ".", "createEntityCreationAlert", "(", "applicationName", ",", "true", ",", "ENTITY_NAME", ",", "newModelingExercise", ".", "getId", "(", ")", ".", "toString", "(", ")", ")", ")", ".", "body", "(", "newModelingExercise", ")", ";", "}" ]
POST /modeling-exercises/import: Imports an existing modeling exercise into an existing course This will import the whole exercise except for the participations and Dates.
[ "POST", "/", "modeling", "-", "exercises", "/", "import", ":", "Imports", "an", "existing", "modeling", "exercise", "into", "an", "existing", "course", "This", "will", "import", "the", "whole", "exercise", "except", "for", "the", "participations", "and", "Dates", "." ]
[ "// validates general settings: points, dates" ]
[ { "param": "sourceExerciseId", "type": "long" }, { "param": "importedExercise", "type": "ModelingExercise" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "sourceExerciseId", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "importedExercise", "type": "ModelingExercise", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 3349, 3233, 2932, 19, 2284, 310, 17, 8913, 71, 6141, 19, 5666, 4938, 3168, 424, 20603, 548, 1532, 13, 203, 565, 632, 1386, 18987, 2932, 5332, 2996, 2668, 13208, 23291, 13, 203, 565, 1071, 2306, 1943, 32, 1488, 310, 424, 20603, 34, 1930, 424, 20603, 26964, 743, 3092, 1525, 1084, 424, 20603, 548, 16, 632, 28843, 3164, 310, 424, 20603, 9101, 424, 20603, 13, 1216, 19883, 288, 203, 3639, 309, 261, 3168, 424, 20603, 548, 1648, 374, 747, 261, 29266, 424, 20603, 18, 588, 39, 3117, 21246, 424, 20603, 1114, 1162, 39, 3117, 4419, 1435, 422, 446, 597, 9101, 424, 20603, 18, 588, 424, 20603, 1114, 1435, 422, 446, 3719, 288, 203, 5411, 613, 18, 4148, 2932, 26091, 326, 4362, 548, 578, 24165, 8722, 1297, 506, 444, 364, 392, 1930, 8863, 203, 5411, 327, 5570, 691, 5621, 203, 3639, 289, 203, 3639, 727, 569, 2282, 1488, 310, 424, 20603, 273, 938, 310, 424, 20603, 3305, 18, 4720, 5132, 1190, 10908, 1676, 7300, 1876, 3447, 12427, 8282, 12, 3168, 424, 20603, 548, 1769, 203, 3639, 9101, 424, 20603, 18, 1893, 39, 3117, 1876, 424, 20603, 1114, 424, 830, 407, 2818, 2932, 1488, 310, 1312, 20603, 8863, 203, 3639, 569, 729, 273, 729, 3305, 18, 588, 1299, 1190, 3621, 1876, 3594, 1961, 5621, 203, 3639, 1357, 1564, 1179, 18, 1893, 5582, 25070, 2996, 1290, 424, 20603, 12427, 8282, 12, 2996, 18, 13208, 16, 9101, 424, 20603, 16, 729, 1769, 203, 3639, 1357, 1564, 1179, 18, 1893, 5582, 25070, 2996, 1290, 424, 20603, 12427, 8282, 12, 2996, 18, 13208, 16, 2282, 1488, 310, 424, 20603, 16, 729, 1769, 203, 3639, 368, 11964, 7470, 1947, 30, 3143, 16, 7811, 203, 3639, 24165, 1179, 18, 5662, 12580, 2628, 12, 29266, 424, 20603, 1769, 203, 203, 3639, 309, 261, 29266, 424, 20603, 18, 291, 424, 301, 424, 20603, 10756, 288, 203, 5411, 613, 18, 4148, 2932, 12030, 590, 358, 1930, 977, 24165, 2618, 1368, 24165, 1041, 3728, 16, 1084, 424, 20603, 548, 16, 9101, 424, 20603, 18, 588, 424, 20603, 1114, 7675, 26321, 10663, 203, 3639, 289, 203, 3639, 469, 288, 203, 5411, 613, 18, 4148, 2932, 12030, 590, 358, 1930, 977, 24165, 598, 2618, 1368, 4362, 3728, 16, 1084, 424, 20603, 548, 16, 9101, 424, 20603, 18, 588, 39, 3117, 21246, 424, 20603, 1114, 1162, 39, 3117, 4419, 7675, 26321, 10663, 203, 3639, 289, 203, 203, 3639, 727, 569, 394, 1488, 310, 424, 20603, 273, 938, 310, 424, 20603, 5010, 1179, 18, 5666, 1488, 310, 424, 20603, 12, 8830, 1488, 310, 424, 20603, 16, 9101, 424, 20603, 1769, 203, 3639, 938, 310, 424, 20603, 3305, 18, 5688, 12, 2704, 1488, 310, 424, 20603, 1769, 203, 3639, 327, 2306, 1943, 18, 4824, 12, 2704, 3699, 2932, 19, 2425, 19, 2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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
[ 1, 26873, 203, 377, 380, 5485, 342, 2284, 310, 17, 8913, 71, 6141, 19, 5666, 30, 2221, 4363, 392, 2062, 938, 310, 24165, 1368, 392, 2062, 4362, 203, 377, 380, 203, 377, 380, 1220, 903, 1930, 326, 7339, 24165, 1335, 364, 326, 30891, 1012, 471, 463, 815, 18, 203, 377, 380, 6268, 72, 5140, 903, 336, 13027, 471, 6958, 279, 394, 612, 18, 203, 377, 380, 14854, 8901, 1232, 3164, 310, 424, 20603, 5010, 1179, 5496, 203, 377, 380, 203, 377, 380, 632, 891, 1084, 424, 20603, 548, 1021, 1599, 434, 326, 2282, 24165, 1492, 1410, 336, 9101, 203, 377, 380, 632, 891, 9101, 424, 20603, 1021, 394, 24165, 4191, 924, 716, 1410, 336, 15345, 316, 326, 9101, 24165, 16, 272, 18, 69, 18, 326, 2077, 578, 2 ]
ac4d0be1ace6d1834d45f06cf20805db8495ca4c
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/web/rest/ModelingExerciseResource.java
[ "MIT" ]
Java
exportSubmissions
null
@PostMapping("/modeling-exercises/{exerciseId}/export-submissions") @PreAuthorize("hasRole('TA')") public ResponseEntity<Resource> exportSubmissions(@PathVariable long exerciseId, @RequestBody SubmissionExportOptionsDTO submissionExportOptions) { ModelingExercise modelingExercise = modelingExerciseRepository.findByIdElseThrow(exerciseId); authCheckService.checkHasAtLeastRoleForExerciseElseThrow(Role.TEACHING_ASSISTANT, modelingExercise, null); // TAs are not allowed to download all participations if (submissionExportOptions.isExportAllParticipants()) { authCheckService.checkHasAtLeastRoleInCourseElseThrow(Role.INSTRUCTOR, modelingExercise.getCourseViaExerciseGroupOrCourseMember(), null); } File zipFile = modelingSubmissionExportService.exportStudentSubmissionsElseThrow(exerciseId, submissionExportOptions); return ResponseUtil.ok(zipFile); }
/** * POST /modeling-exercises/:exerciseId/export-submissions : sends exercise submissions as zip * * @param exerciseId the id of the exercise to get the repos from * @param submissionExportOptions the options that should be used for the export * @return ResponseEntity with status */
POST /modeling-exercises/:exerciseId/export-submissions : sends exercise submissions as zip @param exerciseId the id of the exercise to get the repos from @param submissionExportOptions the options that should be used for the export @return ResponseEntity with status
[ "POST", "/", "modeling", "-", "exercises", "/", ":", "exerciseId", "/", "export", "-", "submissions", ":", "sends", "exercise", "submissions", "as", "zip", "@param", "exerciseId", "the", "id", "of", "the", "exercise", "to", "get", "the", "repos", "from", "@param", "submissionExportOptions", "the", "options", "that", "should", "be", "used", "for", "the", "export", "@return", "ResponseEntity", "with", "status" ]
@PostMapping("/modeling-exercises/{exerciseId}/export-submissions") @PreAuthorize("hasRole('TA')") public ResponseEntity<Resource> exportSubmissions(@PathVariable long exerciseId, @RequestBody SubmissionExportOptionsDTO submissionExportOptions) { ModelingExercise modelingExercise = modelingExerciseRepository.findByIdElseThrow(exerciseId); authCheckService.checkHasAtLeastRoleForExerciseElseThrow(Role.TEACHING_ASSISTANT, modelingExercise, null); if (submissionExportOptions.isExportAllParticipants()) { authCheckService.checkHasAtLeastRoleInCourseElseThrow(Role.INSTRUCTOR, modelingExercise.getCourseViaExerciseGroupOrCourseMember(), null); } File zipFile = modelingSubmissionExportService.exportStudentSubmissionsElseThrow(exerciseId, submissionExportOptions); return ResponseUtil.ok(zipFile); }
[ "@", "PostMapping", "(", "\"/modeling-exercises/{exerciseId}/export-submissions\"", ")", "@", "PreAuthorize", "(", "\"hasRole('TA')\"", ")", "public", "ResponseEntity", "<", "Resource", ">", "exportSubmissions", "(", "@", "PathVariable", "long", "exerciseId", ",", "@", "RequestBody", "SubmissionExportOptionsDTO", "submissionExportOptions", ")", "{", "ModelingExercise", "modelingExercise", "=", "modelingExerciseRepository", ".", "findByIdElseThrow", "(", "exerciseId", ")", ";", "authCheckService", ".", "checkHasAtLeastRoleForExerciseElseThrow", "(", "Role", ".", "TEACHING_ASSISTANT", ",", "modelingExercise", ",", "null", ")", ";", "if", "(", "submissionExportOptions", ".", "isExportAllParticipants", "(", ")", ")", "{", "authCheckService", ".", "checkHasAtLeastRoleInCourseElseThrow", "(", "Role", ".", "INSTRUCTOR", ",", "modelingExercise", ".", "getCourseViaExerciseGroupOrCourseMember", "(", ")", ",", "null", ")", ";", "}", "File", "zipFile", "=", "modelingSubmissionExportService", ".", "exportStudentSubmissionsElseThrow", "(", "exerciseId", ",", "submissionExportOptions", ")", ";", "return", "ResponseUtil", ".", "ok", "(", "zipFile", ")", ";", "}" ]
POST /modeling-exercises/:exerciseId/export-submissions : sends exercise submissions as zip @param exerciseId the id of the exercise to get the repos from @param submissionExportOptions the options that should be used for the export @return ResponseEntity with status
[ "POST", "/", "modeling", "-", "exercises", "/", ":", "exerciseId", "/", "export", "-", "submissions", ":", "sends", "exercise", "submissions", "as", "zip", "@param", "exerciseId", "the", "id", "of", "the", "exercise", "to", "get", "the", "repos", "from", "@param", "submissionExportOptions", "the", "options", "that", "should", "be", "used", "for", "the", "export", "@return", "ResponseEntity", "with", "status" ]
[ "// TAs are not allowed to download all participations" ]
[ { "param": "exerciseId", "type": "long" }, { "param": "submissionExportOptions", "type": "SubmissionExportOptionsDTO" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "exerciseId", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "submissionExportOptions", "type": "SubmissionExportOptionsDTO", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 3349, 3233, 2932, 19, 2284, 310, 17, 8913, 71, 6141, 4938, 8913, 30708, 548, 4004, 6530, 17, 25675, 7923, 203, 565, 632, 1386, 18987, 2932, 5332, 2996, 2668, 9833, 23291, 13, 203, 565, 1071, 2306, 1943, 32, 1420, 34, 3359, 1676, 7300, 26964, 743, 3092, 1525, 24165, 548, 16, 632, 28843, 2592, 3951, 6144, 1320, 19792, 8515, 6144, 1320, 13, 288, 203, 3639, 3164, 310, 424, 20603, 938, 310, 424, 20603, 273, 938, 310, 424, 20603, 3305, 18, 4720, 5132, 12427, 8282, 12, 8913, 30708, 548, 1769, 203, 203, 3639, 1357, 1564, 1179, 18, 1893, 5582, 25070, 2996, 1290, 424, 20603, 12427, 8282, 12, 2996, 18, 1448, 18133, 1360, 67, 8423, 5511, 6856, 16, 938, 310, 424, 20603, 16, 446, 1769, 203, 203, 3639, 368, 399, 1463, 854, 486, 2935, 358, 4224, 777, 30891, 1012, 203, 3639, 309, 261, 12684, 6144, 1320, 18, 291, 6144, 1595, 1988, 27620, 10756, 288, 203, 5411, 1357, 1564, 1179, 18, 1893, 5582, 25070, 2996, 382, 39, 3117, 12427, 8282, 12, 2996, 18, 706, 13915, 916, 16, 938, 310, 424, 20603, 18, 588, 39, 3117, 21246, 424, 20603, 1114, 1162, 39, 3117, 4419, 9334, 446, 1769, 203, 3639, 289, 203, 203, 3639, 1387, 19450, 273, 938, 310, 17865, 6144, 1179, 18, 6530, 19943, 319, 1676, 7300, 12427, 8282, 12, 8913, 30708, 548, 16, 8515, 6144, 1320, 1769, 203, 3639, 327, 2306, 1304, 18, 601, 12, 4450, 812, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 5485, 342, 2284, 310, 17, 8913, 71, 6141, 16880, 8913, 30708, 548, 19, 6530, 17, 25675, 294, 9573, 24165, 22071, 487, 3144, 203, 377, 380, 203, 377, 380, 632, 891, 24165, 548, 326, 612, 434, 326, 24165, 358, 336, 326, 13686, 628, 203, 377, 380, 632, 891, 8515, 6144, 1320, 326, 702, 716, 1410, 506, 1399, 364, 326, 3359, 203, 377, 380, 632, 2463, 2306, 1943, 598, 1267, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
ac4d0be1ace6d1834d45f06cf20805db8495ca4c
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/web/rest/ModelingExerciseResource.java
[ "MIT" ]
Java
checkPlagiarism
null
@GetMapping("/modeling-exercises/{exerciseId}/check-plagiarism") @PreAuthorize("hasRole('INSTRUCTOR')") public ResponseEntity<ModelingPlagiarismResult> checkPlagiarism(@PathVariable long exerciseId, @RequestParam float similarityThreshold, @RequestParam int minimumScore, @RequestParam int minimumSize) { var modelingExercise = modelingExerciseRepository.findByIdWithStudentParticipationsSubmissionsResultsElseThrow(exerciseId); authCheckService.checkHasAtLeastRoleForExerciseElseThrow(Role.INSTRUCTOR, modelingExercise, null); long start = System.nanoTime(); ModelingPlagiarismResult result = modelingPlagiarismDetectionService.compareSubmissions(modelingExercise, similarityThreshold / 100, minimumSize, minimumScore); log.info("Finished modelingPlagiarismDetectionService.compareSubmissions call for {} comparisons in {}", result.getComparisons().size(), TimeLogUtil.formatDurationFrom(start)); result.sortAndLimit(500); log.info("Limited number of comparisons to {} to avoid performance issues when saving to database", result.getComparisons().size()); start = System.nanoTime(); plagiarismResultRepository.savePlagiarismResultAndRemovePrevious(result); log.info("Finished plagiarismResultRepository.savePlagiarismResultAndRemovePrevious call in {}", TimeLogUtil.formatDurationFrom(start)); return ResponseEntity.ok(result); }
/** * GET /modeling-exercises/{exerciseId}/check-plagiarism * <p> * Start the automated plagiarism detection for the given exercise and return its result. * * @param exerciseId for which all submission should be checked * @param similarityThreshold ignore comparisons whose similarity is below this threshold (%) * @param minimumScore consider only submissions whose score is greater or equal to this * value * @param minimumSize consider only submissions whose size is greater or equal to this * value * @return the ResponseEntity with status 200 (OK) and the list of at most 500 pair-wise submissions with a similarity above the given threshold (e.g. 50%). */
GET /modeling-exercises/{exerciseId}/check-plagiarism Start the automated plagiarism detection for the given exercise and return its result.
[ "GET", "/", "modeling", "-", "exercises", "/", "{", "exerciseId", "}", "/", "check", "-", "plagiarism", "Start", "the", "automated", "plagiarism", "detection", "for", "the", "given", "exercise", "and", "return", "its", "result", "." ]
@GetMapping("/modeling-exercises/{exerciseId}/check-plagiarism") @PreAuthorize("hasRole('INSTRUCTOR')") public ResponseEntity<ModelingPlagiarismResult> checkPlagiarism(@PathVariable long exerciseId, @RequestParam float similarityThreshold, @RequestParam int minimumScore, @RequestParam int minimumSize) { var modelingExercise = modelingExerciseRepository.findByIdWithStudentParticipationsSubmissionsResultsElseThrow(exerciseId); authCheckService.checkHasAtLeastRoleForExerciseElseThrow(Role.INSTRUCTOR, modelingExercise, null); long start = System.nanoTime(); ModelingPlagiarismResult result = modelingPlagiarismDetectionService.compareSubmissions(modelingExercise, similarityThreshold / 100, minimumSize, minimumScore); log.info("Finished modelingPlagiarismDetectionService.compareSubmissions call for {} comparisons in {}", result.getComparisons().size(), TimeLogUtil.formatDurationFrom(start)); result.sortAndLimit(500); log.info("Limited number of comparisons to {} to avoid performance issues when saving to database", result.getComparisons().size()); start = System.nanoTime(); plagiarismResultRepository.savePlagiarismResultAndRemovePrevious(result); log.info("Finished plagiarismResultRepository.savePlagiarismResultAndRemovePrevious call in {}", TimeLogUtil.formatDurationFrom(start)); return ResponseEntity.ok(result); }
[ "@", "GetMapping", "(", "\"/modeling-exercises/{exerciseId}/check-plagiarism\"", ")", "@", "PreAuthorize", "(", "\"hasRole('INSTRUCTOR')\"", ")", "public", "ResponseEntity", "<", "ModelingPlagiarismResult", ">", "checkPlagiarism", "(", "@", "PathVariable", "long", "exerciseId", ",", "@", "RequestParam", "float", "similarityThreshold", ",", "@", "RequestParam", "int", "minimumScore", ",", "@", "RequestParam", "int", "minimumSize", ")", "{", "var", "modelingExercise", "=", "modelingExerciseRepository", ".", "findByIdWithStudentParticipationsSubmissionsResultsElseThrow", "(", "exerciseId", ")", ";", "authCheckService", ".", "checkHasAtLeastRoleForExerciseElseThrow", "(", "Role", ".", "INSTRUCTOR", ",", "modelingExercise", ",", "null", ")", ";", "long", "start", "=", "System", ".", "nanoTime", "(", ")", ";", "ModelingPlagiarismResult", "result", "=", "modelingPlagiarismDetectionService", ".", "compareSubmissions", "(", "modelingExercise", ",", "similarityThreshold", "/", "100", ",", "minimumSize", ",", "minimumScore", ")", ";", "log", ".", "info", "(", "\"Finished modelingPlagiarismDetectionService.compareSubmissions call for {} comparisons in {}\"", ",", "result", ".", "getComparisons", "(", ")", ".", "size", "(", ")", ",", "TimeLogUtil", ".", "formatDurationFrom", "(", "start", ")", ")", ";", "result", ".", "sortAndLimit", "(", "500", ")", ";", "log", ".", "info", "(", "\"Limited number of comparisons to {} to avoid performance issues when saving to database\"", ",", "result", ".", "getComparisons", "(", ")", ".", "size", "(", ")", ")", ";", "start", "=", "System", ".", "nanoTime", "(", ")", ";", "plagiarismResultRepository", ".", "savePlagiarismResultAndRemovePrevious", "(", "result", ")", ";", "log", ".", "info", "(", "\"Finished plagiarismResultRepository.savePlagiarismResultAndRemovePrevious call in {}\"", ",", "TimeLogUtil", ".", "formatDurationFrom", "(", "start", ")", ")", ";", "return", "ResponseEntity", ".", "ok", "(", "result", ")", ";", "}" ]
GET /modeling-exercises/{exerciseId}/check-plagiarism <p> Start the automated plagiarism detection for the given exercise and return its result.
[ "GET", "/", "modeling", "-", "exercises", "/", "{", "exerciseId", "}", "/", "check", "-", "plagiarism", "<p", ">", "Start", "the", "automated", "plagiarism", "detection", "for", "the", "given", "exercise", "and", "return", "its", "result", "." ]
[]
[ { "param": "exerciseId", "type": "long" }, { "param": "similarityThreshold", "type": "float" }, { "param": "minimumScore", "type": "int" }, { "param": "minimumSize", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "exerciseId", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "similarityThreshold", "type": "float", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "minimumScore", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "minimumSize", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 967, 3233, 2932, 19, 2284, 310, 17, 8913, 71, 6141, 4938, 8913, 30708, 548, 4004, 1893, 17, 412, 346, 77, 297, 6228, 7923, 203, 565, 632, 1386, 18987, 2932, 5332, 2996, 2668, 706, 13915, 916, 23291, 13, 203, 565, 1071, 2306, 1943, 32, 1488, 310, 1749, 346, 77, 297, 6228, 1253, 34, 866, 1749, 346, 77, 297, 6228, 26964, 743, 3092, 1525, 24165, 548, 16, 632, 691, 786, 1431, 16416, 7614, 16, 632, 691, 786, 509, 5224, 7295, 16, 203, 5411, 632, 691, 786, 509, 5224, 1225, 13, 288, 203, 3639, 569, 938, 310, 424, 20603, 273, 938, 310, 424, 20603, 3305, 18, 4720, 5132, 1190, 19943, 319, 1988, 24629, 1012, 1676, 7300, 3447, 12427, 8282, 12, 8913, 30708, 548, 1769, 203, 3639, 1357, 1564, 1179, 18, 1893, 5582, 25070, 2996, 1290, 424, 20603, 12427, 8282, 12, 2996, 18, 706, 13915, 916, 16, 938, 310, 424, 20603, 16, 446, 1769, 203, 3639, 1525, 787, 273, 2332, 18, 13569, 83, 950, 5621, 203, 3639, 3164, 310, 1749, 346, 77, 297, 6228, 1253, 563, 273, 938, 310, 1749, 346, 77, 297, 6228, 10214, 1179, 18, 9877, 1676, 7300, 12, 2284, 310, 424, 20603, 16, 16416, 7614, 342, 2130, 16, 5224, 1225, 16, 5224, 7295, 1769, 203, 3639, 613, 18, 1376, 2932, 10577, 938, 310, 1749, 346, 77, 297, 6228, 10214, 1179, 18, 9877, 1676, 7300, 745, 364, 2618, 23068, 316, 3728, 16, 563, 18, 588, 16059, 87, 7675, 1467, 9334, 203, 7734, 2647, 1343, 1304, 18, 2139, 5326, 1265, 12, 1937, 10019, 203, 3639, 563, 18, 3804, 1876, 3039, 12, 12483, 1769, 203, 3639, 613, 18, 1376, 2932, 3039, 329, 1300, 434, 23068, 358, 2618, 358, 4543, 9239, 8296, 1347, 12392, 358, 2063, 3113, 563, 18, 588, 16059, 87, 7675, 1467, 10663, 203, 3639, 787, 273, 2332, 18, 13569, 83, 950, 5621, 203, 3639, 886, 346, 77, 297, 6228, 1253, 3305, 18, 5688, 1749, 346, 77, 297, 6228, 1253, 1876, 3288, 8351, 12, 2088, 1769, 203, 3639, 613, 18, 1376, 2932, 10577, 886, 346, 77, 297, 6228, 1253, 3305, 18, 5688, 1749, 346, 77, 297, 6228, 1253, 1876, 3288, 8351, 745, 316, 3728, 16, 2647, 1343, 1304, 18, 2139, 5326, 1265, 12, 1937, 10019, 203, 3639, 327, 2306, 1943, 18, 601, 12, 2088, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 4978, 342, 2284, 310, 17, 8913, 71, 6141, 4938, 8913, 30708, 548, 4004, 1893, 17, 412, 346, 77, 297, 6228, 203, 377, 380, 411, 84, 34, 203, 377, 380, 3603, 326, 18472, 690, 886, 346, 77, 297, 6228, 11649, 364, 326, 864, 24165, 471, 327, 2097, 563, 18, 203, 377, 380, 203, 377, 380, 632, 891, 24165, 548, 1850, 364, 1492, 777, 8515, 1410, 506, 5950, 203, 377, 380, 632, 891, 16416, 7614, 2305, 23068, 8272, 16416, 353, 5712, 333, 5573, 6142, 13, 203, 377, 380, 632, 891, 5224, 7295, 3639, 5260, 1338, 22071, 8272, 4462, 353, 6802, 578, 3959, 358, 333, 203, 377, 380, 18701, 460, 203, 377, 380, 632, 891, 5224, 1225, 540, 5260, 1338, 22071, 8272, 963, 353, 6802, 2 ]
ac4d0be1ace6d1834d45f06cf20805db8495ca4c
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/web/rest/ModelingExerciseResource.java
[ "MIT" ]
Java
reEvaluateAndUpdateModelingExercise
null
@PutMapping(Endpoints.REEVALUATE_EXERCISE) @PreAuthorize("hasRole('EDITOR')") public ResponseEntity<ModelingExercise> reEvaluateAndUpdateModelingExercise(@PathVariable long exerciseId, @RequestBody ModelingExercise modelingExercise, @RequestParam(value = "deleteFeedback", required = false) Boolean deleteFeedbackAfterGradingInstructionUpdate) throws URISyntaxException { log.debug("REST request to re-evaluate ModelingExercise : {}", modelingExercise); modelingExerciseRepository.findByIdWithStudentParticipationsSubmissionsResultsElseThrow(exerciseId); authCheckService.checkGivenExerciseIdSameForExerciseInRequestBodyElseThrow(exerciseId, modelingExercise); var user = userRepository.getUserWithGroupsAndAuthorities(); // make sure the course actually exists var course = courseRepository.findByIdElseThrow(modelingExercise.getCourseViaExerciseGroupOrCourseMember().getId()); authCheckService.checkHasAtLeastRoleInCourseElseThrow(Role.EDITOR, course, user); exerciseService.reEvaluateExercise(modelingExercise, deleteFeedbackAfterGradingInstructionUpdate); return updateModelingExercise(modelingExercise, null); }
/** * PUT /modeling-exercises/{exerciseId}/re-evaluate : Re-evaluates and updates an existing modelingExercise. * * @param exerciseId of the exercise * @param modelingExercise the modelingExercise to re-evaluate and update * @param deleteFeedbackAfterGradingInstructionUpdate boolean flag that indicates whether the associated feedback should be deleted or not * * @return the ResponseEntity with status 200 (OK) and with body the updated modelingExercise, or * with status 400 (Bad Request) if the modelingExercise is not valid, or with status 409 (Conflict) * if given exerciseId is not same as in the object of the request body, or with status 500 (Internal * Server Error) if the modelingExercise couldn't be updated * @throws URISyntaxException if the Location URI syntax is incorrect */
PUT /modeling-exercises/{exerciseId}/re-evaluate : Re-evaluates and updates an existing modelingExercise. @param exerciseId of the exercise @param modelingExercise the modelingExercise to re-evaluate and update @param deleteFeedbackAfterGradingInstructionUpdate boolean flag that indicates whether the associated feedback should be deleted or not @return the ResponseEntity with status 200 (OK) and with body the updated modelingExercise, or with status 400 (Bad Request) if the modelingExercise is not valid, or with status 409 (Conflict) if given exerciseId is not same as in the object of the request body, or with status 500 (Internal Server Error) if the modelingExercise couldn't be updated @throws URISyntaxException if the Location URI syntax is incorrect
[ "PUT", "/", "modeling", "-", "exercises", "/", "{", "exerciseId", "}", "/", "re", "-", "evaluate", ":", "Re", "-", "evaluates", "and", "updates", "an", "existing", "modelingExercise", ".", "@param", "exerciseId", "of", "the", "exercise", "@param", "modelingExercise", "the", "modelingExercise", "to", "re", "-", "evaluate", "and", "update", "@param", "deleteFeedbackAfterGradingInstructionUpdate", "boolean", "flag", "that", "indicates", "whether", "the", "associated", "feedback", "should", "be", "deleted", "or", "not", "@return", "the", "ResponseEntity", "with", "status", "200", "(", "OK", ")", "and", "with", "body", "the", "updated", "modelingExercise", "or", "with", "status", "400", "(", "Bad", "Request", ")", "if", "the", "modelingExercise", "is", "not", "valid", "or", "with", "status", "409", "(", "Conflict", ")", "if", "given", "exerciseId", "is", "not", "same", "as", "in", "the", "object", "of", "the", "request", "body", "or", "with", "status", "500", "(", "Internal", "Server", "Error", ")", "if", "the", "modelingExercise", "couldn", "'", "t", "be", "updated", "@throws", "URISyntaxException", "if", "the", "Location", "URI", "syntax", "is", "incorrect" ]
@PutMapping(Endpoints.REEVALUATE_EXERCISE) @PreAuthorize("hasRole('EDITOR')") public ResponseEntity<ModelingExercise> reEvaluateAndUpdateModelingExercise(@PathVariable long exerciseId, @RequestBody ModelingExercise modelingExercise, @RequestParam(value = "deleteFeedback", required = false) Boolean deleteFeedbackAfterGradingInstructionUpdate) throws URISyntaxException { log.debug("REST request to re-evaluate ModelingExercise : {}", modelingExercise); modelingExerciseRepository.findByIdWithStudentParticipationsSubmissionsResultsElseThrow(exerciseId); authCheckService.checkGivenExerciseIdSameForExerciseInRequestBodyElseThrow(exerciseId, modelingExercise); var user = userRepository.getUserWithGroupsAndAuthorities(); var course = courseRepository.findByIdElseThrow(modelingExercise.getCourseViaExerciseGroupOrCourseMember().getId()); authCheckService.checkHasAtLeastRoleInCourseElseThrow(Role.EDITOR, course, user); exerciseService.reEvaluateExercise(modelingExercise, deleteFeedbackAfterGradingInstructionUpdate); return updateModelingExercise(modelingExercise, null); }
[ "@", "PutMapping", "(", "Endpoints", ".", "REEVALUATE_EXERCISE", ")", "@", "PreAuthorize", "(", "\"hasRole('EDITOR')\"", ")", "public", "ResponseEntity", "<", "ModelingExercise", ">", "reEvaluateAndUpdateModelingExercise", "(", "@", "PathVariable", "long", "exerciseId", ",", "@", "RequestBody", "ModelingExercise", "modelingExercise", ",", "@", "RequestParam", "(", "value", "=", "\"deleteFeedback\"", ",", "required", "=", "false", ")", "Boolean", "deleteFeedbackAfterGradingInstructionUpdate", ")", "throws", "URISyntaxException", "{", "log", ".", "debug", "(", "\"REST request to re-evaluate ModelingExercise : {}\"", ",", "modelingExercise", ")", ";", "modelingExerciseRepository", ".", "findByIdWithStudentParticipationsSubmissionsResultsElseThrow", "(", "exerciseId", ")", ";", "authCheckService", ".", "checkGivenExerciseIdSameForExerciseInRequestBodyElseThrow", "(", "exerciseId", ",", "modelingExercise", ")", ";", "var", "user", "=", "userRepository", ".", "getUserWithGroupsAndAuthorities", "(", ")", ";", "var", "course", "=", "courseRepository", ".", "findByIdElseThrow", "(", "modelingExercise", ".", "getCourseViaExerciseGroupOrCourseMember", "(", ")", ".", "getId", "(", ")", ")", ";", "authCheckService", ".", "checkHasAtLeastRoleInCourseElseThrow", "(", "Role", ".", "EDITOR", ",", "course", ",", "user", ")", ";", "exerciseService", ".", "reEvaluateExercise", "(", "modelingExercise", ",", "deleteFeedbackAfterGradingInstructionUpdate", ")", ";", "return", "updateModelingExercise", "(", "modelingExercise", ",", "null", ")", ";", "}" ]
PUT /modeling-exercises/{exerciseId}/re-evaluate : Re-evaluates and updates an existing modelingExercise.
[ "PUT", "/", "modeling", "-", "exercises", "/", "{", "exerciseId", "}", "/", "re", "-", "evaluate", ":", "Re", "-", "evaluates", "and", "updates", "an", "existing", "modelingExercise", "." ]
[ "// make sure the course actually exists" ]
[ { "param": "exerciseId", "type": "long" }, { "param": "modelingExercise", "type": "ModelingExercise" }, { "param": "deleteFeedbackAfterGradingInstructionUpdate", "type": "Boolean" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "exerciseId", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "modelingExercise", "type": "ModelingExercise", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "deleteFeedbackAfterGradingInstructionUpdate", "type": "Boolean", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 6426, 3233, 12, 10357, 18, 9719, 2669, 57, 1777, 67, 2294, 654, 7266, 1090, 13, 203, 565, 632, 1386, 18987, 2932, 5332, 2996, 2668, 13208, 23291, 13, 203, 565, 1071, 2306, 1943, 32, 1488, 310, 424, 20603, 34, 283, 15369, 1876, 1891, 1488, 310, 424, 20603, 26964, 743, 3092, 1525, 24165, 548, 16, 632, 28843, 3164, 310, 424, 20603, 938, 310, 424, 20603, 16, 203, 5411, 632, 691, 786, 12, 1132, 273, 315, 3733, 15888, 3113, 1931, 273, 629, 13, 3411, 1430, 15888, 4436, 30420, 310, 11983, 1891, 13, 1216, 19883, 288, 203, 3639, 613, 18, 4148, 2932, 12030, 590, 358, 283, 17, 21024, 3164, 310, 424, 20603, 294, 3728, 16, 938, 310, 424, 20603, 1769, 203, 203, 3639, 938, 310, 424, 20603, 3305, 18, 4720, 5132, 1190, 19943, 319, 1988, 24629, 1012, 1676, 7300, 3447, 12427, 8282, 12, 8913, 30708, 548, 1769, 203, 203, 3639, 1357, 1564, 1179, 18, 1893, 6083, 424, 20603, 548, 8650, 1290, 424, 20603, 382, 28843, 12427, 8282, 12, 8913, 30708, 548, 16, 938, 310, 424, 20603, 1769, 203, 203, 3639, 569, 729, 273, 729, 3305, 18, 588, 1299, 1190, 3621, 1876, 3594, 1961, 5621, 203, 3639, 368, 1221, 3071, 326, 4362, 6013, 1704, 203, 3639, 569, 4362, 273, 4362, 3305, 18, 4720, 5132, 12427, 8282, 12, 2284, 310, 424, 20603, 18, 588, 39, 3117, 21246, 424, 20603, 1114, 1162, 39, 3117, 4419, 7675, 26321, 10663, 203, 3639, 1357, 1564, 1179, 18, 1893, 5582, 25070, 2996, 382, 39, 3117, 12427, 8282, 12, 2996, 18, 13208, 16, 4362, 16, 729, 1769, 203, 203, 3639, 24165, 1179, 18, 266, 15369, 424, 20603, 12, 2284, 310, 424, 20603, 16, 1430, 15888, 4436, 30420, 310, 11983, 1891, 1769, 203, 203, 3639, 327, 1089, 1488, 310, 424, 20603, 12, 2284, 310, 424, 20603, 16, 446, 1769, 203, 565, 289, 2, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 11443, 342, 2284, 310, 17, 8913, 71, 6141, 4938, 8913, 30708, 548, 4004, 266, 17, 21024, 294, 868, 17, 14168, 815, 471, 4533, 392, 2062, 938, 310, 424, 20603, 18, 203, 377, 380, 203, 377, 380, 632, 891, 24165, 548, 4766, 282, 434, 326, 24165, 203, 377, 380, 632, 891, 938, 310, 424, 20603, 11794, 326, 938, 310, 424, 20603, 358, 283, 17, 21024, 471, 1089, 203, 377, 380, 632, 891, 1430, 15888, 4436, 30420, 310, 11983, 1891, 225, 1250, 2982, 716, 8527, 2856, 326, 3627, 10762, 1410, 506, 4282, 578, 486, 203, 377, 380, 203, 377, 380, 632, 2463, 326, 2306, 1943, 598, 1267, 4044, 261, 3141, 13, 471, 598, 1417, 326, 3526, 938, 310, 424, 20603, 16, 578, 203, 377, 2 ]
7f62240d662e1e23c6aa55ba6e5c5bbe8179579d
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/service/metis/PostingService.java
[ "MIT" ]
Java
mayUpdateOrDeletePostingElseThrow
null
void mayUpdateOrDeletePostingElseThrow(Posting posting, User user, Course course) { if (!user.getId().equals(posting.getAuthor().getId())) { authorizationCheckService.checkHasAtLeastRoleInCourseElseThrow(Role.TEACHING_ASSISTANT, course, user); } }
/** * Checks if the requesting user is authorized in the course context, * i.e. user has to be author of posting or at least teaching assistant * * @param posting posting that is requested * @param user requesting user */
Checks if the requesting user is authorized in the course context, i.e. user has to be author of posting or at least teaching assistant @param posting posting that is requested @param user requesting user
[ "Checks", "if", "the", "requesting", "user", "is", "authorized", "in", "the", "course", "context", "i", ".", "e", ".", "user", "has", "to", "be", "author", "of", "posting", "or", "at", "least", "teaching", "assistant", "@param", "posting", "posting", "that", "is", "requested", "@param", "user", "requesting", "user" ]
void mayUpdateOrDeletePostingElseThrow(Posting posting, User user, Course course) { if (!user.getId().equals(posting.getAuthor().getId())) { authorizationCheckService.checkHasAtLeastRoleInCourseElseThrow(Role.TEACHING_ASSISTANT, course, user); } }
[ "void", "mayUpdateOrDeletePostingElseThrow", "(", "Posting", "posting", ",", "User", "user", ",", "Course", "course", ")", "{", "if", "(", "!", "user", ".", "getId", "(", ")", ".", "equals", "(", "posting", ".", "getAuthor", "(", ")", ".", "getId", "(", ")", ")", ")", "{", "authorizationCheckService", ".", "checkHasAtLeastRoleInCourseElseThrow", "(", "Role", ".", "TEACHING_ASSISTANT", ",", "course", ",", "user", ")", ";", "}", "}" ]
Checks if the requesting user is authorized in the course context, i.e.
[ "Checks", "if", "the", "requesting", "user", "is", "authorized", "in", "the", "course", "context", "i", ".", "e", "." ]
[]
[ { "param": "posting", "type": "Posting" }, { "param": "user", "type": "User" }, { "param": "course", "type": "Course" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "posting", "type": "Posting", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "user", "type": "User", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "course", "type": "Course", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 918, 2026, 1891, 1162, 2613, 3349, 310, 12427, 8282, 12, 3349, 310, 1603, 310, 16, 2177, 729, 16, 385, 3117, 4362, 13, 288, 203, 3639, 309, 16051, 1355, 18, 26321, 7675, 14963, 12, 2767, 310, 18, 588, 3594, 7675, 26321, 1435, 3719, 288, 203, 5411, 6093, 1564, 1179, 18, 1893, 5582, 25070, 2996, 382, 39, 3117, 12427, 8282, 12, 2996, 18, 1448, 18133, 1360, 67, 8423, 5511, 6856, 16, 4362, 16, 729, 1769, 203, 3639, 289, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 13074, 309, 326, 18709, 729, 353, 10799, 316, 326, 4362, 819, 16, 203, 377, 380, 277, 18, 73, 18, 729, 711, 358, 506, 2869, 434, 1603, 310, 578, 622, 4520, 6489, 497, 310, 28779, 203, 377, 380, 203, 377, 380, 632, 891, 1603, 310, 1603, 310, 716, 353, 3764, 203, 377, 380, 632, 891, 729, 565, 18709, 729, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
7f62240d662e1e23c6aa55ba6e5c5bbe8179579d
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/service/metis/PostingService.java
[ "MIT" ]
Java
preCheckPostValidity
null
void preCheckPostValidity(Post post) { // do not allow postings for exam exercises if (post.getExercise() != null) { Long exerciseId = post.getExercise().getId(); Exercise exercise = exerciseRepository.findByIdElseThrow(exerciseId); if (exercise.isExamExercise()) { throw new BadRequestAlertException("Postings are not allowed for exam exercises", getEntityName(), "400", true); } } }
/** * Method to check if the possibly associated exercise is not an exam exercise * * @param post post that is checked */
Method to check if the possibly associated exercise is not an exam exercise @param post post that is checked
[ "Method", "to", "check", "if", "the", "possibly", "associated", "exercise", "is", "not", "an", "exam", "exercise", "@param", "post", "post", "that", "is", "checked" ]
void preCheckPostValidity(Post post) { if (post.getExercise() != null) { Long exerciseId = post.getExercise().getId(); Exercise exercise = exerciseRepository.findByIdElseThrow(exerciseId); if (exercise.isExamExercise()) { throw new BadRequestAlertException("Postings are not allowed for exam exercises", getEntityName(), "400", true); } } }
[ "void", "preCheckPostValidity", "(", "Post", "post", ")", "{", "if", "(", "post", ".", "getExercise", "(", ")", "!=", "null", ")", "{", "Long", "exerciseId", "=", "post", ".", "getExercise", "(", ")", ".", "getId", "(", ")", ";", "Exercise", "exercise", "=", "exerciseRepository", ".", "findByIdElseThrow", "(", "exerciseId", ")", ";", "if", "(", "exercise", ".", "isExamExercise", "(", ")", ")", "{", "throw", "new", "BadRequestAlertException", "(", "\"Postings are not allowed for exam exercises\"", ",", "getEntityName", "(", ")", ",", "\"400\"", ",", "true", ")", ";", "}", "}", "}" ]
Method to check if the possibly associated exercise is not an exam exercise @param post post that is checked
[ "Method", "to", "check", "if", "the", "possibly", "associated", "exercise", "is", "not", "an", "exam", "exercise", "@param", "post", "post", "that", "is", "checked" ]
[ "// do not allow postings for exam exercises" ]
[ { "param": "post", "type": "Post" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "post", "type": "Post", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 918, 675, 1564, 3349, 19678, 12, 3349, 1603, 13, 288, 203, 3639, 368, 741, 486, 1699, 1603, 899, 364, 19707, 431, 12610, 6141, 203, 3639, 309, 261, 2767, 18, 588, 424, 20603, 1435, 480, 446, 13, 288, 203, 5411, 3407, 24165, 548, 273, 1603, 18, 588, 424, 20603, 7675, 26321, 5621, 203, 5411, 1312, 20603, 24165, 273, 24165, 3305, 18, 4720, 5132, 12427, 8282, 12, 8913, 30708, 548, 1769, 203, 5411, 309, 261, 8913, 30708, 18, 291, 424, 301, 424, 20603, 10756, 288, 203, 7734, 604, 394, 23223, 13298, 503, 2932, 3349, 899, 854, 486, 2935, 364, 19707, 431, 12610, 6141, 3113, 6352, 461, 9334, 315, 16010, 3113, 638, 1769, 203, 5411, 289, 203, 3639, 289, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 2985, 358, 866, 309, 326, 10016, 3627, 24165, 353, 486, 392, 19707, 24165, 203, 377, 380, 203, 377, 380, 632, 891, 1603, 377, 1603, 716, 353, 5950, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
2a9da177c1b6bf418b8f10f10e06e9b9d1dcc138
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/web/rest/CourseResource.java
[ "MIT" ]
Java
createCourse
null
@PostMapping("/courses") @PreAuthorize("hasRole('ADMIN')") public ResponseEntity<Course> createCourse(@RequestBody Course course) throws URISyntaxException { log.debug("REST request to save Course : {}", course); if (course.getId() != null) { throw new BadRequestAlertException("A new course cannot already have an ID", ENTITY_NAME, "idexists"); } validateShortName(course); List<Course> coursesWithSameShortName = courseRepository.findAllByShortName(course.getShortName()); if (coursesWithSameShortName.size() > 0) { return ResponseEntity.badRequest().headers( HeaderUtil.createAlert(applicationName, "A course with the same short name already exists. Please choose a different short name.", "shortnameAlreadyExists")) .body(null); } validateRegistrationConfirmationMessage(course); validateComplaintsAndRequestMoreFeedbackConfig(course); validateOnlineCourseAndRegistrationEnabled(course); createOrValidateGroups(course); Course result = courseRepository.save(course); return ResponseEntity.created(new URI("/api/courses/" + result.getId())) .headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getTitle())).body(result); }
/** * POST /courses : create a new course. * * @param course the course to create * @return the ResponseEntity with status 201 (Created) and with body the new course, or with status 400 (Bad Request) if the course has already an ID * @throws URISyntaxException if the Location URI syntax is incorrect */
POST /courses : create a new course. @param course the course to create @return the ResponseEntity with status 201 (Created) and with body the new course, or with status 400 (Bad Request) if the course has already an ID @throws URISyntaxException if the Location URI syntax is incorrect
[ "POST", "/", "courses", ":", "create", "a", "new", "course", ".", "@param", "course", "the", "course", "to", "create", "@return", "the", "ResponseEntity", "with", "status", "201", "(", "Created", ")", "and", "with", "body", "the", "new", "course", "or", "with", "status", "400", "(", "Bad", "Request", ")", "if", "the", "course", "has", "already", "an", "ID", "@throws", "URISyntaxException", "if", "the", "Location", "URI", "syntax", "is", "incorrect" ]
@PostMapping("/courses") @PreAuthorize("hasRole('ADMIN')") public ResponseEntity<Course> createCourse(@RequestBody Course course) throws URISyntaxException { log.debug("REST request to save Course : {}", course); if (course.getId() != null) { throw new BadRequestAlertException("A new course cannot already have an ID", ENTITY_NAME, "idexists"); } validateShortName(course); List<Course> coursesWithSameShortName = courseRepository.findAllByShortName(course.getShortName()); if (coursesWithSameShortName.size() > 0) { return ResponseEntity.badRequest().headers( HeaderUtil.createAlert(applicationName, "A course with the same short name already exists. Please choose a different short name.", "shortnameAlreadyExists")) .body(null); } validateRegistrationConfirmationMessage(course); validateComplaintsAndRequestMoreFeedbackConfig(course); validateOnlineCourseAndRegistrationEnabled(course); createOrValidateGroups(course); Course result = courseRepository.save(course); return ResponseEntity.created(new URI("/api/courses/" + result.getId())) .headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getTitle())).body(result); }
[ "@", "PostMapping", "(", "\"/courses\"", ")", "@", "PreAuthorize", "(", "\"hasRole('ADMIN')\"", ")", "public", "ResponseEntity", "<", "Course", ">", "createCourse", "(", "@", "RequestBody", "Course", "course", ")", "throws", "URISyntaxException", "{", "log", ".", "debug", "(", "\"REST request to save Course : {}\"", ",", "course", ")", ";", "if", "(", "course", ".", "getId", "(", ")", "!=", "null", ")", "{", "throw", "new", "BadRequestAlertException", "(", "\"A new course cannot already have an ID\"", ",", "ENTITY_NAME", ",", "\"idexists\"", ")", ";", "}", "validateShortName", "(", "course", ")", ";", "List", "<", "Course", ">", "coursesWithSameShortName", "=", "courseRepository", ".", "findAllByShortName", "(", "course", ".", "getShortName", "(", ")", ")", ";", "if", "(", "coursesWithSameShortName", ".", "size", "(", ")", ">", "0", ")", "{", "return", "ResponseEntity", ".", "badRequest", "(", ")", ".", "headers", "(", "HeaderUtil", ".", "createAlert", "(", "applicationName", ",", "\"A course with the same short name already exists. Please choose a different short name.\"", ",", "\"shortnameAlreadyExists\"", ")", ")", ".", "body", "(", "null", ")", ";", "}", "validateRegistrationConfirmationMessage", "(", "course", ")", ";", "validateComplaintsAndRequestMoreFeedbackConfig", "(", "course", ")", ";", "validateOnlineCourseAndRegistrationEnabled", "(", "course", ")", ";", "createOrValidateGroups", "(", "course", ")", ";", "Course", "result", "=", "courseRepository", ".", "save", "(", "course", ")", ";", "return", "ResponseEntity", ".", "created", "(", "new", "URI", "(", "\"/api/courses/\"", "+", "result", ".", "getId", "(", ")", ")", ")", ".", "headers", "(", "HeaderUtil", ".", "createEntityCreationAlert", "(", "applicationName", ",", "true", ",", "ENTITY_NAME", ",", "result", ".", "getTitle", "(", ")", ")", ")", ".", "body", "(", "result", ")", ";", "}" ]
POST /courses : create a new course.
[ "POST", "/", "courses", ":", "create", "a", "new", "course", "." ]
[]
[ { "param": "course", "type": "Course" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "course", "type": "Course", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 3349, 3233, 2932, 19, 15804, 7923, 203, 565, 632, 1386, 18987, 2932, 5332, 2996, 2668, 15468, 23291, 13, 203, 565, 1071, 2306, 1943, 32, 39, 3117, 34, 752, 39, 3117, 26964, 28843, 385, 3117, 4362, 13, 1216, 19883, 288, 203, 3639, 613, 18, 4148, 2932, 12030, 590, 358, 1923, 385, 3117, 294, 3728, 16, 4362, 1769, 203, 3639, 309, 261, 5566, 18, 26321, 1435, 480, 446, 13, 288, 203, 5411, 604, 394, 23223, 13298, 503, 2932, 37, 394, 4362, 2780, 1818, 1240, 392, 1599, 3113, 17020, 67, 1985, 16, 315, 77, 561, 1486, 8863, 203, 3639, 289, 203, 203, 3639, 1954, 29983, 12, 5566, 1769, 203, 203, 3639, 987, 32, 39, 3117, 34, 17224, 1190, 8650, 29983, 273, 4362, 3305, 18, 4720, 1595, 858, 29983, 12, 5566, 18, 588, 29983, 10663, 203, 3639, 309, 261, 15804, 1190, 8650, 29983, 18, 1467, 1435, 405, 374, 13, 288, 203, 5411, 327, 2306, 1943, 18, 8759, 691, 7675, 2485, 12, 203, 10792, 4304, 1304, 18, 2640, 13298, 12, 3685, 461, 16, 315, 37, 4362, 598, 326, 1967, 3025, 508, 1818, 1704, 18, 7801, 9876, 279, 3775, 3025, 508, 1199, 16, 315, 28650, 16686, 6, 3719, 203, 10792, 263, 3432, 12, 2011, 1769, 203, 3639, 289, 203, 203, 3639, 1954, 7843, 17597, 1079, 12, 5566, 1769, 203, 3639, 1954, 799, 412, 1598, 87, 1876, 691, 7417, 15888, 809, 12, 5566, 1769, 203, 3639, 1954, 16860, 39, 3117, 1876, 7843, 1526, 12, 5566, 1769, 203, 203, 3639, 752, 1162, 4270, 3621, 12, 5566, 1769, 203, 3639, 385, 3117, 563, 273, 4362, 3305, 18, 5688, 12, 5566, 1769, 203, 3639, 327, 2306, 1943, 18, 4824, 12, 2704, 3699, 2932, 19, 2425, 19, 15804, 4898, 397, 563, 18, 26321, 1435, 3719, 203, 7734, 263, 2485, 12, 1864, 1304, 18, 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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 5485, 342, 15804, 294, 752, 279, 394, 4362, 18, 203, 377, 380, 203, 377, 380, 632, 891, 4362, 326, 4362, 358, 752, 203, 377, 380, 632, 2463, 326, 2306, 1943, 598, 1267, 3786, 261, 6119, 13, 471, 598, 1417, 326, 394, 4362, 16, 578, 598, 1267, 7409, 261, 6434, 1567, 13, 309, 326, 4362, 711, 1818, 392, 1599, 203, 377, 380, 632, 15069, 19883, 309, 326, 7050, 3699, 6279, 353, 11332, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
2a9da177c1b6bf418b8f10f10e06e9b9d1dcc138
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/web/rest/CourseResource.java
[ "MIT" ]
Java
updateCourse
null
@PutMapping("/courses") @PreAuthorize("hasRole('INSTRUCTOR')") public ResponseEntity<Course> updateCourse(@RequestBody Course updatedCourse) throws URISyntaxException { log.debug("REST request to update Course : {}", updatedCourse); User user = userRepository.getUserWithGroupsAndAuthorities(); if (updatedCourse.getId() == null) { if (authCheckService.isAdmin(user)) { return createCourse(updatedCourse); } else { throw new AccessForbiddenException(NOT_ALLOWED); } } var existingCourse = courseRepository.findByIdElseThrow(updatedCourse.getId()); if (!Objects.equals(existingCourse.getShortName(), updatedCourse.getShortName())) { throw new BadRequestAlertException("The course short name cannot be changed", ENTITY_NAME, "shortNameCannotChange", true); } // only allow admins or instructors of the existing course to change it // this is important, otherwise someone could put himself into the instructor group of the updated course authCheckService.checkHasAtLeastRoleInCourseElseThrow(Role.INSTRUCTOR, existingCourse, user); if (authCheckService.isAdmin(user)) { // if an admin changes a group, we need to check that the changed group exists try { if (!Objects.equals(existingCourse.getStudentGroupName(), updatedCourse.getStudentGroupName())) { checkIfGroupsExists(updatedCourse.getStudentGroupName()); } if (!Objects.equals(existingCourse.getTeachingAssistantGroupName(), updatedCourse.getTeachingAssistantGroupName())) { checkIfGroupsExists(updatedCourse.getTeachingAssistantGroupName()); } if (!Objects.equals(existingCourse.getEditorGroupName(), updatedCourse.getEditorGroupName())) { checkIfGroupsExists(updatedCourse.getEditorGroupName()); } if (!Objects.equals(existingCourse.getInstructorGroupName(), updatedCourse.getInstructorGroupName())) { checkIfGroupsExists(updatedCourse.getInstructorGroupName()); } } catch (ArtemisAuthenticationException ex) { // a specified group does not exist, notify the client throw new BadRequestAlertException(ex.getMessage(), ENTITY_NAME, "groupNotFound", true); } } else { // this means the user must be an instructor, who has NOT Admin rights. // instructors are not allowed to change group names, because this would lead to security problems if (!Objects.equals(existingCourse.getStudentGroupName(), updatedCourse.getStudentGroupName())) { throw new BadRequestAlertException("The student group name cannot be changed", ENTITY_NAME, "studentGroupNameCannotChange", true); } if (!Objects.equals(existingCourse.getTeachingAssistantGroupName(), updatedCourse.getTeachingAssistantGroupName())) { throw new BadRequestAlertException("The teaching assistant group name cannot be changed", ENTITY_NAME, "teachingAssistantGroupNameCannotChange", true); } if (!Objects.equals(existingCourse.getEditorGroupName(), updatedCourse.getEditorGroupName())) { throw new BadRequestAlertException("The editor group name cannot be changed", ENTITY_NAME, "editorGroupNameCannotChange", true); } if (!Objects.equals(existingCourse.getInstructorGroupName(), updatedCourse.getInstructorGroupName())) { throw new BadRequestAlertException("The instructor group name cannot be changed", ENTITY_NAME, "instructorGroupNameCannotChange", true); } } validateRegistrationConfirmationMessage(updatedCourse); validateComplaintsAndRequestMoreFeedbackConfig(updatedCourse); validateOnlineCourseAndRegistrationEnabled(updatedCourse); validateShortName(updatedCourse); // Based on the old instructors, editors and TAs, we can update all exercises in the course in the VCS (if necessary) // We need the old instructors, editors and TAs, so that the VCS user management service can determine which // users no longer have TA, editor or instructor rights in the related exercise repositories. final var oldInstructorGroup = existingCourse.getInstructorGroupName(); final var oldEditorGroup = existingCourse.getEditorGroupName(); final var oldTeachingAssistantGroup = existingCourse.getTeachingAssistantGroupName(); Course result = courseRepository.save(updatedCourse); optionalVcsUserManagementService .ifPresent(userManagementService -> userManagementService.updateCoursePermissions(result, oldInstructorGroup, oldEditorGroup, oldTeachingAssistantGroup)); optionalCiUserManagementService .ifPresent(ciUserManagementService -> ciUserManagementService.updateCoursePermissions(result, oldInstructorGroup, oldEditorGroup, oldTeachingAssistantGroup)); return ResponseEntity.ok().headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, updatedCourse.getTitle())).body(result); }
/** * PUT /courses : Updates an existing updatedCourse. * * @param updatedCourse the course to update * @return the ResponseEntity with status 200 (OK) and with body the updated course * @throws URISyntaxException if the Location URI syntax is incorrect */
PUT /courses : Updates an existing updatedCourse. @param updatedCourse the course to update @return the ResponseEntity with status 200 (OK) and with body the updated course @throws URISyntaxException if the Location URI syntax is incorrect
[ "PUT", "/", "courses", ":", "Updates", "an", "existing", "updatedCourse", ".", "@param", "updatedCourse", "the", "course", "to", "update", "@return", "the", "ResponseEntity", "with", "status", "200", "(", "OK", ")", "and", "with", "body", "the", "updated", "course", "@throws", "URISyntaxException", "if", "the", "Location", "URI", "syntax", "is", "incorrect" ]
@PutMapping("/courses") @PreAuthorize("hasRole('INSTRUCTOR')") public ResponseEntity<Course> updateCourse(@RequestBody Course updatedCourse) throws URISyntaxException { log.debug("REST request to update Course : {}", updatedCourse); User user = userRepository.getUserWithGroupsAndAuthorities(); if (updatedCourse.getId() == null) { if (authCheckService.isAdmin(user)) { return createCourse(updatedCourse); } else { throw new AccessForbiddenException(NOT_ALLOWED); } } var existingCourse = courseRepository.findByIdElseThrow(updatedCourse.getId()); if (!Objects.equals(existingCourse.getShortName(), updatedCourse.getShortName())) { throw new BadRequestAlertException("The course short name cannot be changed", ENTITY_NAME, "shortNameCannotChange", true); } authCheckService.checkHasAtLeastRoleInCourseElseThrow(Role.INSTRUCTOR, existingCourse, user); if (authCheckService.isAdmin(user)) { try { if (!Objects.equals(existingCourse.getStudentGroupName(), updatedCourse.getStudentGroupName())) { checkIfGroupsExists(updatedCourse.getStudentGroupName()); } if (!Objects.equals(existingCourse.getTeachingAssistantGroupName(), updatedCourse.getTeachingAssistantGroupName())) { checkIfGroupsExists(updatedCourse.getTeachingAssistantGroupName()); } if (!Objects.equals(existingCourse.getEditorGroupName(), updatedCourse.getEditorGroupName())) { checkIfGroupsExists(updatedCourse.getEditorGroupName()); } if (!Objects.equals(existingCourse.getInstructorGroupName(), updatedCourse.getInstructorGroupName())) { checkIfGroupsExists(updatedCourse.getInstructorGroupName()); } } catch (ArtemisAuthenticationException ex) { throw new BadRequestAlertException(ex.getMessage(), ENTITY_NAME, "groupNotFound", true); } } else { if (!Objects.equals(existingCourse.getStudentGroupName(), updatedCourse.getStudentGroupName())) { throw new BadRequestAlertException("The student group name cannot be changed", ENTITY_NAME, "studentGroupNameCannotChange", true); } if (!Objects.equals(existingCourse.getTeachingAssistantGroupName(), updatedCourse.getTeachingAssistantGroupName())) { throw new BadRequestAlertException("The teaching assistant group name cannot be changed", ENTITY_NAME, "teachingAssistantGroupNameCannotChange", true); } if (!Objects.equals(existingCourse.getEditorGroupName(), updatedCourse.getEditorGroupName())) { throw new BadRequestAlertException("The editor group name cannot be changed", ENTITY_NAME, "editorGroupNameCannotChange", true); } if (!Objects.equals(existingCourse.getInstructorGroupName(), updatedCourse.getInstructorGroupName())) { throw new BadRequestAlertException("The instructor group name cannot be changed", ENTITY_NAME, "instructorGroupNameCannotChange", true); } } validateRegistrationConfirmationMessage(updatedCourse); validateComplaintsAndRequestMoreFeedbackConfig(updatedCourse); validateOnlineCourseAndRegistrationEnabled(updatedCourse); validateShortName(updatedCourse); final var oldInstructorGroup = existingCourse.getInstructorGroupName(); final var oldEditorGroup = existingCourse.getEditorGroupName(); final var oldTeachingAssistantGroup = existingCourse.getTeachingAssistantGroupName(); Course result = courseRepository.save(updatedCourse); optionalVcsUserManagementService .ifPresent(userManagementService -> userManagementService.updateCoursePermissions(result, oldInstructorGroup, oldEditorGroup, oldTeachingAssistantGroup)); optionalCiUserManagementService .ifPresent(ciUserManagementService -> ciUserManagementService.updateCoursePermissions(result, oldInstructorGroup, oldEditorGroup, oldTeachingAssistantGroup)); return ResponseEntity.ok().headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, updatedCourse.getTitle())).body(result); }
[ "@", "PutMapping", "(", "\"/courses\"", ")", "@", "PreAuthorize", "(", "\"hasRole('INSTRUCTOR')\"", ")", "public", "ResponseEntity", "<", "Course", ">", "updateCourse", "(", "@", "RequestBody", "Course", "updatedCourse", ")", "throws", "URISyntaxException", "{", "log", ".", "debug", "(", "\"REST request to update Course : {}\"", ",", "updatedCourse", ")", ";", "User", "user", "=", "userRepository", ".", "getUserWithGroupsAndAuthorities", "(", ")", ";", "if", "(", "updatedCourse", ".", "getId", "(", ")", "==", "null", ")", "{", "if", "(", "authCheckService", ".", "isAdmin", "(", "user", ")", ")", "{", "return", "createCourse", "(", "updatedCourse", ")", ";", "}", "else", "{", "throw", "new", "AccessForbiddenException", "(", "NOT_ALLOWED", ")", ";", "}", "}", "var", "existingCourse", "=", "courseRepository", ".", "findByIdElseThrow", "(", "updatedCourse", ".", "getId", "(", ")", ")", ";", "if", "(", "!", "Objects", ".", "equals", "(", "existingCourse", ".", "getShortName", "(", ")", ",", "updatedCourse", ".", "getShortName", "(", ")", ")", ")", "{", "throw", "new", "BadRequestAlertException", "(", "\"The course short name cannot be changed\"", ",", "ENTITY_NAME", ",", "\"shortNameCannotChange\"", ",", "true", ")", ";", "}", "authCheckService", ".", "checkHasAtLeastRoleInCourseElseThrow", "(", "Role", ".", "INSTRUCTOR", ",", "existingCourse", ",", "user", ")", ";", "if", "(", "authCheckService", ".", "isAdmin", "(", "user", ")", ")", "{", "try", "{", "if", "(", "!", "Objects", ".", "equals", "(", "existingCourse", ".", "getStudentGroupName", "(", ")", ",", "updatedCourse", ".", "getStudentGroupName", "(", ")", ")", ")", "{", "checkIfGroupsExists", "(", "updatedCourse", ".", "getStudentGroupName", "(", ")", ")", ";", "}", "if", "(", "!", "Objects", ".", "equals", "(", "existingCourse", ".", "getTeachingAssistantGroupName", "(", ")", ",", "updatedCourse", ".", "getTeachingAssistantGroupName", "(", ")", ")", ")", "{", "checkIfGroupsExists", "(", "updatedCourse", ".", "getTeachingAssistantGroupName", "(", ")", ")", ";", "}", "if", "(", "!", "Objects", ".", "equals", "(", "existingCourse", ".", "getEditorGroupName", "(", ")", ",", "updatedCourse", ".", "getEditorGroupName", "(", ")", ")", ")", "{", "checkIfGroupsExists", "(", "updatedCourse", ".", "getEditorGroupName", "(", ")", ")", ";", "}", "if", "(", "!", "Objects", ".", "equals", "(", "existingCourse", ".", "getInstructorGroupName", "(", ")", ",", "updatedCourse", ".", "getInstructorGroupName", "(", ")", ")", ")", "{", "checkIfGroupsExists", "(", "updatedCourse", ".", "getInstructorGroupName", "(", ")", ")", ";", "}", "}", "catch", "(", "ArtemisAuthenticationException", "ex", ")", "{", "throw", "new", "BadRequestAlertException", "(", "ex", ".", "getMessage", "(", ")", ",", "ENTITY_NAME", ",", "\"groupNotFound\"", ",", "true", ")", ";", "}", "}", "else", "{", "if", "(", "!", "Objects", ".", "equals", "(", "existingCourse", ".", "getStudentGroupName", "(", ")", ",", "updatedCourse", ".", "getStudentGroupName", "(", ")", ")", ")", "{", "throw", "new", "BadRequestAlertException", "(", "\"The student group name cannot be changed\"", ",", "ENTITY_NAME", ",", "\"studentGroupNameCannotChange\"", ",", "true", ")", ";", "}", "if", "(", "!", "Objects", ".", "equals", "(", "existingCourse", ".", "getTeachingAssistantGroupName", "(", ")", ",", "updatedCourse", ".", "getTeachingAssistantGroupName", "(", ")", ")", ")", "{", "throw", "new", "BadRequestAlertException", "(", "\"The teaching assistant group name cannot be changed\"", ",", "ENTITY_NAME", ",", "\"teachingAssistantGroupNameCannotChange\"", ",", "true", ")", ";", "}", "if", "(", "!", "Objects", ".", "equals", "(", "existingCourse", ".", "getEditorGroupName", "(", ")", ",", "updatedCourse", ".", "getEditorGroupName", "(", ")", ")", ")", "{", "throw", "new", "BadRequestAlertException", "(", "\"The editor group name cannot be changed\"", ",", "ENTITY_NAME", ",", "\"editorGroupNameCannotChange\"", ",", "true", ")", ";", "}", "if", "(", "!", "Objects", ".", "equals", "(", "existingCourse", ".", "getInstructorGroupName", "(", ")", ",", "updatedCourse", ".", "getInstructorGroupName", "(", ")", ")", ")", "{", "throw", "new", "BadRequestAlertException", "(", "\"The instructor group name cannot be changed\"", ",", "ENTITY_NAME", ",", "\"instructorGroupNameCannotChange\"", ",", "true", ")", ";", "}", "}", "validateRegistrationConfirmationMessage", "(", "updatedCourse", ")", ";", "validateComplaintsAndRequestMoreFeedbackConfig", "(", "updatedCourse", ")", ";", "validateOnlineCourseAndRegistrationEnabled", "(", "updatedCourse", ")", ";", "validateShortName", "(", "updatedCourse", ")", ";", "final", "var", "oldInstructorGroup", "=", "existingCourse", ".", "getInstructorGroupName", "(", ")", ";", "final", "var", "oldEditorGroup", "=", "existingCourse", ".", "getEditorGroupName", "(", ")", ";", "final", "var", "oldTeachingAssistantGroup", "=", "existingCourse", ".", "getTeachingAssistantGroupName", "(", ")", ";", "Course", "result", "=", "courseRepository", ".", "save", "(", "updatedCourse", ")", ";", "optionalVcsUserManagementService", ".", "ifPresent", "(", "userManagementService", "->", "userManagementService", ".", "updateCoursePermissions", "(", "result", ",", "oldInstructorGroup", ",", "oldEditorGroup", ",", "oldTeachingAssistantGroup", ")", ")", ";", "optionalCiUserManagementService", ".", "ifPresent", "(", "ciUserManagementService", "->", "ciUserManagementService", ".", "updateCoursePermissions", "(", "result", ",", "oldInstructorGroup", ",", "oldEditorGroup", ",", "oldTeachingAssistantGroup", ")", ")", ";", "return", "ResponseEntity", ".", "ok", "(", ")", ".", "headers", "(", "HeaderUtil", ".", "createEntityUpdateAlert", "(", "applicationName", ",", "true", ",", "ENTITY_NAME", ",", "updatedCourse", ".", "getTitle", "(", ")", ")", ")", ".", "body", "(", "result", ")", ";", "}" ]
PUT /courses : Updates an existing updatedCourse.
[ "PUT", "/", "courses", ":", "Updates", "an", "existing", "updatedCourse", "." ]
[ "// only allow admins or instructors of the existing course to change it", "// this is important, otherwise someone could put himself into the instructor group of the updated course", "// if an admin changes a group, we need to check that the changed group exists", "// a specified group does not exist, notify the client", "// this means the user must be an instructor, who has NOT Admin rights.", "// instructors are not allowed to change group names, because this would lead to security problems", "// Based on the old instructors, editors and TAs, we can update all exercises in the course in the VCS (if necessary)", "// We need the old instructors, editors and TAs, so that the VCS user management service can determine which", "// users no longer have TA, editor or instructor rights in the related exercise repositories." ]
[ { "param": "updatedCourse", "type": "Course" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "updatedCourse", "type": "Course", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 6426, 3233, 2932, 19, 15804, 7923, 203, 565, 632, 1386, 18987, 2932, 5332, 2996, 2668, 706, 13915, 916, 23291, 13, 203, 565, 1071, 2306, 1943, 32, 39, 3117, 34, 1089, 39, 3117, 26964, 28843, 385, 3117, 3526, 39, 3117, 13, 1216, 19883, 288, 203, 3639, 613, 18, 4148, 2932, 12030, 590, 358, 1089, 385, 3117, 294, 3728, 16, 3526, 39, 3117, 1769, 203, 3639, 2177, 729, 273, 729, 3305, 18, 588, 1299, 1190, 3621, 1876, 3594, 1961, 5621, 203, 3639, 309, 261, 7007, 39, 3117, 18, 26321, 1435, 422, 446, 13, 288, 203, 5411, 309, 261, 1944, 1564, 1179, 18, 291, 4446, 12, 1355, 3719, 288, 203, 7734, 327, 752, 39, 3117, 12, 7007, 39, 3117, 1769, 203, 5411, 289, 203, 5411, 469, 288, 203, 7734, 604, 394, 5016, 16553, 503, 12, 4400, 67, 16852, 1769, 203, 5411, 289, 203, 3639, 289, 203, 203, 3639, 569, 2062, 39, 3117, 273, 4362, 3305, 18, 4720, 5132, 12427, 8282, 12, 7007, 39, 3117, 18, 26321, 10663, 203, 3639, 309, 16051, 4710, 18, 14963, 12, 11711, 39, 3117, 18, 588, 29983, 9334, 3526, 39, 3117, 18, 588, 29983, 1435, 3719, 288, 203, 5411, 604, 394, 23223, 13298, 503, 2932, 1986, 4362, 3025, 508, 2780, 506, 3550, 3113, 17020, 67, 1985, 16, 315, 6620, 461, 4515, 3043, 3113, 638, 1769, 203, 3639, 289, 203, 203, 3639, 368, 1338, 1699, 31116, 578, 316, 1697, 1383, 434, 326, 2062, 4362, 358, 2549, 518, 203, 3639, 368, 333, 353, 10802, 16, 3541, 18626, 3377, 1378, 366, 381, 2890, 1368, 326, 316, 2732, 1041, 434, 326, 3526, 4362, 203, 3639, 1357, 1564, 1179, 18, 1893, 5582, 25070, 2996, 382, 39, 3117, 12427, 8282, 12, 2996, 18, 706, 13915, 916, 16, 2062, 39, 3117, 16, 729, 1769, 203, 203, 3639, 309, 261, 1944, 1564, 1179, 18, 291, 4446, 12, 1355, 3719, 288, 203, 5411, 368, 309, 392, 3981, 3478, 279, 1041, 16, 732, 1608, 358, 866, 716, 326, 3550, 1041, 1704, 203, 5411, 775, 288, 203, 7734, 309, 16051, 4710, 18, 14963, 12, 11711, 39, 3117, 18, 588, 19943, 319, 3943, 9334, 3526, 39, 3117, 18, 588, 19943, 319, 3943, 1435, 3719, 288, 203, 10792, 19130, 3621, 4002, 12, 7007, 39, 3117, 18, 588, 19943, 319, 3943, 10663, 203, 7734, 289, 203, 7734, 309, 16051, 4710, 18, 14963, 12, 11711, 39, 3117, 18, 588, 56, 13798, 310, 2610, 17175, 3943, 9334, 3526, 39, 3117, 18, 588, 56, 13798, 310, 2610, 17175, 3943, 1435, 3719, 288, 203, 10792, 19130, 3621, 4002, 12, 7007, 39, 3117, 18, 588, 56, 13798, 310, 2610, 17175, 3943, 10663, 203, 7734, 289, 203, 7734, 309, 16051, 4710, 18, 14963, 12, 11711, 39, 3117, 18, 588, 6946, 3943, 9334, 3526, 39, 3117, 18, 588, 6946, 3943, 1435, 3719, 288, 203, 10792, 19130, 3621, 4002, 12, 7007, 39, 3117, 18, 588, 6946, 3943, 10663, 203, 7734, 289, 203, 7734, 309, 16051, 4710, 18, 14963, 12, 11711, 39, 3117, 18, 588, 382, 2732, 3943, 9334, 3526, 39, 3117, 18, 588, 382, 2732, 3943, 1435, 3719, 288, 203, 10792, 19130, 3621, 4002, 12, 7007, 2 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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, 13, 471, 598, 1417, 326, 3526, 4362, 203, 377, 380, 632, 15069, 19883, 309, 326, 7050, 3699, 6279, 353, 11332, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
2a9da177c1b6bf418b8f10f10e06e9b9d1dcc138
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/web/rest/CourseResource.java
[ "MIT" ]
Java
registerForCourse
null
@PostMapping("/courses/{courseId}/register") @PreAuthorize("hasRole('USER')") public ResponseEntity<User> registerForCourse(@PathVariable Long courseId) { Course course = courseRepository.findWithEagerOrganizationsElseThrow(courseId); User user = userRepository.getUserWithGroupsAndAuthoritiesAndOrganizations(); log.debug("REST request to register {} for Course {}", user.getName(), course.getTitle()); if (allowedCourseRegistrationUsernamePattern.isPresent() && !allowedCourseRegistrationUsernamePattern.get().matcher(user.getLogin()).matches()) { return ResponseEntity.badRequest().headers(HeaderUtil.createFailureAlert(applicationName, false, ENTITY_NAME, "registrationNotAllowed", "Registration with this username is not allowed. Cannot register user")).body(null); } if (course.getStartDate() != null && course.getStartDate().isAfter(now())) { return ResponseEntity.badRequest() .headers(HeaderUtil.createFailureAlert(applicationName, false, ENTITY_NAME, "courseNotStarted", "The course has not yet started. Cannot register user")) .body(null); } if (course.getEndDate() != null && course.getEndDate().isBefore(now())) { return ResponseEntity.badRequest() .headers(HeaderUtil.createFailureAlert(applicationName, false, ENTITY_NAME, "courseAlreadyFinished", "The course has already finished. Cannot register user")) .body(null); } if (!Boolean.TRUE.equals(course.isRegistrationEnabled())) { return ResponseEntity.badRequest().headers( HeaderUtil.createFailureAlert(applicationName, false, ENTITY_NAME, "registrationDisabled", "The course does not allow registration. Cannot register user")) .body(null); } if (course.getOrganizations() != null && course.getOrganizations().size() > 0 && !checkIfUserIsMemberOfCourseOrganizations(user, course)) { return ResponseEntity.badRequest().headers(HeaderUtil.createFailureAlert(applicationName, false, ENTITY_NAME, "registrationNotAllowed", "User is not member of any organization of this course. Cannot register user")).body(null); } courseService.registerUserForCourse(user, course); return ResponseEntity.ok(user); }
/** * POST /courses/{courseId}/register : Register for an existing course. This method registers the current user for the given course id in case the course has already started * and not finished yet. The user is added to the course student group in the Authentication System and the course student group is added to the user's groups in the Artemis * database. * * @param courseId to find the course * @return response entity for user who has been registered to the course */
POST /courses/{courseId}/register : Register for an existing course. This method registers the current user for the given course id in case the course has already started and not finished yet. The user is added to the course student group in the Authentication System and the course student group is added to the user's groups in the Artemis database. @param courseId to find the course @return response entity for user who has been registered to the course
[ "POST", "/", "courses", "/", "{", "courseId", "}", "/", "register", ":", "Register", "for", "an", "existing", "course", ".", "This", "method", "registers", "the", "current", "user", "for", "the", "given", "course", "id", "in", "case", "the", "course", "has", "already", "started", "and", "not", "finished", "yet", ".", "The", "user", "is", "added", "to", "the", "course", "student", "group", "in", "the", "Authentication", "System", "and", "the", "course", "student", "group", "is", "added", "to", "the", "user", "'", "s", "groups", "in", "the", "Artemis", "database", ".", "@param", "courseId", "to", "find", "the", "course", "@return", "response", "entity", "for", "user", "who", "has", "been", "registered", "to", "the", "course" ]
@PostMapping("/courses/{courseId}/register") @PreAuthorize("hasRole('USER')") public ResponseEntity<User> registerForCourse(@PathVariable Long courseId) { Course course = courseRepository.findWithEagerOrganizationsElseThrow(courseId); User user = userRepository.getUserWithGroupsAndAuthoritiesAndOrganizations(); log.debug("REST request to register {} for Course {}", user.getName(), course.getTitle()); if (allowedCourseRegistrationUsernamePattern.isPresent() && !allowedCourseRegistrationUsernamePattern.get().matcher(user.getLogin()).matches()) { return ResponseEntity.badRequest().headers(HeaderUtil.createFailureAlert(applicationName, false, ENTITY_NAME, "registrationNotAllowed", "Registration with this username is not allowed. Cannot register user")).body(null); } if (course.getStartDate() != null && course.getStartDate().isAfter(now())) { return ResponseEntity.badRequest() .headers(HeaderUtil.createFailureAlert(applicationName, false, ENTITY_NAME, "courseNotStarted", "The course has not yet started. Cannot register user")) .body(null); } if (course.getEndDate() != null && course.getEndDate().isBefore(now())) { return ResponseEntity.badRequest() .headers(HeaderUtil.createFailureAlert(applicationName, false, ENTITY_NAME, "courseAlreadyFinished", "The course has already finished. Cannot register user")) .body(null); } if (!Boolean.TRUE.equals(course.isRegistrationEnabled())) { return ResponseEntity.badRequest().headers( HeaderUtil.createFailureAlert(applicationName, false, ENTITY_NAME, "registrationDisabled", "The course does not allow registration. Cannot register user")) .body(null); } if (course.getOrganizations() != null && course.getOrganizations().size() > 0 && !checkIfUserIsMemberOfCourseOrganizations(user, course)) { return ResponseEntity.badRequest().headers(HeaderUtil.createFailureAlert(applicationName, false, ENTITY_NAME, "registrationNotAllowed", "User is not member of any organization of this course. Cannot register user")).body(null); } courseService.registerUserForCourse(user, course); return ResponseEntity.ok(user); }
[ "@", "PostMapping", "(", "\"/courses/{courseId}/register\"", ")", "@", "PreAuthorize", "(", "\"hasRole('USER')\"", ")", "public", "ResponseEntity", "<", "User", ">", "registerForCourse", "(", "@", "PathVariable", "Long", "courseId", ")", "{", "Course", "course", "=", "courseRepository", ".", "findWithEagerOrganizationsElseThrow", "(", "courseId", ")", ";", "User", "user", "=", "userRepository", ".", "getUserWithGroupsAndAuthoritiesAndOrganizations", "(", ")", ";", "log", ".", "debug", "(", "\"REST request to register {} for Course {}\"", ",", "user", ".", "getName", "(", ")", ",", "course", ".", "getTitle", "(", ")", ")", ";", "if", "(", "allowedCourseRegistrationUsernamePattern", ".", "isPresent", "(", ")", "&&", "!", "allowedCourseRegistrationUsernamePattern", ".", "get", "(", ")", ".", "matcher", "(", "user", ".", "getLogin", "(", ")", ")", ".", "matches", "(", ")", ")", "{", "return", "ResponseEntity", ".", "badRequest", "(", ")", ".", "headers", "(", "HeaderUtil", ".", "createFailureAlert", "(", "applicationName", ",", "false", ",", "ENTITY_NAME", ",", "\"registrationNotAllowed\"", ",", "\"Registration with this username is not allowed. Cannot register user\"", ")", ")", ".", "body", "(", "null", ")", ";", "}", "if", "(", "course", ".", "getStartDate", "(", ")", "!=", "null", "&&", "course", ".", "getStartDate", "(", ")", ".", "isAfter", "(", "now", "(", ")", ")", ")", "{", "return", "ResponseEntity", ".", "badRequest", "(", ")", ".", "headers", "(", "HeaderUtil", ".", "createFailureAlert", "(", "applicationName", ",", "false", ",", "ENTITY_NAME", ",", "\"courseNotStarted\"", ",", "\"The course has not yet started. Cannot register user\"", ")", ")", ".", "body", "(", "null", ")", ";", "}", "if", "(", "course", ".", "getEndDate", "(", ")", "!=", "null", "&&", "course", ".", "getEndDate", "(", ")", ".", "isBefore", "(", "now", "(", ")", ")", ")", "{", "return", "ResponseEntity", ".", "badRequest", "(", ")", ".", "headers", "(", "HeaderUtil", ".", "createFailureAlert", "(", "applicationName", ",", "false", ",", "ENTITY_NAME", ",", "\"courseAlreadyFinished\"", ",", "\"The course has already finished. Cannot register user\"", ")", ")", ".", "body", "(", "null", ")", ";", "}", "if", "(", "!", "Boolean", ".", "TRUE", ".", "equals", "(", "course", ".", "isRegistrationEnabled", "(", ")", ")", ")", "{", "return", "ResponseEntity", ".", "badRequest", "(", ")", ".", "headers", "(", "HeaderUtil", ".", "createFailureAlert", "(", "applicationName", ",", "false", ",", "ENTITY_NAME", ",", "\"registrationDisabled\"", ",", "\"The course does not allow registration. Cannot register user\"", ")", ")", ".", "body", "(", "null", ")", ";", "}", "if", "(", "course", ".", "getOrganizations", "(", ")", "!=", "null", "&&", "course", ".", "getOrganizations", "(", ")", ".", "size", "(", ")", ">", "0", "&&", "!", "checkIfUserIsMemberOfCourseOrganizations", "(", "user", ",", "course", ")", ")", "{", "return", "ResponseEntity", ".", "badRequest", "(", ")", ".", "headers", "(", "HeaderUtil", ".", "createFailureAlert", "(", "applicationName", ",", "false", ",", "ENTITY_NAME", ",", "\"registrationNotAllowed\"", ",", "\"User is not member of any organization of this course. Cannot register user\"", ")", ")", ".", "body", "(", "null", ")", ";", "}", "courseService", ".", "registerUserForCourse", "(", "user", ",", "course", ")", ";", "return", "ResponseEntity", ".", "ok", "(", "user", ")", ";", "}" ]
POST /courses/{courseId}/register : Register for an existing course.
[ "POST", "/", "courses", "/", "{", "courseId", "}", "/", "register", ":", "Register", "for", "an", "existing", "course", "." ]
[]
[ { "param": "courseId", "type": "Long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "courseId", "type": "Long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 3349, 3233, 2932, 19, 15804, 4938, 5566, 548, 4004, 4861, 7923, 203, 565, 632, 1386, 18987, 2932, 5332, 2996, 2668, 4714, 23291, 13, 203, 565, 1071, 2306, 1943, 32, 1299, 34, 1744, 1290, 39, 3117, 26964, 743, 3092, 3407, 4362, 548, 13, 288, 203, 3639, 385, 3117, 4362, 273, 4362, 3305, 18, 4720, 1190, 41, 6817, 25533, 12427, 8282, 12, 5566, 548, 1769, 203, 3639, 2177, 729, 273, 729, 3305, 18, 588, 1299, 1190, 3621, 1876, 3594, 1961, 1876, 25533, 5621, 203, 3639, 613, 18, 4148, 2932, 12030, 590, 358, 1744, 2618, 364, 385, 3117, 3728, 16, 729, 18, 17994, 9334, 4362, 18, 588, 4247, 10663, 203, 3639, 309, 261, 8151, 39, 3117, 7843, 8575, 3234, 18, 291, 6351, 1435, 597, 401, 8151, 39, 3117, 7843, 8575, 3234, 18, 588, 7675, 22761, 12, 1355, 18, 588, 5358, 1435, 2934, 8436, 10756, 288, 203, 5411, 327, 2306, 1943, 18, 8759, 691, 7675, 2485, 12, 1864, 1304, 18, 2640, 5247, 13298, 12, 3685, 461, 16, 629, 16, 17020, 67, 1985, 16, 315, 14170, 19354, 3113, 203, 10792, 315, 7843, 598, 333, 2718, 353, 486, 2935, 18, 14143, 1744, 729, 7923, 2934, 3432, 12, 2011, 1769, 203, 3639, 289, 203, 3639, 309, 261, 5566, 18, 588, 22635, 1435, 480, 446, 597, 4362, 18, 588, 22635, 7675, 291, 4436, 12, 3338, 1435, 3719, 288, 203, 5411, 327, 2306, 1943, 18, 8759, 691, 1435, 203, 10792, 263, 2485, 12, 1864, 1304, 18, 2640, 5247, 13298, 12, 3685, 461, 16, 629, 16, 17020, 67, 1985, 16, 315, 5566, 1248, 9217, 3113, 315, 1986, 4362, 711, 486, 4671, 5746, 18, 14143, 1744, 729, 6, 3719, 203, 10792, 263, 3432, 12, 2011, 1769, 203, 3639, 289, 203, 3639, 309, 261, 5566, 18, 588, 24640, 1435, 480, 446, 597, 4362, 18, 588, 24640, 7675, 291, 4649, 12, 3338, 1435, 3719, 288, 203, 5411, 327, 2306, 1943, 18, 8759, 691, 1435, 203, 10792, 263, 2485, 12, 1864, 1304, 18, 2640, 5247, 13298, 12, 3685, 461, 16, 629, 16, 17020, 67, 1985, 16, 315, 5566, 9430, 10577, 3113, 315, 1986, 4362, 711, 1818, 6708, 18, 14143, 1744, 729, 6, 3719, 203, 10792, 263, 3432, 12, 2011, 1769, 203, 3639, 289, 203, 3639, 309, 16051, 5507, 18, 18724, 18, 14963, 12, 5566, 18, 291, 7843, 1526, 1435, 3719, 288, 203, 5411, 327, 2306, 1943, 18, 8759, 691, 7675, 2485, 12, 203, 10792, 4304, 1304, 18, 2640, 5247, 13298, 12, 3685, 461, 16, 629, 16, 17020, 67, 1985, 16, 315, 14170, 8853, 3113, 315, 1986, 4362, 1552, 486, 1699, 7914, 18, 14143, 1744, 729, 6, 3719, 203, 10792, 263, 3432, 12, 2011, 1769, 203, 3639, 289, 203, 3639, 309, 261, 5566, 18, 588, 25533, 1435, 480, 446, 597, 4362, 18, 588, 25533, 7675, 1467, 1435, 405, 374, 597, 401, 1893, 2047, 1299, 2520, 4419, 951, 39, 3117, 25533, 12, 1355, 16, 4362, 3719, 288, 203, 5411, 327, 2306, 1943, 18, 8759, 691, 7675, 2485,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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
[ 1, 26873, 203, 377, 380, 5485, 342, 15804, 4938, 5566, 548, 4004, 4861, 294, 5433, 364, 392, 2062, 4362, 18, 1220, 707, 10285, 326, 783, 729, 364, 326, 864, 4362, 612, 316, 648, 326, 4362, 711, 1818, 5746, 203, 377, 380, 471, 486, 6708, 4671, 18, 1021, 729, 353, 3096, 358, 326, 4362, 18110, 1041, 316, 326, 8665, 2332, 471, 326, 4362, 18110, 1041, 353, 3096, 358, 326, 729, 1807, 3252, 316, 326, 1201, 874, 291, 203, 377, 380, 2063, 18, 203, 377, 380, 203, 377, 380, 632, 891, 4362, 548, 358, 1104, 326, 4362, 203, 377, 380, 632, 2463, 766, 1522, 364, 729, 10354, 711, 2118, 4104, 358, 326, 4362, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
2a9da177c1b6bf418b8f10f10e06e9b9d1dcc138
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/web/rest/CourseResource.java
[ "MIT" ]
Java
fetchParticipationsWithSubmissionsAndResultsForCourses
null
public void fetchParticipationsWithSubmissionsAndResultsForCourses(List<Course> courses, User user, long startTimeInMillis) { Set<Exercise> exercises = courses.stream().flatMap(course -> course.getExercises().stream()).collect(Collectors.toSet()); List<StudentParticipation> participationsOfUserInExercises = studentParticipationRepository.getAllParticipationsOfUserInExercises(user, exercises); if (participationsOfUserInExercises.isEmpty()) { return; } for (Course course : courses) { boolean isStudent = !authCheckService.isAtLeastTeachingAssistantInCourse(course, user); for (Exercise exercise : course.getExercises()) { // add participation with submission and result to each exercise exerciseService.filterForCourseDashboard(exercise, participationsOfUserInExercises, user.getLogin(), isStudent); // remove sensitive information from the exercise for students if (isStudent) { exercise.filterSensitiveInformation(); } } } Map<ExerciseMode, List<Exercise>> exercisesGroupedByExerciseMode = exercises.stream().collect(Collectors.groupingBy(Exercise::getMode)); int noOfIndividualExercises = Optional.ofNullable(exercisesGroupedByExerciseMode.get(ExerciseMode.INDIVIDUAL)).orElse(List.of()).size(); int noOfTeamExercises = Optional.ofNullable(exercisesGroupedByExerciseMode.get(ExerciseMode.TEAM)).orElse(List.of()).size(); log.info("/courses/for-dashboard.done in {}ms for {} courses with {} individual exercises and {} team exercises for user {}", System.currentTimeMillis() - startTimeInMillis, courses.size(), noOfIndividualExercises, noOfTeamExercises, user.getLogin()); }
/** * Note: The number of courses should not change * * @param courses the courses for which the participations should be fetched * @param user the user for which the participations should be fetched * @param startTimeInMillis start time for logging purposes */
The number of courses should not change @param courses the courses for which the participations should be fetched @param user the user for which the participations should be fetched @param startTimeInMillis start time for logging purposes
[ "The", "number", "of", "courses", "should", "not", "change", "@param", "courses", "the", "courses", "for", "which", "the", "participations", "should", "be", "fetched", "@param", "user", "the", "user", "for", "which", "the", "participations", "should", "be", "fetched", "@param", "startTimeInMillis", "start", "time", "for", "logging", "purposes" ]
public void fetchParticipationsWithSubmissionsAndResultsForCourses(List<Course> courses, User user, long startTimeInMillis) { Set<Exercise> exercises = courses.stream().flatMap(course -> course.getExercises().stream()).collect(Collectors.toSet()); List<StudentParticipation> participationsOfUserInExercises = studentParticipationRepository.getAllParticipationsOfUserInExercises(user, exercises); if (participationsOfUserInExercises.isEmpty()) { return; } for (Course course : courses) { boolean isStudent = !authCheckService.isAtLeastTeachingAssistantInCourse(course, user); for (Exercise exercise : course.getExercises()) { exerciseService.filterForCourseDashboard(exercise, participationsOfUserInExercises, user.getLogin(), isStudent); if (isStudent) { exercise.filterSensitiveInformation(); } } } Map<ExerciseMode, List<Exercise>> exercisesGroupedByExerciseMode = exercises.stream().collect(Collectors.groupingBy(Exercise::getMode)); int noOfIndividualExercises = Optional.ofNullable(exercisesGroupedByExerciseMode.get(ExerciseMode.INDIVIDUAL)).orElse(List.of()).size(); int noOfTeamExercises = Optional.ofNullable(exercisesGroupedByExerciseMode.get(ExerciseMode.TEAM)).orElse(List.of()).size(); log.info("/courses/for-dashboard.done in {}ms for {} courses with {} individual exercises and {} team exercises for user {}", System.currentTimeMillis() - startTimeInMillis, courses.size(), noOfIndividualExercises, noOfTeamExercises, user.getLogin()); }
[ "public", "void", "fetchParticipationsWithSubmissionsAndResultsForCourses", "(", "List", "<", "Course", ">", "courses", ",", "User", "user", ",", "long", "startTimeInMillis", ")", "{", "Set", "<", "Exercise", ">", "exercises", "=", "courses", ".", "stream", "(", ")", ".", "flatMap", "(", "course", "->", "course", ".", "getExercises", "(", ")", ".", "stream", "(", ")", ")", ".", "collect", "(", "Collectors", ".", "toSet", "(", ")", ")", ";", "List", "<", "StudentParticipation", ">", "participationsOfUserInExercises", "=", "studentParticipationRepository", ".", "getAllParticipationsOfUserInExercises", "(", "user", ",", "exercises", ")", ";", "if", "(", "participationsOfUserInExercises", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "for", "(", "Course", "course", ":", "courses", ")", "{", "boolean", "isStudent", "=", "!", "authCheckService", ".", "isAtLeastTeachingAssistantInCourse", "(", "course", ",", "user", ")", ";", "for", "(", "Exercise", "exercise", ":", "course", ".", "getExercises", "(", ")", ")", "{", "exerciseService", ".", "filterForCourseDashboard", "(", "exercise", ",", "participationsOfUserInExercises", ",", "user", ".", "getLogin", "(", ")", ",", "isStudent", ")", ";", "if", "(", "isStudent", ")", "{", "exercise", ".", "filterSensitiveInformation", "(", ")", ";", "}", "}", "}", "Map", "<", "ExerciseMode", ",", "List", "<", "Exercise", ">", ">", "exercisesGroupedByExerciseMode", "=", "exercises", ".", "stream", "(", ")", ".", "collect", "(", "Collectors", ".", "groupingBy", "(", "Exercise", "::", "getMode", ")", ")", ";", "int", "noOfIndividualExercises", "=", "Optional", ".", "ofNullable", "(", "exercisesGroupedByExerciseMode", ".", "get", "(", "ExerciseMode", ".", "INDIVIDUAL", ")", ")", ".", "orElse", "(", "List", ".", "of", "(", ")", ")", ".", "size", "(", ")", ";", "int", "noOfTeamExercises", "=", "Optional", ".", "ofNullable", "(", "exercisesGroupedByExerciseMode", ".", "get", "(", "ExerciseMode", ".", "TEAM", ")", ")", ".", "orElse", "(", "List", ".", "of", "(", ")", ")", ".", "size", "(", ")", ";", "log", ".", "info", "(", "\"/courses/for-dashboard.done in {}ms for {} courses with {} individual exercises and {} team exercises for user {}\"", ",", "System", ".", "currentTimeMillis", "(", ")", "-", "startTimeInMillis", ",", "courses", ".", "size", "(", ")", ",", "noOfIndividualExercises", ",", "noOfTeamExercises", ",", "user", ".", "getLogin", "(", ")", ")", ";", "}" ]
Note: The number of courses should not change @param courses the courses for which the participations should be fetched @param user the user for which the participations should be fetched @param startTimeInMillis start time for logging purposes
[ "Note", ":", "The", "number", "of", "courses", "should", "not", "change", "@param", "courses", "the", "courses", "for", "which", "the", "participations", "should", "be", "fetched", "@param", "user", "the", "user", "for", "which", "the", "participations", "should", "be", "fetched", "@param", "startTimeInMillis", "start", "time", "for", "logging", "purposes" ]
[ "// add participation with submission and result to each exercise", "// remove sensitive information from the exercise for students" ]
[ { "param": "courses", "type": "List<Course>" }, { "param": "user", "type": "User" }, { "param": "startTimeInMillis", "type": "long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "courses", "type": "List<Course>", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "user", "type": "User", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "startTimeInMillis", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 918, 2158, 1988, 24629, 1012, 1190, 1676, 7300, 1876, 3447, 1290, 39, 10692, 12, 682, 32, 39, 3117, 34, 17224, 16, 2177, 729, 16, 1525, 8657, 16620, 13, 288, 203, 3639, 1000, 32, 424, 20603, 34, 431, 12610, 6141, 273, 17224, 18, 3256, 7675, 15401, 863, 12, 5566, 317, 4362, 18, 588, 424, 12610, 6141, 7675, 3256, 1435, 2934, 14676, 12, 10808, 1383, 18, 869, 694, 10663, 203, 3639, 987, 32, 19943, 319, 1988, 24629, 367, 34, 30891, 1012, 951, 1299, 382, 424, 12610, 6141, 273, 18110, 1988, 24629, 367, 3305, 18, 588, 1595, 1988, 24629, 1012, 951, 1299, 382, 424, 12610, 6141, 12, 1355, 16, 431, 12610, 6141, 1769, 203, 3639, 309, 261, 2680, 24629, 1012, 951, 1299, 382, 424, 12610, 6141, 18, 291, 1921, 10756, 288, 203, 5411, 327, 31, 203, 3639, 289, 203, 3639, 364, 261, 39, 3117, 4362, 294, 17224, 13, 288, 203, 5411, 1250, 353, 19943, 319, 273, 401, 1944, 1564, 1179, 18, 291, 25070, 56, 13798, 310, 2610, 17175, 382, 39, 3117, 12, 5566, 16, 729, 1769, 203, 5411, 364, 261, 424, 20603, 24165, 294, 4362, 18, 588, 424, 12610, 6141, 10756, 288, 203, 7734, 368, 527, 30891, 367, 598, 8515, 471, 563, 358, 1517, 24165, 203, 7734, 24165, 1179, 18, 2188, 1290, 39, 3117, 14830, 12, 8913, 30708, 16, 30891, 1012, 951, 1299, 382, 424, 12610, 6141, 16, 729, 18, 588, 5358, 9334, 353, 19943, 319, 1769, 203, 7734, 368, 1206, 16692, 1779, 628, 326, 24165, 364, 10068, 4877, 203, 7734, 309, 261, 291, 19943, 319, 13, 288, 203, 10792, 24165, 18, 2188, 14220, 5369, 5621, 203, 7734, 289, 203, 5411, 289, 203, 3639, 289, 203, 3639, 1635, 32, 424, 20603, 2309, 16, 987, 32, 424, 20603, 9778, 431, 12610, 6141, 1114, 18696, 424, 20603, 2309, 273, 431, 12610, 6141, 18, 3256, 7675, 14676, 12, 10808, 1383, 18, 25592, 858, 12, 424, 20603, 2866, 588, 2309, 10019, 203, 3639, 509, 1158, 951, 29834, 424, 12610, 6141, 273, 4055, 18, 792, 13349, 12, 8913, 71, 6141, 1114, 18696, 424, 20603, 2309, 18, 588, 12, 424, 20603, 2309, 18, 2356, 8188, 734, 14235, 13, 2934, 280, 12427, 12, 682, 18, 792, 1435, 2934, 1467, 5621, 203, 3639, 509, 1158, 951, 8689, 424, 12610, 6141, 273, 4055, 18, 792, 13349, 12, 8913, 71, 6141, 1114, 18696, 424, 20603, 2309, 18, 588, 12, 424, 20603, 2309, 18, 1448, 2192, 13, 2934, 280, 12427, 12, 682, 18, 792, 1435, 2934, 1467, 5621, 203, 3639, 613, 18, 1376, 2932, 19, 15804, 19, 1884, 17, 13479, 18, 8734, 316, 2618, 959, 364, 2618, 17224, 598, 2618, 7327, 431, 12610, 6141, 471, 2618, 5927, 431, 12610, 6141, 364, 729, 3728, 16, 203, 7734, 2332, 18, 2972, 28512, 1435, 300, 8657, 16620, 16, 17224, 18, 1467, 9334, 1158, 951, 29834, 424, 12610, 6141, 16, 1158, 951, 8689, 424, 12610, 6141, 16, 729, 18, 588, 5358, 10663, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 3609, 30, 1021, 1300, 434, 17224, 1410, 486, 2549, 203, 377, 380, 203, 377, 380, 632, 891, 17224, 6647, 326, 17224, 364, 1492, 326, 30891, 1012, 1410, 506, 12807, 203, 377, 380, 632, 891, 729, 2868, 326, 729, 364, 1492, 326, 30891, 1012, 1410, 506, 12807, 203, 377, 380, 632, 891, 8657, 16620, 787, 813, 364, 2907, 13694, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
2a9da177c1b6bf418b8f10f10e06e9b9d1dcc138
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/web/rest/CourseResource.java
[ "MIT" ]
Java
archiveCourse
null
@PutMapping("/courses/{courseId}/archive") @PreAuthorize("hasRole('INSTRUCTOR')") public ResponseEntity<Void> archiveCourse(@PathVariable Long courseId) { log.info("REST request to archive Course : {}", courseId); final Course course = courseRepository.findByIdWithExercisesAndLecturesElseThrow(courseId); authCheckService.checkHasAtLeastRoleInCourseElseThrow(Role.INSTRUCTOR, course, null); // Archiving a course is only possible after the course is over if (now().isBefore(course.getEndDate())) { throw new BadRequestAlertException("You cannot archive a course that is not over.", ENTITY_NAME, "courseNotOver", true); } courseService.archiveCourse(course); // Note: in the first version, we do not store the results with feedback and other meta data, as those will stay available in Artemis, the main focus is to allow // instructors to download student repos in order to delete those on Bitbucket/Gitlab // Note: Lectures are not part of the archive at the moment and will be included in a future version // 1) Get all lectures (attachments) of the course and store them in a folder // Note: Questions and answers are not part of the archive at the moment and will be included in a future version // 1) Get all questions and answers for exercises and lectures and store those in structured text files return ResponseEntity.ok().build(); }
/** * PUT /courses/{courseId} : archive an existing course asynchronously. This method starts the process of archiving all course exercises, submissions and results in a large * zip file. It immediately returns and runs this task asynchronously. When the task is done, the course is marked as archived, which means the zip file can be downloaded. * * @param courseId the id of the course * @return empty */
PUT /courses/{courseId} : archive an existing course asynchronously. This method starts the process of archiving all course exercises, submissions and results in a large zip file. It immediately returns and runs this task asynchronously. When the task is done, the course is marked as archived, which means the zip file can be downloaded. @param courseId the id of the course @return empty
[ "PUT", "/", "courses", "/", "{", "courseId", "}", ":", "archive", "an", "existing", "course", "asynchronously", ".", "This", "method", "starts", "the", "process", "of", "archiving", "all", "course", "exercises", "submissions", "and", "results", "in", "a", "large", "zip", "file", ".", "It", "immediately", "returns", "and", "runs", "this", "task", "asynchronously", ".", "When", "the", "task", "is", "done", "the", "course", "is", "marked", "as", "archived", "which", "means", "the", "zip", "file", "can", "be", "downloaded", ".", "@param", "courseId", "the", "id", "of", "the", "course", "@return", "empty" ]
@PutMapping("/courses/{courseId}/archive") @PreAuthorize("hasRole('INSTRUCTOR')") public ResponseEntity<Void> archiveCourse(@PathVariable Long courseId) { log.info("REST request to archive Course : {}", courseId); final Course course = courseRepository.findByIdWithExercisesAndLecturesElseThrow(courseId); authCheckService.checkHasAtLeastRoleInCourseElseThrow(Role.INSTRUCTOR, course, null); if (now().isBefore(course.getEndDate())) { throw new BadRequestAlertException("You cannot archive a course that is not over.", ENTITY_NAME, "courseNotOver", true); } courseService.archiveCourse(course); return ResponseEntity.ok().build(); }
[ "@", "PutMapping", "(", "\"/courses/{courseId}/archive\"", ")", "@", "PreAuthorize", "(", "\"hasRole('INSTRUCTOR')\"", ")", "public", "ResponseEntity", "<", "Void", ">", "archiveCourse", "(", "@", "PathVariable", "Long", "courseId", ")", "{", "log", ".", "info", "(", "\"REST request to archive Course : {}\"", ",", "courseId", ")", ";", "final", "Course", "course", "=", "courseRepository", ".", "findByIdWithExercisesAndLecturesElseThrow", "(", "courseId", ")", ";", "authCheckService", ".", "checkHasAtLeastRoleInCourseElseThrow", "(", "Role", ".", "INSTRUCTOR", ",", "course", ",", "null", ")", ";", "if", "(", "now", "(", ")", ".", "isBefore", "(", "course", ".", "getEndDate", "(", ")", ")", ")", "{", "throw", "new", "BadRequestAlertException", "(", "\"You cannot archive a course that is not over.\"", ",", "ENTITY_NAME", ",", "\"courseNotOver\"", ",", "true", ")", ";", "}", "courseService", ".", "archiveCourse", "(", "course", ")", ";", "return", "ResponseEntity", ".", "ok", "(", ")", ".", "build", "(", ")", ";", "}" ]
PUT /courses/{courseId} : archive an existing course asynchronously.
[ "PUT", "/", "courses", "/", "{", "courseId", "}", ":", "archive", "an", "existing", "course", "asynchronously", "." ]
[ "// Archiving a course is only possible after the course is over", "// Note: in the first version, we do not store the results with feedback and other meta data, as those will stay available in Artemis, the main focus is to allow", "// instructors to download student repos in order to delete those on Bitbucket/Gitlab", "// Note: Lectures are not part of the archive at the moment and will be included in a future version", "// 1) Get all lectures (attachments) of the course and store them in a folder", "// Note: Questions and answers are not part of the archive at the moment and will be included in a future version", "// 1) Get all questions and answers for exercises and lectures and store those in structured text files" ]
[ { "param": "courseId", "type": "Long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "courseId", "type": "Long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 6426, 3233, 2932, 19, 15804, 4938, 5566, 548, 4004, 10686, 7923, 203, 565, 632, 1386, 18987, 2932, 5332, 2996, 2668, 706, 13915, 916, 23291, 13, 203, 565, 1071, 2306, 1943, 32, 19038, 34, 5052, 39, 3117, 26964, 743, 3092, 3407, 4362, 548, 13, 288, 203, 3639, 613, 18, 1376, 2932, 12030, 590, 358, 5052, 385, 3117, 294, 3728, 16, 4362, 548, 1769, 203, 3639, 727, 385, 3117, 4362, 273, 4362, 3305, 18, 4720, 5132, 1190, 424, 12610, 6141, 1876, 48, 386, 1823, 12427, 8282, 12, 5566, 548, 1769, 203, 3639, 1357, 1564, 1179, 18, 1893, 5582, 25070, 2996, 382, 39, 3117, 12427, 8282, 12, 2996, 18, 706, 13915, 916, 16, 4362, 16, 446, 1769, 203, 3639, 368, 16959, 9288, 279, 4362, 353, 1338, 3323, 1839, 326, 4362, 353, 1879, 203, 3639, 309, 261, 3338, 7675, 291, 4649, 12, 5566, 18, 588, 24640, 1435, 3719, 288, 203, 5411, 604, 394, 23223, 13298, 503, 2932, 6225, 2780, 5052, 279, 4362, 716, 353, 486, 1879, 1199, 16, 17020, 67, 1985, 16, 315, 5566, 1248, 4851, 3113, 638, 1769, 203, 3639, 289, 203, 3639, 4362, 1179, 18, 10686, 39, 3117, 12, 5566, 1769, 203, 203, 3639, 368, 3609, 30, 316, 326, 1122, 1177, 16, 732, 741, 486, 1707, 326, 1686, 598, 10762, 471, 1308, 2191, 501, 16, 487, 5348, 903, 23449, 2319, 316, 1201, 874, 291, 16, 326, 2774, 7155, 353, 358, 1699, 203, 3639, 368, 316, 1697, 1383, 358, 4224, 18110, 13686, 316, 1353, 358, 1430, 5348, 603, 6539, 7242, 19, 11540, 7411, 203, 203, 3639, 368, 3609, 30, 511, 386, 1823, 854, 486, 1087, 434, 326, 5052, 622, 326, 10382, 471, 903, 506, 5849, 316, 279, 3563, 1177, 203, 3639, 368, 404, 13, 968, 777, 884, 299, 1823, 261, 17828, 13, 434, 326, 4362, 471, 1707, 2182, 316, 279, 3009, 203, 203, 3639, 368, 3609, 30, 4783, 395, 1115, 471, 12415, 854, 486, 1087, 434, 326, 5052, 622, 326, 10382, 471, 903, 506, 5849, 316, 279, 3563, 1177, 203, 3639, 368, 404, 13, 968, 777, 13494, 471, 12415, 364, 431, 12610, 6141, 471, 884, 299, 1823, 471, 1707, 5348, 316, 19788, 977, 1390, 203, 203, 3639, 327, 2306, 1943, 18, 601, 7675, 3510, 5621, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 11443, 342, 15804, 4938, 5566, 548, 97, 294, 5052, 392, 2062, 4362, 14952, 18, 1220, 707, 2542, 326, 1207, 434, 6637, 9288, 777, 4362, 431, 12610, 6141, 16, 22071, 471, 1686, 316, 279, 7876, 203, 377, 380, 3144, 585, 18, 2597, 7636, 1135, 471, 7597, 333, 1562, 14952, 18, 5203, 326, 1562, 353, 2731, 16, 326, 4362, 353, 9350, 487, 23276, 16, 1492, 4696, 326, 3144, 585, 848, 506, 13549, 18, 203, 377, 380, 203, 377, 380, 632, 891, 4362, 548, 326, 612, 434, 326, 4362, 203, 377, 380, 632, 2463, 1008, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
2a9da177c1b6bf418b8f10f10e06e9b9d1dcc138
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/web/rest/CourseResource.java
[ "MIT" ]
Java
downloadCourseArchive
null
@PreAuthorize("hasRole('INSTRUCTOR')") @GetMapping("/courses/{courseId}/download-archive") public ResponseEntity<Resource> downloadCourseArchive(@PathVariable Long courseId) throws FileNotFoundException { log.info("REST request to download archive of Course : {}", courseId); final Course course = courseRepository.findByIdElseThrow(courseId); authCheckService.checkHasAtLeastRoleInCourseElseThrow(Role.INSTRUCTOR, course, null); if (!course.hasCourseArchive()) { throw new EntityNotFoundException("Archived course", courseId); } // The path is stored in the course table Path archive = Path.of(courseArchivesDirPath, course.getCourseArchivePath()); File zipFile = archive.toFile(); InputStreamResource resource = new InputStreamResource(new FileInputStream(zipFile)); return ResponseEntity.ok().contentLength(zipFile.length()).contentType(MediaType.APPLICATION_OCTET_STREAM).header("filename", zipFile.getName()).body(resource); }
/** * Downloads the zip file of the archived course if it exists. Throws a 404 if the course doesn't exist * * @param courseId The course id of the archived course * @return ResponseEntity with status */
Downloads the zip file of the archived course if it exists. Throws a 404 if the course doesn't exist @param courseId The course id of the archived course @return ResponseEntity with status
[ "Downloads", "the", "zip", "file", "of", "the", "archived", "course", "if", "it", "exists", ".", "Throws", "a", "404", "if", "the", "course", "doesn", "'", "t", "exist", "@param", "courseId", "The", "course", "id", "of", "the", "archived", "course", "@return", "ResponseEntity", "with", "status" ]
@PreAuthorize("hasRole('INSTRUCTOR')") @GetMapping("/courses/{courseId}/download-archive") public ResponseEntity<Resource> downloadCourseArchive(@PathVariable Long courseId) throws FileNotFoundException { log.info("REST request to download archive of Course : {}", courseId); final Course course = courseRepository.findByIdElseThrow(courseId); authCheckService.checkHasAtLeastRoleInCourseElseThrow(Role.INSTRUCTOR, course, null); if (!course.hasCourseArchive()) { throw new EntityNotFoundException("Archived course", courseId); } Path archive = Path.of(courseArchivesDirPath, course.getCourseArchivePath()); File zipFile = archive.toFile(); InputStreamResource resource = new InputStreamResource(new FileInputStream(zipFile)); return ResponseEntity.ok().contentLength(zipFile.length()).contentType(MediaType.APPLICATION_OCTET_STREAM).header("filename", zipFile.getName()).body(resource); }
[ "@", "PreAuthorize", "(", "\"hasRole('INSTRUCTOR')\"", ")", "@", "GetMapping", "(", "\"/courses/{courseId}/download-archive\"", ")", "public", "ResponseEntity", "<", "Resource", ">", "downloadCourseArchive", "(", "@", "PathVariable", "Long", "courseId", ")", "throws", "FileNotFoundException", "{", "log", ".", "info", "(", "\"REST request to download archive of Course : {}\"", ",", "courseId", ")", ";", "final", "Course", "course", "=", "courseRepository", ".", "findByIdElseThrow", "(", "courseId", ")", ";", "authCheckService", ".", "checkHasAtLeastRoleInCourseElseThrow", "(", "Role", ".", "INSTRUCTOR", ",", "course", ",", "null", ")", ";", "if", "(", "!", "course", ".", "hasCourseArchive", "(", ")", ")", "{", "throw", "new", "EntityNotFoundException", "(", "\"Archived course\"", ",", "courseId", ")", ";", "}", "Path", "archive", "=", "Path", ".", "of", "(", "courseArchivesDirPath", ",", "course", ".", "getCourseArchivePath", "(", ")", ")", ";", "File", "zipFile", "=", "archive", ".", "toFile", "(", ")", ";", "InputStreamResource", "resource", "=", "new", "InputStreamResource", "(", "new", "FileInputStream", "(", "zipFile", ")", ")", ";", "return", "ResponseEntity", ".", "ok", "(", ")", ".", "contentLength", "(", "zipFile", ".", "length", "(", ")", ")", ".", "contentType", "(", "MediaType", ".", "APPLICATION_OCTET_STREAM", ")", ".", "header", "(", "\"filename\"", ",", "zipFile", ".", "getName", "(", ")", ")", ".", "body", "(", "resource", ")", ";", "}" ]
Downloads the zip file of the archived course if it exists.
[ "Downloads", "the", "zip", "file", "of", "the", "archived", "course", "if", "it", "exists", "." ]
[ "// The path is stored in the course table" ]
[ { "param": "courseId", "type": "Long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "courseId", "type": "Long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 1386, 18987, 2932, 5332, 2996, 2668, 706, 13915, 916, 23291, 13, 203, 565, 632, 967, 3233, 2932, 19, 15804, 4938, 5566, 548, 4004, 7813, 17, 10686, 7923, 203, 565, 1071, 2306, 1943, 32, 1420, 34, 4224, 39, 3117, 7465, 26964, 743, 3092, 3407, 4362, 548, 13, 1216, 13707, 288, 203, 3639, 613, 18, 1376, 2932, 12030, 590, 358, 4224, 5052, 434, 385, 3117, 294, 3728, 16, 4362, 548, 1769, 203, 3639, 727, 385, 3117, 4362, 273, 4362, 3305, 18, 4720, 5132, 12427, 8282, 12, 5566, 548, 1769, 203, 3639, 1357, 1564, 1179, 18, 1893, 5582, 25070, 2996, 382, 39, 3117, 12427, 8282, 12, 2996, 18, 706, 13915, 916, 16, 4362, 16, 446, 1769, 203, 3639, 309, 16051, 5566, 18, 5332, 39, 3117, 7465, 10756, 288, 203, 5411, 604, 394, 3887, 3990, 2932, 12269, 2950, 4362, 3113, 4362, 548, 1769, 203, 3639, 289, 203, 203, 3639, 368, 1021, 589, 353, 4041, 316, 326, 4362, 1014, 203, 3639, 2666, 5052, 273, 2666, 18, 792, 12, 5566, 12269, 3606, 20129, 16, 4362, 18, 588, 39, 3117, 7465, 743, 10663, 203, 203, 3639, 1387, 19450, 273, 5052, 18, 869, 812, 5621, 203, 3639, 5037, 1420, 1058, 273, 394, 5037, 1420, 12, 2704, 11907, 12, 4450, 812, 10019, 203, 3639, 327, 2306, 1943, 18, 601, 7675, 1745, 1782, 12, 4450, 812, 18, 2469, 1435, 2934, 22194, 12, 20870, 18, 25039, 67, 51, 1268, 1584, 67, 13693, 2934, 3374, 2932, 3459, 3113, 19450, 18, 17994, 1435, 2934, 3432, 12, 3146, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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404, 1005, 203, 377, 380, 203, 377, 380, 632, 891, 4362, 548, 1021, 4362, 612, 434, 326, 23276, 4362, 203, 377, 380, 632, 2463, 2306, 1943, 598, 1267, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
2a9da177c1b6bf418b8f10f10e06e9b9d1dcc138
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/web/rest/CourseResource.java
[ "MIT" ]
Java
cleanup
null
@DeleteMapping("/courses/{courseId}/cleanup") @PreAuthorize("hasRole('INSTRUCTOR')") public ResponseEntity<Resource> cleanup(@PathVariable Long courseId) { log.info("REST request to cleanup the Course : {}", courseId); final Course course = courseRepository.findByIdElseThrow(courseId); authCheckService.checkHasAtLeastRoleInCourseElseThrow(Role.INSTRUCTOR, course, null); // Forbid cleaning the course if no archive has been created if (!course.hasCourseArchive()) { throw new BadRequestAlertException("Failed to clean up course " + courseId + " because it needs to be archived first.", ENTITY_NAME, "archivenonexistant"); } courseService.cleanupCourse(courseId); return ResponseEntity.ok().build(); }
/** * DELETE /courses/:course/cleanup : Cleans up a course by deleting all student submissions. * * @param courseId Id of the course to clean up * @return ResponseEntity with status */
DELETE /courses/:course/cleanup : Cleans up a course by deleting all student submissions. @param courseId Id of the course to clean up @return ResponseEntity with status
[ "DELETE", "/", "courses", "/", ":", "course", "/", "cleanup", ":", "Cleans", "up", "a", "course", "by", "deleting", "all", "student", "submissions", ".", "@param", "courseId", "Id", "of", "the", "course", "to", "clean", "up", "@return", "ResponseEntity", "with", "status" ]
@DeleteMapping("/courses/{courseId}/cleanup") @PreAuthorize("hasRole('INSTRUCTOR')") public ResponseEntity<Resource> cleanup(@PathVariable Long courseId) { log.info("REST request to cleanup the Course : {}", courseId); final Course course = courseRepository.findByIdElseThrow(courseId); authCheckService.checkHasAtLeastRoleInCourseElseThrow(Role.INSTRUCTOR, course, null); if (!course.hasCourseArchive()) { throw new BadRequestAlertException("Failed to clean up course " + courseId + " because it needs to be archived first.", ENTITY_NAME, "archivenonexistant"); } courseService.cleanupCourse(courseId); return ResponseEntity.ok().build(); }
[ "@", "DeleteMapping", "(", "\"/courses/{courseId}/cleanup\"", ")", "@", "PreAuthorize", "(", "\"hasRole('INSTRUCTOR')\"", ")", "public", "ResponseEntity", "<", "Resource", ">", "cleanup", "(", "@", "PathVariable", "Long", "courseId", ")", "{", "log", ".", "info", "(", "\"REST request to cleanup the Course : {}\"", ",", "courseId", ")", ";", "final", "Course", "course", "=", "courseRepository", ".", "findByIdElseThrow", "(", "courseId", ")", ";", "authCheckService", ".", "checkHasAtLeastRoleInCourseElseThrow", "(", "Role", ".", "INSTRUCTOR", ",", "course", ",", "null", ")", ";", "if", "(", "!", "course", ".", "hasCourseArchive", "(", ")", ")", "{", "throw", "new", "BadRequestAlertException", "(", "\"Failed to clean up course \"", "+", "courseId", "+", "\" because it needs to be archived first.\"", ",", "ENTITY_NAME", ",", "\"archivenonexistant\"", ")", ";", "}", "courseService", ".", "cleanupCourse", "(", "courseId", ")", ";", "return", "ResponseEntity", ".", "ok", "(", ")", ".", "build", "(", ")", ";", "}" ]
DELETE /courses/:course/cleanup : Cleans up a course by deleting all student submissions.
[ "DELETE", "/", "courses", "/", ":", "course", "/", "cleanup", ":", "Cleans", "up", "a", "course", "by", "deleting", "all", "student", "submissions", "." ]
[ "// Forbid cleaning the course if no archive has been created" ]
[ { "param": "courseId", "type": "Long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "courseId", "type": "Long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 2613, 3233, 2932, 19, 15804, 4938, 5566, 548, 4004, 16732, 7923, 203, 565, 632, 1386, 18987, 2932, 5332, 2996, 2668, 706, 13915, 916, 23291, 13, 203, 565, 1071, 2306, 1943, 32, 1420, 34, 6686, 26964, 743, 3092, 3407, 4362, 548, 13, 288, 203, 3639, 613, 18, 1376, 2932, 12030, 590, 358, 6686, 326, 385, 3117, 294, 3728, 16, 4362, 548, 1769, 203, 3639, 727, 385, 3117, 4362, 273, 4362, 3305, 18, 4720, 5132, 12427, 8282, 12, 5566, 548, 1769, 203, 3639, 1357, 1564, 1179, 18, 1893, 5582, 25070, 2996, 382, 39, 3117, 12427, 8282, 12, 2996, 18, 706, 13915, 916, 16, 4362, 16, 446, 1769, 203, 3639, 368, 2457, 19773, 24225, 326, 4362, 309, 1158, 5052, 711, 2118, 2522, 203, 3639, 309, 16051, 5566, 18, 5332, 39, 3117, 7465, 10756, 288, 203, 5411, 604, 394, 23223, 13298, 503, 2932, 2925, 358, 2721, 731, 4362, 315, 397, 4362, 548, 397, 315, 2724, 518, 4260, 358, 506, 23276, 1122, 1199, 16, 17020, 67, 1985, 16, 315, 991, 837, 265, 7398, 970, 8863, 203, 3639, 289, 203, 3639, 4362, 1179, 18, 16732, 39, 3117, 12, 5566, 548, 1769, 203, 3639, 327, 2306, 1943, 18, 601, 7675, 3510, 5621, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 8568, 342, 15804, 16880, 5566, 19, 16732, 294, 6257, 634, 731, 279, 4362, 635, 12993, 777, 18110, 22071, 18, 203, 377, 380, 203, 377, 380, 632, 891, 4362, 548, 3124, 434, 326, 4362, 358, 2721, 731, 203, 377, 380, 632, 2463, 2306, 1943, 598, 1267, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
2a9da177c1b6bf418b8f10f10e06e9b9d1dcc138
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/web/rest/CourseResource.java
[ "MIT" ]
Java
addStudentToCourse
null
@PostMapping(value = "/courses/{courseId}/students/{studentLogin:" + Constants.LOGIN_REGEX + "}") @PreAuthorize("hasRole('INSTRUCTOR')") public ResponseEntity<Void> addStudentToCourse(@PathVariable Long courseId, @PathVariable String studentLogin) { log.debug("REST request to add {} as student to course : {}", studentLogin, courseId); var course = courseRepository.findByIdElseThrow(courseId); return addUserToCourseGroup(studentLogin, userRepository.getUserWithGroupsAndAuthorities(), course, course.getStudentGroupName(), Role.STUDENT); }
/** * Post /courses/:courseId/students/:studentLogin : Add the given user to the students of the course so that the student can access the course * * @param courseId the id of the course * @param studentLogin the login of the user who should get student access * @return empty ResponseEntity with status 200 (OK) or with status 404 (Not Found) */
Post /courses/:courseId/students/:studentLogin : Add the given user to the students of the course so that the student can access the course @param courseId the id of the course @param studentLogin the login of the user who should get student access @return empty ResponseEntity with status 200 (OK) or with status 404 (Not Found)
[ "Post", "/", "courses", "/", ":", "courseId", "/", "students", "/", ":", "studentLogin", ":", "Add", "the", "given", "user", "to", "the", "students", "of", "the", "course", "so", "that", "the", "student", "can", "access", "the", "course", "@param", "courseId", "the", "id", "of", "the", "course", "@param", "studentLogin", "the", "login", "of", "the", "user", "who", "should", "get", "student", "access", "@return", "empty", "ResponseEntity", "with", "status", "200", "(", "OK", ")", "or", "with", "status", "404", "(", "Not", "Found", ")" ]
@PostMapping(value = "/courses/{courseId}/students/{studentLogin:" + Constants.LOGIN_REGEX + "}") @PreAuthorize("hasRole('INSTRUCTOR')") public ResponseEntity<Void> addStudentToCourse(@PathVariable Long courseId, @PathVariable String studentLogin) { log.debug("REST request to add {} as student to course : {}", studentLogin, courseId); var course = courseRepository.findByIdElseThrow(courseId); return addUserToCourseGroup(studentLogin, userRepository.getUserWithGroupsAndAuthorities(), course, course.getStudentGroupName(), Role.STUDENT); }
[ "@", "PostMapping", "(", "value", "=", "\"/courses/{courseId}/students/{studentLogin:\"", "+", "Constants", ".", "LOGIN_REGEX", "+", "\"}\"", ")", "@", "PreAuthorize", "(", "\"hasRole('INSTRUCTOR')\"", ")", "public", "ResponseEntity", "<", "Void", ">", "addStudentToCourse", "(", "@", "PathVariable", "Long", "courseId", ",", "@", "PathVariable", "String", "studentLogin", ")", "{", "log", ".", "debug", "(", "\"REST request to add {} as student to course : {}\"", ",", "studentLogin", ",", "courseId", ")", ";", "var", "course", "=", "courseRepository", ".", "findByIdElseThrow", "(", "courseId", ")", ";", "return", "addUserToCourseGroup", "(", "studentLogin", ",", "userRepository", ".", "getUserWithGroupsAndAuthorities", "(", ")", ",", "course", ",", "course", ".", "getStudentGroupName", "(", ")", ",", "Role", ".", "STUDENT", ")", ";", "}" ]
Post /courses/:courseId/students/:studentLogin : Add the given user to the students of the course so that the student can access the course @param courseId the id of the course @param studentLogin the login of the user who should get student access @return empty ResponseEntity with status 200 (OK) or with status 404 (Not Found)
[ "Post", "/", "courses", "/", ":", "courseId", "/", "students", "/", ":", "studentLogin", ":", "Add", "the", "given", "user", "to", "the", "students", "of", "the", "course", "so", "that", "the", "student", "can", "access", "the", "course", "@param", "courseId", "the", "id", "of", "the", "course", "@param", "studentLogin", "the", "login", "of", "the", "user", "who", "should", "get", "student", "access", "@return", "empty", "ResponseEntity", "with", "status", "200", "(", "OK", ")", "or", "with", "status", "404", "(", "Not", "Found", ")" ]
[]
[ { "param": "courseId", "type": "Long" }, { "param": "studentLogin", "type": "String" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "courseId", "type": "Long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "studentLogin", "type": "String", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 3349, 3233, 12, 1132, 273, 2206, 15804, 4938, 5566, 548, 4004, 16120, 4877, 4938, 26240, 5358, 2773, 397, 5245, 18, 19022, 67, 12472, 397, 11883, 13, 203, 565, 632, 1386, 18987, 2932, 5332, 2996, 2668, 706, 13915, 916, 23291, 13, 203, 565, 1071, 2306, 1943, 32, 19038, 34, 527, 19943, 319, 774, 39, 3117, 26964, 743, 3092, 3407, 4362, 548, 16, 632, 743, 3092, 514, 18110, 5358, 13, 288, 203, 3639, 613, 18, 4148, 2932, 12030, 590, 358, 527, 2618, 487, 18110, 358, 4362, 294, 3728, 16, 18110, 5358, 16, 4362, 548, 1769, 203, 3639, 569, 4362, 273, 4362, 3305, 18, 4720, 5132, 12427, 8282, 12, 5566, 548, 1769, 203, 3639, 327, 527, 1299, 774, 39, 3117, 1114, 12, 26240, 5358, 16, 729, 3305, 18, 588, 1299, 1190, 3621, 1876, 3594, 1961, 9334, 4362, 16, 4362, 18, 588, 19943, 319, 3943, 9334, 6204, 18, 882, 12587, 2222, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 5616, 342, 15804, 16880, 5566, 548, 19, 16120, 4877, 16880, 26240, 5358, 294, 1436, 326, 864, 729, 358, 326, 10068, 4877, 434, 326, 4362, 1427, 716, 326, 18110, 848, 2006, 326, 4362, 203, 377, 380, 203, 377, 380, 632, 891, 4362, 548, 377, 326, 612, 434, 326, 4362, 203, 377, 380, 632, 891, 18110, 5358, 326, 3925, 434, 326, 729, 10354, 1410, 336, 18110, 2006, 203, 377, 380, 632, 2463, 1008, 2306, 1943, 598, 1267, 4044, 261, 3141, 13, 578, 598, 1267, 7709, 261, 1248, 10750, 13, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
2a9da177c1b6bf418b8f10f10e06e9b9d1dcc138
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/web/rest/CourseResource.java
[ "MIT" ]
Java
addTutorToCourse
null
@PostMapping(value = "/courses/{courseId}/tutors/{tutorLogin:" + Constants.LOGIN_REGEX + "}") @PreAuthorize("hasRole('INSTRUCTOR')") public ResponseEntity<Void> addTutorToCourse(@PathVariable Long courseId, @PathVariable String tutorLogin) { log.debug("REST request to add {} as tutors to course : {}", tutorLogin, courseId); var course = courseRepository.findByIdElseThrow(courseId); return addUserToCourseGroup(tutorLogin, userRepository.getUserWithGroupsAndAuthorities(), course, course.getTeachingAssistantGroupName(), Role.TEACHING_ASSISTANT); }
/** * Post /courses/:courseId/tutors/:tutorLogin : Add the given user to the tutors of the course so that the student can access the course administration * * @param courseId the id of the course * @param tutorLogin the login of the user who should get tutor access * @return empty ResponseEntity with status 200 (OK) or with status 404 (Not Found) */
Post /courses/:courseId/tutors/:tutorLogin : Add the given user to the tutors of the course so that the student can access the course administration @param courseId the id of the course @param tutorLogin the login of the user who should get tutor access @return empty ResponseEntity with status 200 (OK) or with status 404 (Not Found)
[ "Post", "/", "courses", "/", ":", "courseId", "/", "tutors", "/", ":", "tutorLogin", ":", "Add", "the", "given", "user", "to", "the", "tutors", "of", "the", "course", "so", "that", "the", "student", "can", "access", "the", "course", "administration", "@param", "courseId", "the", "id", "of", "the", "course", "@param", "tutorLogin", "the", "login", "of", "the", "user", "who", "should", "get", "tutor", "access", "@return", "empty", "ResponseEntity", "with", "status", "200", "(", "OK", ")", "or", "with", "status", "404", "(", "Not", "Found", ")" ]
@PostMapping(value = "/courses/{courseId}/tutors/{tutorLogin:" + Constants.LOGIN_REGEX + "}") @PreAuthorize("hasRole('INSTRUCTOR')") public ResponseEntity<Void> addTutorToCourse(@PathVariable Long courseId, @PathVariable String tutorLogin) { log.debug("REST request to add {} as tutors to course : {}", tutorLogin, courseId); var course = courseRepository.findByIdElseThrow(courseId); return addUserToCourseGroup(tutorLogin, userRepository.getUserWithGroupsAndAuthorities(), course, course.getTeachingAssistantGroupName(), Role.TEACHING_ASSISTANT); }
[ "@", "PostMapping", "(", "value", "=", "\"/courses/{courseId}/tutors/{tutorLogin:\"", "+", "Constants", ".", "LOGIN_REGEX", "+", "\"}\"", ")", "@", "PreAuthorize", "(", "\"hasRole('INSTRUCTOR')\"", ")", "public", "ResponseEntity", "<", "Void", ">", "addTutorToCourse", "(", "@", "PathVariable", "Long", "courseId", ",", "@", "PathVariable", "String", "tutorLogin", ")", "{", "log", ".", "debug", "(", "\"REST request to add {} as tutors to course : {}\"", ",", "tutorLogin", ",", "courseId", ")", ";", "var", "course", "=", "courseRepository", ".", "findByIdElseThrow", "(", "courseId", ")", ";", "return", "addUserToCourseGroup", "(", "tutorLogin", ",", "userRepository", ".", "getUserWithGroupsAndAuthorities", "(", ")", ",", "course", ",", "course", ".", "getTeachingAssistantGroupName", "(", ")", ",", "Role", ".", "TEACHING_ASSISTANT", ")", ";", "}" ]
Post /courses/:courseId/tutors/:tutorLogin : Add the given user to the tutors of the course so that the student can access the course administration @param courseId the id of the course @param tutorLogin the login of the user who should get tutor access @return empty ResponseEntity with status 200 (OK) or with status 404 (Not Found)
[ "Post", "/", "courses", "/", ":", "courseId", "/", "tutors", "/", ":", "tutorLogin", ":", "Add", "the", "given", "user", "to", "the", "tutors", "of", "the", "course", "so", "that", "the", "student", "can", "access", "the", "course", "administration", "@param", "courseId", "the", "id", "of", "the", "course", "@param", "tutorLogin", "the", "login", "of", "the", "user", "who", "should", "get", "tutor", "access", "@return", "empty", "ResponseEntity", "with", "status", "200", "(", "OK", ")", "or", "with", "status", "404", "(", "Not", "Found", ")" ]
[]
[ { "param": "courseId", "type": "Long" }, { "param": "tutorLogin", "type": "String" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "courseId", "type": "Long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "tutorLogin", "type": "String", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 3349, 3233, 12, 1132, 273, 2206, 15804, 4938, 5566, 548, 4004, 88, 13595, 4938, 88, 3408, 5358, 2773, 397, 5245, 18, 19022, 67, 12472, 397, 11883, 13, 203, 565, 632, 1386, 18987, 2932, 5332, 2996, 2668, 706, 13915, 916, 23291, 13, 203, 565, 1071, 2306, 1943, 32, 19038, 34, 527, 56, 3408, 774, 39, 3117, 26964, 743, 3092, 3407, 4362, 548, 16, 632, 743, 3092, 514, 268, 3408, 5358, 13, 288, 203, 3639, 613, 18, 4148, 2932, 12030, 590, 358, 527, 2618, 487, 268, 13595, 358, 4362, 294, 3728, 16, 268, 3408, 5358, 16, 4362, 548, 1769, 203, 3639, 569, 4362, 273, 4362, 3305, 18, 4720, 5132, 12427, 8282, 12, 5566, 548, 1769, 203, 3639, 327, 527, 1299, 774, 39, 3117, 1114, 12, 88, 3408, 5358, 16, 729, 3305, 18, 588, 1299, 1190, 3621, 1876, 3594, 1961, 9334, 4362, 16, 4362, 18, 588, 56, 13798, 310, 2610, 17175, 3943, 9334, 6204, 18, 1448, 18133, 1360, 67, 8423, 5511, 6856, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 5616, 342, 15804, 16880, 5566, 548, 19, 88, 13595, 16880, 88, 3408, 5358, 294, 1436, 326, 864, 729, 358, 326, 268, 13595, 434, 326, 4362, 1427, 716, 326, 18110, 848, 2006, 326, 4362, 3981, 4218, 203, 377, 380, 203, 377, 380, 632, 891, 4362, 548, 282, 326, 612, 434, 326, 4362, 203, 377, 380, 632, 891, 268, 3408, 5358, 326, 3925, 434, 326, 729, 10354, 1410, 336, 268, 3408, 2006, 203, 377, 380, 632, 2463, 1008, 2306, 1943, 598, 1267, 4044, 261, 3141, 13, 578, 598, 1267, 7709, 261, 1248, 10750, 13, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
2a9da177c1b6bf418b8f10f10e06e9b9d1dcc138
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/web/rest/CourseResource.java
[ "MIT" ]
Java
addEditorToCourse
null
@PostMapping(value = "/courses/{courseId}/editors/{editorLogin:" + Constants.LOGIN_REGEX + "}") @PreAuthorize("hasRole('INSTRUCTOR')") public ResponseEntity<Void> addEditorToCourse(@PathVariable Long courseId, @PathVariable String editorLogin) { log.debug("REST request to add {} as editors to course : {}", editorLogin, courseId); Course course = courseRepository.findByIdElseThrow(courseId); // Courses that have been created before Artemis version 4.11.9 do not have an editor group. // The editor group would be need to be set manually by instructors for the course and manually added to Jira. // To increase the usability the group is automatically generated when a user is added. if (!StringUtils.hasText(course.getEditorGroupName())) { try { course.setEditorGroupName(course.getDefaultEditorGroupName()); if (!artemisAuthenticationProvider.isGroupAvailable(course.getDefaultEditorGroupName())) { artemisAuthenticationProvider.createGroup(course.getDefaultEditorGroupName()); } } catch (GroupAlreadyExistsException ex) { throw new BadRequestAlertException( ex.getMessage() + ": One of the groups already exists (in the external user management), because the short name was already used in Artemis before. " + "Please choose a different short name!", ENTITY_NAME, "shortNameWasAlreadyUsed", true); } catch (ArtemisAuthenticationException ex) { // a specified group does not exist, notify the client throw new BadRequestAlertException(ex.getMessage(), ENTITY_NAME, "groupNotFound", true); } courseRepository.save(course); } return addUserToCourseGroup(editorLogin, userRepository.getUserWithGroupsAndAuthorities(), course, course.getEditorGroupName(), Role.EDITOR); }
/** * Post /courses/:courseId/editors/:editorLogin : Add the given user to the editors of the course so that the student can access the course administration * * @param courseId the id of the course * @param editorLogin the login of the user who should get editor access * @return empty ResponseEntity with status 200 (OK) or with status 404 (Not Found) */
Post /courses/:courseId/editors/:editorLogin : Add the given user to the editors of the course so that the student can access the course administration @param courseId the id of the course @param editorLogin the login of the user who should get editor access @return empty ResponseEntity with status 200 (OK) or with status 404 (Not Found)
[ "Post", "/", "courses", "/", ":", "courseId", "/", "editors", "/", ":", "editorLogin", ":", "Add", "the", "given", "user", "to", "the", "editors", "of", "the", "course", "so", "that", "the", "student", "can", "access", "the", "course", "administration", "@param", "courseId", "the", "id", "of", "the", "course", "@param", "editorLogin", "the", "login", "of", "the", "user", "who", "should", "get", "editor", "access", "@return", "empty", "ResponseEntity", "with", "status", "200", "(", "OK", ")", "or", "with", "status", "404", "(", "Not", "Found", ")" ]
@PostMapping(value = "/courses/{courseId}/editors/{editorLogin:" + Constants.LOGIN_REGEX + "}") @PreAuthorize("hasRole('INSTRUCTOR')") public ResponseEntity<Void> addEditorToCourse(@PathVariable Long courseId, @PathVariable String editorLogin) { log.debug("REST request to add {} as editors to course : {}", editorLogin, courseId); Course course = courseRepository.findByIdElseThrow(courseId); if (!StringUtils.hasText(course.getEditorGroupName())) { try { course.setEditorGroupName(course.getDefaultEditorGroupName()); if (!artemisAuthenticationProvider.isGroupAvailable(course.getDefaultEditorGroupName())) { artemisAuthenticationProvider.createGroup(course.getDefaultEditorGroupName()); } } catch (GroupAlreadyExistsException ex) { throw new BadRequestAlertException( ex.getMessage() + ": One of the groups already exists (in the external user management), because the short name was already used in Artemis before. " + "Please choose a different short name!", ENTITY_NAME, "shortNameWasAlreadyUsed", true); } catch (ArtemisAuthenticationException ex) { throw new BadRequestAlertException(ex.getMessage(), ENTITY_NAME, "groupNotFound", true); } courseRepository.save(course); } return addUserToCourseGroup(editorLogin, userRepository.getUserWithGroupsAndAuthorities(), course, course.getEditorGroupName(), Role.EDITOR); }
[ "@", "PostMapping", "(", "value", "=", "\"/courses/{courseId}/editors/{editorLogin:\"", "+", "Constants", ".", "LOGIN_REGEX", "+", "\"}\"", ")", "@", "PreAuthorize", "(", "\"hasRole('INSTRUCTOR')\"", ")", "public", "ResponseEntity", "<", "Void", ">", "addEditorToCourse", "(", "@", "PathVariable", "Long", "courseId", ",", "@", "PathVariable", "String", "editorLogin", ")", "{", "log", ".", "debug", "(", "\"REST request to add {} as editors to course : {}\"", ",", "editorLogin", ",", "courseId", ")", ";", "Course", "course", "=", "courseRepository", ".", "findByIdElseThrow", "(", "courseId", ")", ";", "if", "(", "!", "StringUtils", ".", "hasText", "(", "course", ".", "getEditorGroupName", "(", ")", ")", ")", "{", "try", "{", "course", ".", "setEditorGroupName", "(", "course", ".", "getDefaultEditorGroupName", "(", ")", ")", ";", "if", "(", "!", "artemisAuthenticationProvider", ".", "isGroupAvailable", "(", "course", ".", "getDefaultEditorGroupName", "(", ")", ")", ")", "{", "artemisAuthenticationProvider", ".", "createGroup", "(", "course", ".", "getDefaultEditorGroupName", "(", ")", ")", ";", "}", "}", "catch", "(", "GroupAlreadyExistsException", "ex", ")", "{", "throw", "new", "BadRequestAlertException", "(", "ex", ".", "getMessage", "(", ")", "+", "\": One of the groups already exists (in the external user management), because the short name was already used in Artemis before. \"", "+", "\"Please choose a different short name!\"", ",", "ENTITY_NAME", ",", "\"shortNameWasAlreadyUsed\"", ",", "true", ")", ";", "}", "catch", "(", "ArtemisAuthenticationException", "ex", ")", "{", "throw", "new", "BadRequestAlertException", "(", "ex", ".", "getMessage", "(", ")", ",", "ENTITY_NAME", ",", "\"groupNotFound\"", ",", "true", ")", ";", "}", "courseRepository", ".", "save", "(", "course", ")", ";", "}", "return", "addUserToCourseGroup", "(", "editorLogin", ",", "userRepository", ".", "getUserWithGroupsAndAuthorities", "(", ")", ",", "course", ",", "course", ".", "getEditorGroupName", "(", ")", ",", "Role", ".", "EDITOR", ")", ";", "}" ]
Post /courses/:courseId/editors/:editorLogin : Add the given user to the editors of the course so that the student can access the course administration @param courseId the id of the course @param editorLogin the login of the user who should get editor access @return empty ResponseEntity with status 200 (OK) or with status 404 (Not Found)
[ "Post", "/", "courses", "/", ":", "courseId", "/", "editors", "/", ":", "editorLogin", ":", "Add", "the", "given", "user", "to", "the", "editors", "of", "the", "course", "so", "that", "the", "student", "can", "access", "the", "course", "administration", "@param", "courseId", "the", "id", "of", "the", "course", "@param", "editorLogin", "the", "login", "of", "the", "user", "who", "should", "get", "editor", "access", "@return", "empty", "ResponseEntity", "with", "status", "200", "(", "OK", ")", "or", "with", "status", "404", "(", "Not", "Found", ")" ]
[ "// Courses that have been created before Artemis version 4.11.9 do not have an editor group.", "// The editor group would be need to be set manually by instructors for the course and manually added to Jira.", "// To increase the usability the group is automatically generated when a user is added.", "// a specified group does not exist, notify the client" ]
[ { "param": "courseId", "type": "Long" }, { "param": "editorLogin", "type": "String" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "courseId", "type": "Long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "editorLogin", "type": "String", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 3349, 3233, 12, 1132, 273, 2206, 15804, 4938, 5566, 548, 4004, 4619, 1383, 4938, 9177, 5358, 2773, 397, 5245, 18, 19022, 67, 12472, 397, 11883, 13, 203, 565, 632, 1386, 18987, 2932, 5332, 2996, 2668, 706, 13915, 916, 23291, 13, 203, 565, 1071, 2306, 1943, 32, 19038, 34, 527, 6946, 774, 39, 3117, 26964, 743, 3092, 3407, 4362, 548, 16, 632, 743, 3092, 514, 4858, 5358, 13, 288, 203, 3639, 613, 18, 4148, 2932, 12030, 590, 358, 527, 2618, 487, 29431, 358, 4362, 294, 3728, 16, 4858, 5358, 16, 4362, 548, 1769, 203, 3639, 385, 3117, 4362, 273, 4362, 3305, 18, 4720, 5132, 12427, 8282, 12, 5566, 548, 1769, 203, 203, 3639, 368, 385, 10692, 716, 1240, 2118, 2522, 1865, 1201, 874, 291, 1177, 1059, 18, 2499, 18, 29, 741, 486, 1240, 392, 4858, 1041, 18, 203, 3639, 368, 1021, 4858, 1041, 4102, 506, 1608, 358, 506, 444, 10036, 635, 316, 1697, 1383, 364, 326, 4362, 471, 10036, 3096, 358, 804, 11547, 18, 203, 3639, 368, 2974, 10929, 326, 584, 2967, 326, 1041, 353, 6635, 4374, 1347, 279, 729, 353, 3096, 18, 203, 3639, 309, 16051, 780, 1989, 18, 5332, 1528, 12, 5566, 18, 588, 6946, 3943, 1435, 3719, 288, 203, 5411, 775, 288, 203, 7734, 4362, 18, 542, 6946, 3943, 12, 5566, 18, 588, 1868, 6946, 3943, 10663, 203, 7734, 309, 16051, 485, 351, 291, 6492, 2249, 18, 291, 1114, 5268, 12, 5566, 18, 588, 1868, 6946, 3943, 1435, 3719, 288, 203, 10792, 419, 874, 291, 6492, 2249, 18, 2640, 1114, 12, 5566, 18, 588, 1868, 6946, 3943, 10663, 203, 7734, 289, 203, 5411, 289, 203, 5411, 1044, 261, 1114, 26853, 431, 13, 288, 203, 7734, 604, 394, 23223, 13298, 503, 12, 203, 13491, 431, 18, 24906, 1435, 397, 6398, 6942, 434, 326, 3252, 1818, 1704, 261, 267, 326, 3903, 729, 11803, 3631, 2724, 326, 3025, 508, 1703, 1818, 1399, 316, 1201, 874, 291, 1865, 18, 315, 203, 27573, 397, 315, 8496, 9876, 279, 3775, 3025, 508, 5, 3113, 203, 13491, 17020, 67, 1985, 16, 315, 6620, 461, 14992, 9430, 6668, 3113, 638, 1769, 203, 5411, 289, 203, 5411, 1044, 261, 686, 874, 291, 6492, 503, 431, 13, 288, 203, 7734, 368, 279, 1269, 1041, 1552, 486, 1005, 16, 5066, 326, 1004, 203, 7734, 604, 394, 23223, 13298, 503, 12, 338, 18, 24906, 9334, 17020, 67, 1985, 16, 315, 1655, 2768, 3113, 638, 1769, 203, 5411, 289, 203, 5411, 4362, 3305, 18, 5688, 12, 5566, 1769, 203, 3639, 289, 203, 203, 3639, 327, 527, 1299, 774, 39, 3117, 1114, 12, 9177, 5358, 16, 729, 3305, 18, 588, 1299, 1190, 3621, 1876, 3594, 1961, 9334, 4362, 16, 4362, 18, 588, 6946, 3943, 9334, 6204, 18, 13208, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ 1, 26873, 203, 377, 380, 5616, 342, 15804, 16880, 5566, 548, 19, 4619, 1383, 16880, 9177, 5358, 294, 1436, 326, 864, 729, 358, 326, 29431, 434, 326, 4362, 1427, 716, 326, 18110, 848, 2006, 326, 4362, 3981, 4218, 203, 377, 380, 203, 377, 380, 632, 891, 4362, 548, 282, 326, 612, 434, 326, 4362, 203, 377, 380, 632, 891, 4858, 5358, 326, 3925, 434, 326, 729, 10354, 1410, 336, 4858, 2006, 203, 377, 380, 632, 2463, 1008, 2306, 1943, 598, 1267, 4044, 261, 3141, 13, 578, 598, 1267, 7709, 261, 1248, 10750, 13, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
2a9da177c1b6bf418b8f10f10e06e9b9d1dcc138
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/web/rest/CourseResource.java
[ "MIT" ]
Java
addInstructorToCourse
null
@PostMapping(value = "/courses/{courseId}/instructors/{instructorLogin:" + Constants.LOGIN_REGEX + "}") @PreAuthorize("hasRole('INSTRUCTOR')") public ResponseEntity<Void> addInstructorToCourse(@PathVariable Long courseId, @PathVariable String instructorLogin) { log.debug("REST request to add {} as instructors to course : {}", instructorLogin, courseId); var course = courseRepository.findByIdElseThrow(courseId); return addUserToCourseGroup(instructorLogin, userRepository.getUserWithGroupsAndAuthorities(), course, course.getInstructorGroupName(), Role.INSTRUCTOR); }
/** * Post /courses/:courseId/instructors/:instructorLogin : Add the given user to the instructors of the course so that the student can access the course administration * * @param courseId the id of the course * @param instructorLogin the login of the user who should get instructors access * @return empty ResponseEntity with status 200 (OK) or with status 404 (Not Found) */
Post /courses/:courseId/instructors/:instructorLogin : Add the given user to the instructors of the course so that the student can access the course administration @param courseId the id of the course @param instructorLogin the login of the user who should get instructors access @return empty ResponseEntity with status 200 (OK) or with status 404 (Not Found)
[ "Post", "/", "courses", "/", ":", "courseId", "/", "instructors", "/", ":", "instructorLogin", ":", "Add", "the", "given", "user", "to", "the", "instructors", "of", "the", "course", "so", "that", "the", "student", "can", "access", "the", "course", "administration", "@param", "courseId", "the", "id", "of", "the", "course", "@param", "instructorLogin", "the", "login", "of", "the", "user", "who", "should", "get", "instructors", "access", "@return", "empty", "ResponseEntity", "with", "status", "200", "(", "OK", ")", "or", "with", "status", "404", "(", "Not", "Found", ")" ]
@PostMapping(value = "/courses/{courseId}/instructors/{instructorLogin:" + Constants.LOGIN_REGEX + "}") @PreAuthorize("hasRole('INSTRUCTOR')") public ResponseEntity<Void> addInstructorToCourse(@PathVariable Long courseId, @PathVariable String instructorLogin) { log.debug("REST request to add {} as instructors to course : {}", instructorLogin, courseId); var course = courseRepository.findByIdElseThrow(courseId); return addUserToCourseGroup(instructorLogin, userRepository.getUserWithGroupsAndAuthorities(), course, course.getInstructorGroupName(), Role.INSTRUCTOR); }
[ "@", "PostMapping", "(", "value", "=", "\"/courses/{courseId}/instructors/{instructorLogin:\"", "+", "Constants", ".", "LOGIN_REGEX", "+", "\"}\"", ")", "@", "PreAuthorize", "(", "\"hasRole('INSTRUCTOR')\"", ")", "public", "ResponseEntity", "<", "Void", ">", "addInstructorToCourse", "(", "@", "PathVariable", "Long", "courseId", ",", "@", "PathVariable", "String", "instructorLogin", ")", "{", "log", ".", "debug", "(", "\"REST request to add {} as instructors to course : {}\"", ",", "instructorLogin", ",", "courseId", ")", ";", "var", "course", "=", "courseRepository", ".", "findByIdElseThrow", "(", "courseId", ")", ";", "return", "addUserToCourseGroup", "(", "instructorLogin", ",", "userRepository", ".", "getUserWithGroupsAndAuthorities", "(", ")", ",", "course", ",", "course", ".", "getInstructorGroupName", "(", ")", ",", "Role", ".", "INSTRUCTOR", ")", ";", "}" ]
Post /courses/:courseId/instructors/:instructorLogin : Add the given user to the instructors of the course so that the student can access the course administration @param courseId the id of the course @param instructorLogin the login of the user who should get instructors access @return empty ResponseEntity with status 200 (OK) or with status 404 (Not Found)
[ "Post", "/", "courses", "/", ":", "courseId", "/", "instructors", "/", ":", "instructorLogin", ":", "Add", "the", "given", "user", "to", "the", "instructors", "of", "the", "course", "so", "that", "the", "student", "can", "access", "the", "course", "administration", "@param", "courseId", "the", "id", "of", "the", "course", "@param", "instructorLogin", "the", "login", "of", "the", "user", "who", "should", "get", "instructors", "access", "@return", "empty", "ResponseEntity", "with", "status", "200", "(", "OK", ")", "or", "with", "status", "404", "(", "Not", "Found", ")" ]
[]
[ { "param": "courseId", "type": "Long" }, { "param": "instructorLogin", "type": "String" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "courseId", "type": "Long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "instructorLogin", "type": "String", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 3349, 3233, 12, 1132, 273, 2206, 15804, 4938, 5566, 548, 4004, 267, 1697, 1383, 4938, 267, 2732, 5358, 2773, 397, 5245, 18, 19022, 67, 12472, 397, 11883, 13, 203, 565, 632, 1386, 18987, 2932, 5332, 2996, 2668, 706, 13915, 916, 23291, 13, 203, 565, 1071, 2306, 1943, 32, 19038, 34, 527, 382, 2732, 774, 39, 3117, 26964, 743, 3092, 3407, 4362, 548, 16, 632, 743, 3092, 514, 316, 2732, 5358, 13, 288, 203, 3639, 613, 18, 4148, 2932, 12030, 590, 358, 527, 2618, 487, 316, 1697, 1383, 358, 4362, 294, 3728, 16, 316, 2732, 5358, 16, 4362, 548, 1769, 203, 3639, 569, 4362, 273, 4362, 3305, 18, 4720, 5132, 12427, 8282, 12, 5566, 548, 1769, 203, 3639, 327, 527, 1299, 774, 39, 3117, 1114, 12, 267, 2732, 5358, 16, 729, 3305, 18, 588, 1299, 1190, 3621, 1876, 3594, 1961, 9334, 4362, 16, 4362, 18, 588, 382, 2732, 3943, 9334, 6204, 18, 706, 13915, 916, 1769, 203, 565, 289, 2, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 5616, 342, 15804, 16880, 5566, 548, 19, 267, 1697, 1383, 16880, 267, 2732, 5358, 294, 1436, 326, 864, 729, 358, 326, 316, 1697, 1383, 434, 326, 4362, 1427, 716, 326, 18110, 848, 2006, 326, 4362, 3981, 4218, 203, 377, 380, 203, 377, 380, 632, 891, 4362, 548, 3639, 326, 612, 434, 326, 4362, 203, 377, 380, 632, 891, 316, 2732, 5358, 326, 3925, 434, 326, 729, 10354, 1410, 336, 316, 1697, 1383, 2006, 203, 377, 380, 632, 2463, 1008, 2306, 1943, 598, 1267, 4044, 261, 3141, 13, 578, 598, 1267, 7709, 261, 1248, 10750, 13, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
2a9da177c1b6bf418b8f10f10e06e9b9d1dcc138
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/web/rest/CourseResource.java
[ "MIT" ]
Java
removeStudentFromCourse
null
@DeleteMapping(value = "/courses/{courseId}/students/{studentLogin:" + Constants.LOGIN_REGEX + "}") @PreAuthorize("hasRole('INSTRUCTOR')") public ResponseEntity<Void> removeStudentFromCourse(@PathVariable Long courseId, @PathVariable String studentLogin) { log.debug("REST request to remove {} as student from course : {}", studentLogin, courseId); var course = courseRepository.findByIdElseThrow(courseId); return removeUserFromCourseGroup(studentLogin, userRepository.getUserWithGroupsAndAuthorities(), course, course.getStudentGroupName(), Role.STUDENT); }
/** * DELETE /courses/:courseId/students/:studentLogin : Remove the given user from the students of the course so that the student cannot access the course any more * * @param courseId the id of the course * @param studentLogin the login of the user who should lose student access * @return empty ResponseEntity with status 200 (OK) or with status 404 (Not Found) */
DELETE /courses/:courseId/students/:studentLogin : Remove the given user from the students of the course so that the student cannot access the course any more @param courseId the id of the course @param studentLogin the login of the user who should lose student access @return empty ResponseEntity with status 200 (OK) or with status 404 (Not Found)
[ "DELETE", "/", "courses", "/", ":", "courseId", "/", "students", "/", ":", "studentLogin", ":", "Remove", "the", "given", "user", "from", "the", "students", "of", "the", "course", "so", "that", "the", "student", "cannot", "access", "the", "course", "any", "more", "@param", "courseId", "the", "id", "of", "the", "course", "@param", "studentLogin", "the", "login", "of", "the", "user", "who", "should", "lose", "student", "access", "@return", "empty", "ResponseEntity", "with", "status", "200", "(", "OK", ")", "or", "with", "status", "404", "(", "Not", "Found", ")" ]
@DeleteMapping(value = "/courses/{courseId}/students/{studentLogin:" + Constants.LOGIN_REGEX + "}") @PreAuthorize("hasRole('INSTRUCTOR')") public ResponseEntity<Void> removeStudentFromCourse(@PathVariable Long courseId, @PathVariable String studentLogin) { log.debug("REST request to remove {} as student from course : {}", studentLogin, courseId); var course = courseRepository.findByIdElseThrow(courseId); return removeUserFromCourseGroup(studentLogin, userRepository.getUserWithGroupsAndAuthorities(), course, course.getStudentGroupName(), Role.STUDENT); }
[ "@", "DeleteMapping", "(", "value", "=", "\"/courses/{courseId}/students/{studentLogin:\"", "+", "Constants", ".", "LOGIN_REGEX", "+", "\"}\"", ")", "@", "PreAuthorize", "(", "\"hasRole('INSTRUCTOR')\"", ")", "public", "ResponseEntity", "<", "Void", ">", "removeStudentFromCourse", "(", "@", "PathVariable", "Long", "courseId", ",", "@", "PathVariable", "String", "studentLogin", ")", "{", "log", ".", "debug", "(", "\"REST request to remove {} as student from course : {}\"", ",", "studentLogin", ",", "courseId", ")", ";", "var", "course", "=", "courseRepository", ".", "findByIdElseThrow", "(", "courseId", ")", ";", "return", "removeUserFromCourseGroup", "(", "studentLogin", ",", "userRepository", ".", "getUserWithGroupsAndAuthorities", "(", ")", ",", "course", ",", "course", ".", "getStudentGroupName", "(", ")", ",", "Role", ".", "STUDENT", ")", ";", "}" ]
DELETE /courses/:courseId/students/:studentLogin : Remove the given user from the students of the course so that the student cannot access the course any more @param courseId the id of the course @param studentLogin the login of the user who should lose student access @return empty ResponseEntity with status 200 (OK) or with status 404 (Not Found)
[ "DELETE", "/", "courses", "/", ":", "courseId", "/", "students", "/", ":", "studentLogin", ":", "Remove", "the", "given", "user", "from", "the", "students", "of", "the", "course", "so", "that", "the", "student", "cannot", "access", "the", "course", "any", "more", "@param", "courseId", "the", "id", "of", "the", "course", "@param", "studentLogin", "the", "login", "of", "the", "user", "who", "should", "lose", "student", "access", "@return", "empty", "ResponseEntity", "with", "status", "200", "(", "OK", ")", "or", "with", "status", "404", "(", "Not", "Found", ")" ]
[]
[ { "param": "courseId", "type": "Long" }, { "param": "studentLogin", "type": "String" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "courseId", "type": "Long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "studentLogin", "type": "String", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 2613, 3233, 12, 1132, 273, 2206, 15804, 4938, 5566, 548, 4004, 16120, 4877, 4938, 26240, 5358, 2773, 397, 5245, 18, 19022, 67, 12472, 397, 11883, 13, 203, 565, 632, 1386, 18987, 2932, 5332, 2996, 2668, 706, 13915, 916, 23291, 13, 203, 565, 1071, 2306, 1943, 32, 19038, 34, 1206, 19943, 319, 1265, 39, 3117, 26964, 743, 3092, 3407, 4362, 548, 16, 632, 743, 3092, 514, 18110, 5358, 13, 288, 203, 3639, 613, 18, 4148, 2932, 12030, 590, 358, 1206, 2618, 487, 18110, 628, 4362, 294, 3728, 16, 18110, 5358, 16, 4362, 548, 1769, 203, 3639, 569, 4362, 273, 4362, 3305, 18, 4720, 5132, 12427, 8282, 12, 5566, 548, 1769, 203, 3639, 327, 1206, 1299, 1265, 39, 3117, 1114, 12, 26240, 5358, 16, 729, 3305, 18, 588, 1299, 1190, 3621, 1876, 3594, 1961, 9334, 4362, 16, 4362, 18, 588, 19943, 319, 3943, 9334, 6204, 18, 882, 12587, 2222, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 8568, 342, 15804, 16880, 5566, 548, 19, 16120, 4877, 16880, 26240, 5358, 294, 3581, 326, 864, 729, 628, 326, 10068, 4877, 434, 326, 4362, 1427, 716, 326, 18110, 2780, 2006, 326, 4362, 1281, 1898, 203, 377, 380, 203, 377, 380, 632, 891, 4362, 548, 377, 326, 612, 434, 326, 4362, 203, 377, 380, 632, 891, 18110, 5358, 326, 3925, 434, 326, 729, 10354, 1410, 29612, 18110, 2006, 203, 377, 380, 632, 2463, 1008, 2306, 1943, 598, 1267, 4044, 261, 3141, 13, 578, 598, 1267, 7709, 261, 1248, 10750, 13, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
2a9da177c1b6bf418b8f10f10e06e9b9d1dcc138
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/web/rest/CourseResource.java
[ "MIT" ]
Java
removeTutorFromCourse
null
@DeleteMapping(value = "/courses/{courseId}/tutors/{tutorLogin:" + Constants.LOGIN_REGEX + "}") @PreAuthorize("hasRole('INSTRUCTOR')") public ResponseEntity<Void> removeTutorFromCourse(@PathVariable Long courseId, @PathVariable String tutorLogin) { log.debug("REST request to remove {} as tutor from course : {}", tutorLogin, courseId); var course = courseRepository.findByIdElseThrow(courseId); return removeUserFromCourseGroup(tutorLogin, userRepository.getUserWithGroupsAndAuthorities(), course, course.getTeachingAssistantGroupName(), Role.TEACHING_ASSISTANT); }
/** * DELETE /courses/:courseId/tutors/:tutorsLogin : Remove the given user from the tutors of the course so that the tutors cannot access the course administration any more * * @param courseId the id of the course * @param tutorLogin the login of the user who should lose student access * @return empty ResponseEntity with status 200 (OK) or with status 404 (Not Found) */
DELETE /courses/:courseId/tutors/:tutorsLogin : Remove the given user from the tutors of the course so that the tutors cannot access the course administration any more @param courseId the id of the course @param tutorLogin the login of the user who should lose student access @return empty ResponseEntity with status 200 (OK) or with status 404 (Not Found)
[ "DELETE", "/", "courses", "/", ":", "courseId", "/", "tutors", "/", ":", "tutorsLogin", ":", "Remove", "the", "given", "user", "from", "the", "tutors", "of", "the", "course", "so", "that", "the", "tutors", "cannot", "access", "the", "course", "administration", "any", "more", "@param", "courseId", "the", "id", "of", "the", "course", "@param", "tutorLogin", "the", "login", "of", "the", "user", "who", "should", "lose", "student", "access", "@return", "empty", "ResponseEntity", "with", "status", "200", "(", "OK", ")", "or", "with", "status", "404", "(", "Not", "Found", ")" ]
@DeleteMapping(value = "/courses/{courseId}/tutors/{tutorLogin:" + Constants.LOGIN_REGEX + "}") @PreAuthorize("hasRole('INSTRUCTOR')") public ResponseEntity<Void> removeTutorFromCourse(@PathVariable Long courseId, @PathVariable String tutorLogin) { log.debug("REST request to remove {} as tutor from course : {}", tutorLogin, courseId); var course = courseRepository.findByIdElseThrow(courseId); return removeUserFromCourseGroup(tutorLogin, userRepository.getUserWithGroupsAndAuthorities(), course, course.getTeachingAssistantGroupName(), Role.TEACHING_ASSISTANT); }
[ "@", "DeleteMapping", "(", "value", "=", "\"/courses/{courseId}/tutors/{tutorLogin:\"", "+", "Constants", ".", "LOGIN_REGEX", "+", "\"}\"", ")", "@", "PreAuthorize", "(", "\"hasRole('INSTRUCTOR')\"", ")", "public", "ResponseEntity", "<", "Void", ">", "removeTutorFromCourse", "(", "@", "PathVariable", "Long", "courseId", ",", "@", "PathVariable", "String", "tutorLogin", ")", "{", "log", ".", "debug", "(", "\"REST request to remove {} as tutor from course : {}\"", ",", "tutorLogin", ",", "courseId", ")", ";", "var", "course", "=", "courseRepository", ".", "findByIdElseThrow", "(", "courseId", ")", ";", "return", "removeUserFromCourseGroup", "(", "tutorLogin", ",", "userRepository", ".", "getUserWithGroupsAndAuthorities", "(", ")", ",", "course", ",", "course", ".", "getTeachingAssistantGroupName", "(", ")", ",", "Role", ".", "TEACHING_ASSISTANT", ")", ";", "}" ]
DELETE /courses/:courseId/tutors/:tutorsLogin : Remove the given user from the tutors of the course so that the tutors cannot access the course administration any more @param courseId the id of the course @param tutorLogin the login of the user who should lose student access @return empty ResponseEntity with status 200 (OK) or with status 404 (Not Found)
[ "DELETE", "/", "courses", "/", ":", "courseId", "/", "tutors", "/", ":", "tutorsLogin", ":", "Remove", "the", "given", "user", "from", "the", "tutors", "of", "the", "course", "so", "that", "the", "tutors", "cannot", "access", "the", "course", "administration", "any", "more", "@param", "courseId", "the", "id", "of", "the", "course", "@param", "tutorLogin", "the", "login", "of", "the", "user", "who", "should", "lose", "student", "access", "@return", "empty", "ResponseEntity", "with", "status", "200", "(", "OK", ")", "or", "with", "status", "404", "(", "Not", "Found", ")" ]
[]
[ { "param": "courseId", "type": "Long" }, { "param": "tutorLogin", "type": "String" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "courseId", "type": "Long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "tutorLogin", "type": "String", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 2613, 3233, 12, 1132, 273, 2206, 15804, 4938, 5566, 548, 4004, 88, 13595, 4938, 88, 3408, 5358, 2773, 397, 5245, 18, 19022, 67, 12472, 397, 11883, 13, 203, 565, 632, 1386, 18987, 2932, 5332, 2996, 2668, 706, 13915, 916, 23291, 13, 203, 565, 1071, 2306, 1943, 32, 19038, 34, 1206, 56, 3408, 1265, 39, 3117, 26964, 743, 3092, 3407, 4362, 548, 16, 632, 743, 3092, 514, 268, 3408, 5358, 13, 288, 203, 3639, 613, 18, 4148, 2932, 12030, 590, 358, 1206, 2618, 487, 268, 3408, 628, 4362, 294, 3728, 16, 268, 3408, 5358, 16, 4362, 548, 1769, 203, 3639, 569, 4362, 273, 4362, 3305, 18, 4720, 5132, 12427, 8282, 12, 5566, 548, 1769, 203, 3639, 327, 1206, 1299, 1265, 39, 3117, 1114, 12, 88, 3408, 5358,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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 8568, 342, 15804, 16880, 5566, 548, 19, 88, 13595, 16880, 88, 13595, 5358, 294, 3581, 326, 864, 729, 628, 326, 268, 13595, 434, 326, 4362, 1427, 716, 326, 268, 13595, 2780, 2006, 326, 4362, 3981, 4218, 1281, 1898, 203, 377, 380, 203, 377, 380, 632, 891, 4362, 548, 282, 326, 612, 434, 326, 4362, 203, 377, 380, 632, 891, 268, 3408, 5358, 326, 3925, 434, 326, 729, 10354, 1410, 29612, 18110, 2006, 203, 377, 380, 632, 2463, 1008, 2306, 1943, 598, 1267, 4044, 261, 3141, 13, 578, 598, 1267, 7709, 261, 1248, 10750, 13, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
2a9da177c1b6bf418b8f10f10e06e9b9d1dcc138
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/web/rest/CourseResource.java
[ "MIT" ]
Java
removeEditorFromCourse
null
@DeleteMapping(value = "/courses/{courseId}/editors/{editorLogin:" + Constants.LOGIN_REGEX + "}") @PreAuthorize("hasRole('INSTRUCTOR')") public ResponseEntity<Void> removeEditorFromCourse(@PathVariable Long courseId, @PathVariable String editorLogin) { log.debug("REST request to remove {} as editor from course : {}", editorLogin, courseId); var course = courseRepository.findByIdElseThrow(courseId); return removeUserFromCourseGroup(editorLogin, userRepository.getUserWithGroupsAndAuthorities(), course, course.getEditorGroupName(), Role.EDITOR); }
/** * DELETE /courses/:courseId/editors/:editorsLogin : Remove the given user from the editors of the course so that the editors cannot access the course administration any more * * @param courseId the id of the course * @param editorLogin the login of the user who should lose student access * @return empty ResponseEntity with status 200 (OK) or with status 404 (Not Found) */
DELETE /courses/:courseId/editors/:editorsLogin : Remove the given user from the editors of the course so that the editors cannot access the course administration any more @param courseId the id of the course @param editorLogin the login of the user who should lose student access @return empty ResponseEntity with status 200 (OK) or with status 404 (Not Found)
[ "DELETE", "/", "courses", "/", ":", "courseId", "/", "editors", "/", ":", "editorsLogin", ":", "Remove", "the", "given", "user", "from", "the", "editors", "of", "the", "course", "so", "that", "the", "editors", "cannot", "access", "the", "course", "administration", "any", "more", "@param", "courseId", "the", "id", "of", "the", "course", "@param", "editorLogin", "the", "login", "of", "the", "user", "who", "should", "lose", "student", "access", "@return", "empty", "ResponseEntity", "with", "status", "200", "(", "OK", ")", "or", "with", "status", "404", "(", "Not", "Found", ")" ]
@DeleteMapping(value = "/courses/{courseId}/editors/{editorLogin:" + Constants.LOGIN_REGEX + "}") @PreAuthorize("hasRole('INSTRUCTOR')") public ResponseEntity<Void> removeEditorFromCourse(@PathVariable Long courseId, @PathVariable String editorLogin) { log.debug("REST request to remove {} as editor from course : {}", editorLogin, courseId); var course = courseRepository.findByIdElseThrow(courseId); return removeUserFromCourseGroup(editorLogin, userRepository.getUserWithGroupsAndAuthorities(), course, course.getEditorGroupName(), Role.EDITOR); }
[ "@", "DeleteMapping", "(", "value", "=", "\"/courses/{courseId}/editors/{editorLogin:\"", "+", "Constants", ".", "LOGIN_REGEX", "+", "\"}\"", ")", "@", "PreAuthorize", "(", "\"hasRole('INSTRUCTOR')\"", ")", "public", "ResponseEntity", "<", "Void", ">", "removeEditorFromCourse", "(", "@", "PathVariable", "Long", "courseId", ",", "@", "PathVariable", "String", "editorLogin", ")", "{", "log", ".", "debug", "(", "\"REST request to remove {} as editor from course : {}\"", ",", "editorLogin", ",", "courseId", ")", ";", "var", "course", "=", "courseRepository", ".", "findByIdElseThrow", "(", "courseId", ")", ";", "return", "removeUserFromCourseGroup", "(", "editorLogin", ",", "userRepository", ".", "getUserWithGroupsAndAuthorities", "(", ")", ",", "course", ",", "course", ".", "getEditorGroupName", "(", ")", ",", "Role", ".", "EDITOR", ")", ";", "}" ]
DELETE /courses/:courseId/editors/:editorsLogin : Remove the given user from the editors of the course so that the editors cannot access the course administration any more @param courseId the id of the course @param editorLogin the login of the user who should lose student access @return empty ResponseEntity with status 200 (OK) or with status 404 (Not Found)
[ "DELETE", "/", "courses", "/", ":", "courseId", "/", "editors", "/", ":", "editorsLogin", ":", "Remove", "the", "given", "user", "from", "the", "editors", "of", "the", "course", "so", "that", "the", "editors", "cannot", "access", "the", "course", "administration", "any", "more", "@param", "courseId", "the", "id", "of", "the", "course", "@param", "editorLogin", "the", "login", "of", "the", "user", "who", "should", "lose", "student", "access", "@return", "empty", "ResponseEntity", "with", "status", "200", "(", "OK", ")", "or", "with", "status", "404", "(", "Not", "Found", ")" ]
[]
[ { "param": "courseId", "type": "Long" }, { "param": "editorLogin", "type": "String" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "courseId", "type": "Long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "editorLogin", "type": "String", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 2613, 3233, 12, 1132, 273, 2206, 15804, 4938, 5566, 548, 4004, 4619, 1383, 4938, 9177, 5358, 2773, 397, 5245, 18, 19022, 67, 12472, 397, 11883, 13, 203, 565, 632, 1386, 18987, 2932, 5332, 2996, 2668, 706, 13915, 916, 23291, 13, 203, 565, 1071, 2306, 1943, 32, 19038, 34, 1206, 6946, 1265, 39, 3117, 26964, 743, 3092, 3407, 4362, 548, 16, 632, 743, 3092, 514, 4858, 5358, 13, 288, 203, 3639, 613, 18, 4148, 2932, 12030, 590, 358, 1206, 2618, 487, 4858, 628, 4362, 294, 3728, 16, 4858, 5358, 16, 4362, 548, 1769, 203, 3639, 569, 4362, 273, 4362, 3305, 18, 4720, 5132, 12427, 8282, 12, 5566, 548, 1769, 203, 3639, 327, 1206, 1299, 1265, 39, 3117, 1114, 12, 9177, 5358, 16, 729, 3305, 18, 588, 1299, 1190, 3621, 1876, 3594, 1961, 9334, 4362, 16, 4362, 18, 588, 6946, 3943, 9334, 6204, 18, 13208, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 8568, 342, 15804, 16880, 5566, 548, 19, 4619, 1383, 16880, 4619, 1383, 5358, 294, 3581, 326, 864, 729, 628, 326, 29431, 434, 326, 4362, 1427, 716, 326, 29431, 2780, 2006, 326, 4362, 3981, 4218, 1281, 1898, 203, 377, 380, 203, 377, 380, 632, 891, 4362, 548, 282, 326, 612, 434, 326, 4362, 203, 377, 380, 632, 891, 4858, 5358, 326, 3925, 434, 326, 729, 10354, 1410, 29612, 18110, 2006, 203, 377, 380, 632, 2463, 1008, 2306, 1943, 598, 1267, 4044, 261, 3141, 13, 578, 598, 1267, 7709, 261, 1248, 10750, 13, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
2a9da177c1b6bf418b8f10f10e06e9b9d1dcc138
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/web/rest/CourseResource.java
[ "MIT" ]
Java
removeInstructorFromCourse
null
@DeleteMapping(value = "/courses/{courseId}/instructors/{instructorLogin:" + Constants.LOGIN_REGEX + "}") @PreAuthorize("hasRole('INSTRUCTOR')") public ResponseEntity<Void> removeInstructorFromCourse(@PathVariable Long courseId, @PathVariable String instructorLogin) { log.debug("REST request to remove {} as instructor from course : {}", instructorLogin, courseId); var course = courseRepository.findByIdElseThrow(courseId); return removeUserFromCourseGroup(instructorLogin, userRepository.getUserWithGroupsAndAuthorities(), course, course.getInstructorGroupName(), Role.INSTRUCTOR); }
/** * DELETE /courses/:courseId/instructors/:instructorLogin : Remove the given user from the instructors of the course so that the instructor cannot access the course administration any more * * @param courseId the id of the course * @param instructorLogin the login of the user who should lose student access * @return empty ResponseEntity with status 200 (OK) or with status 404 (Not Found) */
DELETE /courses/:courseId/instructors/:instructorLogin : Remove the given user from the instructors of the course so that the instructor cannot access the course administration any more @param courseId the id of the course @param instructorLogin the login of the user who should lose student access @return empty ResponseEntity with status 200 (OK) or with status 404 (Not Found)
[ "DELETE", "/", "courses", "/", ":", "courseId", "/", "instructors", "/", ":", "instructorLogin", ":", "Remove", "the", "given", "user", "from", "the", "instructors", "of", "the", "course", "so", "that", "the", "instructor", "cannot", "access", "the", "course", "administration", "any", "more", "@param", "courseId", "the", "id", "of", "the", "course", "@param", "instructorLogin", "the", "login", "of", "the", "user", "who", "should", "lose", "student", "access", "@return", "empty", "ResponseEntity", "with", "status", "200", "(", "OK", ")", "or", "with", "status", "404", "(", "Not", "Found", ")" ]
@DeleteMapping(value = "/courses/{courseId}/instructors/{instructorLogin:" + Constants.LOGIN_REGEX + "}") @PreAuthorize("hasRole('INSTRUCTOR')") public ResponseEntity<Void> removeInstructorFromCourse(@PathVariable Long courseId, @PathVariable String instructorLogin) { log.debug("REST request to remove {} as instructor from course : {}", instructorLogin, courseId); var course = courseRepository.findByIdElseThrow(courseId); return removeUserFromCourseGroup(instructorLogin, userRepository.getUserWithGroupsAndAuthorities(), course, course.getInstructorGroupName(), Role.INSTRUCTOR); }
[ "@", "DeleteMapping", "(", "value", "=", "\"/courses/{courseId}/instructors/{instructorLogin:\"", "+", "Constants", ".", "LOGIN_REGEX", "+", "\"}\"", ")", "@", "PreAuthorize", "(", "\"hasRole('INSTRUCTOR')\"", ")", "public", "ResponseEntity", "<", "Void", ">", "removeInstructorFromCourse", "(", "@", "PathVariable", "Long", "courseId", ",", "@", "PathVariable", "String", "instructorLogin", ")", "{", "log", ".", "debug", "(", "\"REST request to remove {} as instructor from course : {}\"", ",", "instructorLogin", ",", "courseId", ")", ";", "var", "course", "=", "courseRepository", ".", "findByIdElseThrow", "(", "courseId", ")", ";", "return", "removeUserFromCourseGroup", "(", "instructorLogin", ",", "userRepository", ".", "getUserWithGroupsAndAuthorities", "(", ")", ",", "course", ",", "course", ".", "getInstructorGroupName", "(", ")", ",", "Role", ".", "INSTRUCTOR", ")", ";", "}" ]
DELETE /courses/:courseId/instructors/:instructorLogin : Remove the given user from the instructors of the course so that the instructor cannot access the course administration any more @param courseId the id of the course @param instructorLogin the login of the user who should lose student access @return empty ResponseEntity with status 200 (OK) or with status 404 (Not Found)
[ "DELETE", "/", "courses", "/", ":", "courseId", "/", "instructors", "/", ":", "instructorLogin", ":", "Remove", "the", "given", "user", "from", "the", "instructors", "of", "the", "course", "so", "that", "the", "instructor", "cannot", "access", "the", "course", "administration", "any", "more", "@param", "courseId", "the", "id", "of", "the", "course", "@param", "instructorLogin", "the", "login", "of", "the", "user", "who", "should", "lose", "student", "access", "@return", "empty", "ResponseEntity", "with", "status", "200", "(", "OK", ")", "or", "with", "status", "404", "(", "Not", "Found", ")" ]
[]
[ { "param": "courseId", "type": "Long" }, { "param": "instructorLogin", "type": "String" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "courseId", "type": "Long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "instructorLogin", "type": "String", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 2613, 3233, 12, 1132, 273, 2206, 15804, 4938, 5566, 548, 4004, 267, 1697, 1383, 4938, 267, 2732, 5358, 2773, 397, 5245, 18, 19022, 67, 12472, 397, 11883, 13, 203, 565, 632, 1386, 18987, 2932, 5332, 2996, 2668, 706, 13915, 916, 23291, 13, 203, 565, 1071, 2306, 1943, 32, 19038, 34, 1206, 382, 2732, 1265, 39, 3117, 26964, 743, 3092, 3407, 4362, 548, 16, 632, 743, 3092, 514, 316, 2732, 5358, 13, 288, 203, 3639, 613, 18, 4148, 2932, 12030, 590, 358, 1206, 2618, 487, 316, 2732, 628, 4362, 294, 3728, 16, 316, 2732, 5358, 16, 4362, 548, 1769, 203, 3639, 569, 4362, 273, 4362, 3305, 18, 4720, 5132, 12427, 8282, 12, 5566, 548, 1769, 203, 3639, 327, 1206, 1299, 1265, 39, 3117, 1114, 12, 267, 2732, 5358, 16, 729, 3305, 18, 588, 1299, 1190, 3621, 1876, 3594, 1961, 9334, 4362, 16, 4362, 18, 588, 382, 2732, 3943, 9334, 6204, 18, 706, 13915, 916, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 8568, 342, 15804, 16880, 5566, 548, 19, 267, 1697, 1383, 16880, 267, 2732, 5358, 294, 3581, 326, 864, 729, 628, 326, 316, 1697, 1383, 434, 326, 4362, 1427, 716, 326, 316, 2732, 2780, 2006, 326, 4362, 3981, 4218, 1281, 1898, 203, 377, 380, 203, 377, 380, 632, 891, 4362, 548, 3639, 326, 612, 434, 326, 4362, 203, 377, 380, 632, 891, 316, 2732, 5358, 326, 3925, 434, 326, 729, 10354, 1410, 29612, 18110, 2006, 203, 377, 380, 632, 2463, 1008, 2306, 1943, 598, 1267, 4044, 261, 3141, 13, 578, 598, 1267, 7709, 261, 1248, 10750, 13, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
2a9da177c1b6bf418b8f10f10e06e9b9d1dcc138
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/web/rest/CourseResource.java
[ "MIT" ]
Java
checkIfUserIsMemberOfCourseOrganizations
null
private boolean checkIfUserIsMemberOfCourseOrganizations(User user, Course course) { boolean isMember = false; for (Organization organization : courseRepository.findWithEagerOrganizationsElseThrow(course.getId()).getOrganizations()) { if (user.getOrganizations().contains(organization)) { isMember = true; break; } } return isMember; }
/** * Utility method used to check whether a user is member of at least one organization of a given course * @param user the user to check * @param course the course to check * @return true if the user is member of at least one organization of the course. false otherwise */
Utility method used to check whether a user is member of at least one organization of a given course @param user the user to check @param course the course to check @return true if the user is member of at least one organization of the course. false otherwise
[ "Utility", "method", "used", "to", "check", "whether", "a", "user", "is", "member", "of", "at", "least", "one", "organization", "of", "a", "given", "course", "@param", "user", "the", "user", "to", "check", "@param", "course", "the", "course", "to", "check", "@return", "true", "if", "the", "user", "is", "member", "of", "at", "least", "one", "organization", "of", "the", "course", ".", "false", "otherwise" ]
private boolean checkIfUserIsMemberOfCourseOrganizations(User user, Course course) { boolean isMember = false; for (Organization organization : courseRepository.findWithEagerOrganizationsElseThrow(course.getId()).getOrganizations()) { if (user.getOrganizations().contains(organization)) { isMember = true; break; } } return isMember; }
[ "private", "boolean", "checkIfUserIsMemberOfCourseOrganizations", "(", "User", "user", ",", "Course", "course", ")", "{", "boolean", "isMember", "=", "false", ";", "for", "(", "Organization", "organization", ":", "courseRepository", ".", "findWithEagerOrganizationsElseThrow", "(", "course", ".", "getId", "(", ")", ")", ".", "getOrganizations", "(", ")", ")", "{", "if", "(", "user", ".", "getOrganizations", "(", ")", ".", "contains", "(", "organization", ")", ")", "{", "isMember", "=", "true", ";", "break", ";", "}", "}", "return", "isMember", ";", "}" ]
Utility method used to check whether a user is member of at least one organization of a given course @param user the user to check @param course the course to check @return true if the user is member of at least one organization of the course.
[ "Utility", "method", "used", "to", "check", "whether", "a", "user", "is", "member", "of", "at", "least", "one", "organization", "of", "a", "given", "course", "@param", "user", "the", "user", "to", "check", "@param", "course", "the", "course", "to", "check", "@return", "true", "if", "the", "user", "is", "member", "of", "at", "least", "one", "organization", "of", "the", "course", "." ]
[]
[ { "param": "user", "type": "User" }, { "param": "course", "type": "Course" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "user", "type": "User", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "course", "type": "Course", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 3238, 1250, 19130, 1299, 2520, 4419, 951, 39, 3117, 25533, 12, 1299, 729, 16, 385, 3117, 4362, 13, 288, 203, 3639, 1250, 353, 4419, 273, 629, 31, 203, 3639, 364, 261, 8113, 6758, 294, 4362, 3305, 18, 4720, 1190, 41, 6817, 25533, 12427, 8282, 12, 5566, 18, 26321, 1435, 2934, 588, 25533, 10756, 288, 203, 5411, 309, 261, 1355, 18, 588, 25533, 7675, 12298, 12, 15336, 3719, 288, 203, 7734, 353, 4419, 273, 638, 31, 203, 7734, 898, 31, 203, 5411, 289, 203, 3639, 289, 203, 3639, 327, 353, 4419, 31, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 13134, 707, 1399, 358, 866, 2856, 279, 729, 353, 3140, 434, 622, 4520, 1245, 6758, 434, 279, 864, 4362, 203, 377, 380, 632, 891, 729, 326, 729, 358, 866, 203, 377, 380, 632, 891, 4362, 326, 4362, 358, 866, 203, 377, 380, 632, 2463, 638, 309, 326, 729, 353, 3140, 434, 622, 4520, 1245, 6758, 434, 326, 4362, 18, 629, 3541, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
49a09a653897b19f0a553b59d44e00764c8bfb5c
ls1intum/Artemis
src/test/java/de/tum/in/www1/artemis/util/DatabaseUtilService.java
[ "MIT" ]
Java
addCourseWithOneModelingExercise
Course
public Course addCourseWithOneModelingExercise(String title) { long currentCourseRepoSize = courseRepo.count(); long currentExerciseRepoSize = exerciseRepo.count(); Course course = ModelFactory.generateCourse(null, pastTimestamp, futureFutureTimestamp, new HashSet<>(), "tumuser", "tutor", "editor", "instructor"); ModelingExercise modelingExercise = ModelFactory.generateModelingExercise(pastTimestamp, futureTimestamp, futureFutureTimestamp, DiagramType.ClassDiagram, course); modelingExercise.setTitle(title); modelingExercise.setKnowledge(modelAssessmentKnowledgeService.createNewKnowledge()); course.addExercises(modelingExercise); course.setMaxComplaintTimeDays(14); course = courseRepo.save(course); modelingExercise = exerciseRepo.save(modelingExercise); assertThat(exerciseRepo.count()).as("one exercise got stored").isEqualTo(currentExerciseRepoSize + 1L); assertThat(courseRepo.count()).as("a course got stored").isEqualTo(currentCourseRepoSize + 1L); assertThat(course.getExercises()).as("course contains the exercise").containsExactlyInAnyOrder(modelingExercise); assertThat(modelingExercise.getPresentationScoreEnabled()).as("presentation score is enabled").isTrue(); return course; }
/** * @param title The title of the to be added modeling exercise * @return A course with one specified modeling exercise */
@param title The title of the to be added modeling exercise @return A course with one specified modeling exercise
[ "@param", "title", "The", "title", "of", "the", "to", "be", "added", "modeling", "exercise", "@return", "A", "course", "with", "one", "specified", "modeling", "exercise" ]
public Course addCourseWithOneModelingExercise(String title) { long currentCourseRepoSize = courseRepo.count(); long currentExerciseRepoSize = exerciseRepo.count(); Course course = ModelFactory.generateCourse(null, pastTimestamp, futureFutureTimestamp, new HashSet<>(), "tumuser", "tutor", "editor", "instructor"); ModelingExercise modelingExercise = ModelFactory.generateModelingExercise(pastTimestamp, futureTimestamp, futureFutureTimestamp, DiagramType.ClassDiagram, course); modelingExercise.setTitle(title); modelingExercise.setKnowledge(modelAssessmentKnowledgeService.createNewKnowledge()); course.addExercises(modelingExercise); course.setMaxComplaintTimeDays(14); course = courseRepo.save(course); modelingExercise = exerciseRepo.save(modelingExercise); assertThat(exerciseRepo.count()).as("one exercise got stored").isEqualTo(currentExerciseRepoSize + 1L); assertThat(courseRepo.count()).as("a course got stored").isEqualTo(currentCourseRepoSize + 1L); assertThat(course.getExercises()).as("course contains the exercise").containsExactlyInAnyOrder(modelingExercise); assertThat(modelingExercise.getPresentationScoreEnabled()).as("presentation score is enabled").isTrue(); return course; }
[ "public", "Course", "addCourseWithOneModelingExercise", "(", "String", "title", ")", "{", "long", "currentCourseRepoSize", "=", "courseRepo", ".", "count", "(", ")", ";", "long", "currentExerciseRepoSize", "=", "exerciseRepo", ".", "count", "(", ")", ";", "Course", "course", "=", "ModelFactory", ".", "generateCourse", "(", "null", ",", "pastTimestamp", ",", "futureFutureTimestamp", ",", "new", "HashSet", "<", ">", "(", ")", ",", "\"tumuser\"", ",", "\"tutor\"", ",", "\"editor\"", ",", "\"instructor\"", ")", ";", "ModelingExercise", "modelingExercise", "=", "ModelFactory", ".", "generateModelingExercise", "(", "pastTimestamp", ",", "futureTimestamp", ",", "futureFutureTimestamp", ",", "DiagramType", ".", "ClassDiagram", ",", "course", ")", ";", "modelingExercise", ".", "setTitle", "(", "title", ")", ";", "modelingExercise", ".", "setKnowledge", "(", "modelAssessmentKnowledgeService", ".", "createNewKnowledge", "(", ")", ")", ";", "course", ".", "addExercises", "(", "modelingExercise", ")", ";", "course", ".", "setMaxComplaintTimeDays", "(", "14", ")", ";", "course", "=", "courseRepo", ".", "save", "(", "course", ")", ";", "modelingExercise", "=", "exerciseRepo", ".", "save", "(", "modelingExercise", ")", ";", "assertThat", "(", "exerciseRepo", ".", "count", "(", ")", ")", ".", "as", "(", "\"one exercise got stored\"", ")", ".", "isEqualTo", "(", "currentExerciseRepoSize", "+", "1L", ")", ";", "assertThat", "(", "courseRepo", ".", "count", "(", ")", ")", ".", "as", "(", "\"a course got stored\"", ")", ".", "isEqualTo", "(", "currentCourseRepoSize", "+", "1L", ")", ";", "assertThat", "(", "course", ".", "getExercises", "(", ")", ")", ".", "as", "(", "\"course contains the exercise\"", ")", ".", "containsExactlyInAnyOrder", "(", "modelingExercise", ")", ";", "assertThat", "(", "modelingExercise", ".", "getPresentationScoreEnabled", "(", ")", ")", ".", "as", "(", "\"presentation score is enabled\"", ")", ".", "isTrue", "(", ")", ";", "return", "course", ";", "}" ]
@param title The title of the to be added modeling exercise @return A course with one specified modeling exercise
[ "@param", "title", "The", "title", "of", "the", "to", "be", "added", "modeling", "exercise", "@return", "A", "course", "with", "one", "specified", "modeling", "exercise" ]
[]
[ { "param": "title", "type": "String" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "title", "type": "String", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 385, 3117, 527, 39, 3117, 1190, 3335, 1488, 310, 424, 20603, 12, 780, 2077, 13, 288, 203, 3639, 1525, 783, 39, 3117, 8791, 1225, 273, 4362, 8791, 18, 1883, 5621, 203, 3639, 1525, 783, 424, 20603, 8791, 1225, 273, 24165, 8791, 18, 1883, 5621, 203, 3639, 385, 3117, 4362, 273, 3164, 1733, 18, 7163, 39, 3117, 12, 2011, 16, 8854, 4921, 16, 3563, 4118, 4921, 16, 394, 6847, 29667, 9334, 315, 88, 379, 1355, 3113, 315, 88, 3408, 3113, 315, 9177, 3113, 315, 267, 2732, 8863, 203, 3639, 3164, 310, 424, 20603, 938, 310, 424, 20603, 273, 3164, 1733, 18, 7163, 1488, 310, 424, 20603, 12, 84, 689, 4921, 16, 3563, 4921, 16, 3563, 4118, 4921, 16, 14539, 1940, 559, 18, 797, 14058, 1940, 16, 4362, 1769, 203, 3639, 938, 310, 424, 20603, 18, 542, 4247, 12, 2649, 1769, 203, 3639, 938, 310, 424, 20603, 18, 542, 47, 14390, 12, 2284, 15209, 47, 14390, 1179, 18, 2640, 1908, 47, 14390, 10663, 203, 3639, 4362, 18, 1289, 424, 12610, 6141, 12, 2284, 310, 424, 20603, 1769, 203, 3639, 4362, 18, 542, 2747, 799, 412, 1598, 950, 9384, 12, 3461, 1769, 203, 3639, 4362, 273, 4362, 8791, 18, 5688, 12, 5566, 1769, 203, 3639, 938, 310, 424, 20603, 273, 24165, 8791, 18, 5688, 12, 2284, 310, 424, 20603, 1769, 203, 3639, 1815, 18163, 12, 8913, 30708, 8791, 18, 1883, 1435, 2934, 345, 2932, 476, 24165, 2363, 4041, 20387, 291, 5812, 774, 12, 2972, 424, 20603, 8791, 1225, 397, 404, 48, 1769, 203, 3639, 1815, 18163, 12, 5566, 8791, 18, 1883, 1435, 2934, 345, 2932, 69, 4362, 2363, 4041, 20387, 291, 5812, 774, 12, 2972, 39, 3117, 8791, 1225, 397, 404, 48, 1769, 203, 3639, 1815, 18163, 12, 5566, 18, 588, 424, 12610, 6141, 1435, 2934, 345, 2932, 5566, 1914, 326, 24165, 20387, 12298, 14332, 715, 382, 2961, 2448, 12, 2284, 310, 424, 20603, 1769, 203, 3639, 1815, 18163, 12, 2284, 310, 424, 20603, 18, 588, 6351, 367, 7295, 1526, 1435, 2934, 345, 2932, 10364, 4462, 353, 3696, 20387, 291, 5510, 5621, 203, 3639, 327, 4362, 31, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 632, 891, 2077, 1021, 2077, 434, 326, 358, 506, 3096, 938, 310, 24165, 203, 377, 380, 632, 2463, 432, 4362, 598, 1245, 1269, 938, 310, 24165, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
49a09a653897b19f0a553b59d44e00764c8bfb5c
ls1intum/Artemis
src/test/java/de/tum/in/www1/artemis/util/DatabaseUtilService.java
[ "MIT" ]
Java
addCourseWithOneReleasedTextExercise
Course
public Course addCourseWithOneReleasedTextExercise(String title) { Course course = ModelFactory.generateCourse(null, pastTimestamp, futureFutureTimestamp, new HashSet<>(), "tumuser", "tutor", "editor", "instructor"); TextExercise textExercise = ModelFactory.generateTextExercise(pastTimestamp, futureTimestamp, futureFutureTimestamp, course); textExercise.setTitle(title); textExercise.setKnowledge(textAssessmentKnowledgeService.createNewKnowledge()); course.addExercises(textExercise); final var exercisesNrBefore = exerciseRepo.count(); final var courseNrBefore = courseRepo.count(); courseRepo.save(course); exerciseRepo.save(textExercise); assertThat(exercisesNrBefore + 1).as("one exercise got stored").isEqualTo(exerciseRepo.count()); assertThat(courseNrBefore + 1).as("a course got stored").isEqualTo(courseRepo.count()); assertThat(courseRepo.findWithEagerExercisesById(course.getId()).getExercises()).as("course contains the exercise").contains(textExercise); assertThat(textExercise.getPresentationScoreEnabled()).as("presentation score is enabled").isTrue(); return course; }
/** * @param title The title of the to be added text exercise * @return A course with one specified text exercise */
@param title The title of the to be added text exercise @return A course with one specified text exercise
[ "@param", "title", "The", "title", "of", "the", "to", "be", "added", "text", "exercise", "@return", "A", "course", "with", "one", "specified", "text", "exercise" ]
public Course addCourseWithOneReleasedTextExercise(String title) { Course course = ModelFactory.generateCourse(null, pastTimestamp, futureFutureTimestamp, new HashSet<>(), "tumuser", "tutor", "editor", "instructor"); TextExercise textExercise = ModelFactory.generateTextExercise(pastTimestamp, futureTimestamp, futureFutureTimestamp, course); textExercise.setTitle(title); textExercise.setKnowledge(textAssessmentKnowledgeService.createNewKnowledge()); course.addExercises(textExercise); final var exercisesNrBefore = exerciseRepo.count(); final var courseNrBefore = courseRepo.count(); courseRepo.save(course); exerciseRepo.save(textExercise); assertThat(exercisesNrBefore + 1).as("one exercise got stored").isEqualTo(exerciseRepo.count()); assertThat(courseNrBefore + 1).as("a course got stored").isEqualTo(courseRepo.count()); assertThat(courseRepo.findWithEagerExercisesById(course.getId()).getExercises()).as("course contains the exercise").contains(textExercise); assertThat(textExercise.getPresentationScoreEnabled()).as("presentation score is enabled").isTrue(); return course; }
[ "public", "Course", "addCourseWithOneReleasedTextExercise", "(", "String", "title", ")", "{", "Course", "course", "=", "ModelFactory", ".", "generateCourse", "(", "null", ",", "pastTimestamp", ",", "futureFutureTimestamp", ",", "new", "HashSet", "<", ">", "(", ")", ",", "\"tumuser\"", ",", "\"tutor\"", ",", "\"editor\"", ",", "\"instructor\"", ")", ";", "TextExercise", "textExercise", "=", "ModelFactory", ".", "generateTextExercise", "(", "pastTimestamp", ",", "futureTimestamp", ",", "futureFutureTimestamp", ",", "course", ")", ";", "textExercise", ".", "setTitle", "(", "title", ")", ";", "textExercise", ".", "setKnowledge", "(", "textAssessmentKnowledgeService", ".", "createNewKnowledge", "(", ")", ")", ";", "course", ".", "addExercises", "(", "textExercise", ")", ";", "final", "var", "exercisesNrBefore", "=", "exerciseRepo", ".", "count", "(", ")", ";", "final", "var", "courseNrBefore", "=", "courseRepo", ".", "count", "(", ")", ";", "courseRepo", ".", "save", "(", "course", ")", ";", "exerciseRepo", ".", "save", "(", "textExercise", ")", ";", "assertThat", "(", "exercisesNrBefore", "+", "1", ")", ".", "as", "(", "\"one exercise got stored\"", ")", ".", "isEqualTo", "(", "exerciseRepo", ".", "count", "(", ")", ")", ";", "assertThat", "(", "courseNrBefore", "+", "1", ")", ".", "as", "(", "\"a course got stored\"", ")", ".", "isEqualTo", "(", "courseRepo", ".", "count", "(", ")", ")", ";", "assertThat", "(", "courseRepo", ".", "findWithEagerExercisesById", "(", "course", ".", "getId", "(", ")", ")", ".", "getExercises", "(", ")", ")", ".", "as", "(", "\"course contains the exercise\"", ")", ".", "contains", "(", "textExercise", ")", ";", "assertThat", "(", "textExercise", ".", "getPresentationScoreEnabled", "(", ")", ")", ".", "as", "(", "\"presentation score is enabled\"", ")", ".", "isTrue", "(", ")", ";", "return", "course", ";", "}" ]
@param title The title of the to be added text exercise @return A course with one specified text exercise
[ "@param", "title", "The", "title", "of", "the", "to", "be", "added", "text", "exercise", "@return", "A", "course", "with", "one", "specified", "text", "exercise" ]
[]
[ { "param": "title", "type": "String" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "title", "type": "String", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 385, 3117, 527, 39, 3117, 1190, 3335, 26363, 1528, 424, 20603, 12, 780, 2077, 13, 288, 203, 3639, 385, 3117, 4362, 273, 3164, 1733, 18, 7163, 39, 3117, 12, 2011, 16, 8854, 4921, 16, 3563, 4118, 4921, 16, 394, 6847, 29667, 9334, 315, 88, 379, 1355, 3113, 315, 88, 3408, 3113, 315, 9177, 3113, 315, 267, 2732, 8863, 203, 3639, 3867, 424, 20603, 977, 424, 20603, 273, 3164, 1733, 18, 7163, 1528, 424, 20603, 12, 84, 689, 4921, 16, 3563, 4921, 16, 3563, 4118, 4921, 16, 4362, 1769, 203, 3639, 977, 424, 20603, 18, 542, 4247, 12, 2649, 1769, 203, 3639, 977, 424, 20603, 18, 542, 47, 14390, 12, 955, 15209, 47, 14390, 1179, 18, 2640, 1908, 47, 14390, 10663, 203, 3639, 4362, 18, 1289, 424, 12610, 6141, 12, 955, 424, 20603, 1769, 203, 3639, 727, 569, 431, 12610, 6141, 18726, 4649, 273, 24165, 8791, 18, 1883, 5621, 203, 3639, 727, 569, 4362, 18726, 4649, 273, 4362, 8791, 18, 1883, 5621, 203, 3639, 4362, 8791, 18, 5688, 12, 5566, 1769, 203, 3639, 24165, 8791, 18, 5688, 12, 955, 424, 20603, 1769, 203, 3639, 1815, 18163, 12, 8913, 71, 6141, 18726, 4649, 397, 404, 2934, 345, 2932, 476, 24165, 2363, 4041, 20387, 291, 5812, 774, 12, 8913, 30708, 8791, 18, 1883, 10663, 203, 3639, 1815, 18163, 12, 5566, 18726, 4649, 397, 404, 2934, 345, 2932, 69, 4362, 2363, 4041, 20387, 291, 5812, 774, 12, 5566, 8791, 18, 1883, 10663, 203, 3639, 1815, 18163, 12, 5566, 8791, 18, 4720, 1190, 41, 6817, 424, 12610, 6141, 5132, 12, 5566, 18, 26321, 1435, 2934, 588, 424, 12610, 6141, 1435, 2934, 345, 2932, 5566, 1914, 326, 24165, 20387, 12298, 12, 955, 424, 20603, 1769, 203, 3639, 1815, 18163, 12, 955, 424, 20603, 18, 588, 6351, 367, 7295, 1526, 1435, 2934, 345, 2932, 10364, 4462, 353, 3696, 20387, 291, 5510, 5621, 203, 203, 3639, 327, 4362, 31, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 632, 891, 2077, 1021, 2077, 434, 326, 358, 506, 3096, 977, 24165, 203, 377, 380, 632, 2463, 432, 4362, 598, 1245, 1269, 977, 24165, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
49a09a653897b19f0a553b59d44e00764c8bfb5c
ls1intum/Artemis
src/test/java/de/tum/in/www1/artemis/util/DatabaseUtilService.java
[ "MIT" ]
Java
generateSubmittedAnswerFor
SubmittedAnswer
public SubmittedAnswer generateSubmittedAnswerFor(QuizQuestion question, boolean correct) { if (question instanceof MultipleChoiceQuestion) { var submittedAnswer = new MultipleChoiceSubmittedAnswer(); submittedAnswer.setQuizQuestion(question); for (var answerOption : ((MultipleChoiceQuestion) question).getAnswerOptions()) { if (answerOption.isIsCorrect().equals(correct)) { submittedAnswer.addSelectedOptions(answerOption); } } return submittedAnswer; } else if (question instanceof DragAndDropQuestion) { var submittedAnswer = new DragAndDropSubmittedAnswer(); submittedAnswer.setQuizQuestion(question); DragItem dragItem1 = ((DragAndDropQuestion) question).getDragItems().get(0); dragItem1.setQuestion((DragAndDropQuestion) question); System.out.println(dragItem1); DragItem dragItem2 = ((DragAndDropQuestion) question).getDragItems().get(1); dragItem2.setQuestion((DragAndDropQuestion) question); System.out.println(dragItem2); DragItem dragItem3 = ((DragAndDropQuestion) question).getDragItems().get(2); dragItem3.setQuestion((DragAndDropQuestion) question); System.out.println(dragItem3); DropLocation dropLocation1 = ((DragAndDropQuestion) question).getDropLocations().get(0); dropLocation1.setQuestion((DragAndDropQuestion) question); System.out.println(dropLocation1); DropLocation dropLocation2 = ((DragAndDropQuestion) question).getDropLocations().get(1); dropLocation2.setQuestion((DragAndDropQuestion) question); System.out.println(dropLocation2); DropLocation dropLocation3 = ((DragAndDropQuestion) question).getDropLocations().get(2); dropLocation3.setQuestion((DragAndDropQuestion) question); System.out.println(dropLocation3); if (correct) { submittedAnswer.addMappings(new DragAndDropMapping().dragItem(dragItem1).dropLocation(dropLocation1)); submittedAnswer.addMappings(new DragAndDropMapping().dragItem(dragItem2).dropLocation(dropLocation2)); submittedAnswer.addMappings(new DragAndDropMapping().dragItem(dragItem3).dropLocation(dropLocation3)); } else { submittedAnswer.addMappings(new DragAndDropMapping().dragItem(dragItem2).dropLocation(dropLocation3)); submittedAnswer.addMappings(new DragAndDropMapping().dragItem(dragItem1).dropLocation(dropLocation2)); submittedAnswer.addMappings(new DragAndDropMapping().dragItem(dragItem3).dropLocation(dropLocation1)); } return submittedAnswer; } else if (question instanceof ShortAnswerQuestion) { var submittedAnswer = new ShortAnswerSubmittedAnswer(); submittedAnswer.setQuizQuestion(question); for (var spot : ((ShortAnswerQuestion) question).getSpots()) { ShortAnswerSubmittedText submittedText = new ShortAnswerSubmittedText(); submittedText.setSpot(spot); var correctText = ((ShortAnswerQuestion) question).getCorrectSolutionForSpot(spot).iterator().next().getText(); if (correct) { submittedText.setText(correctText); } else { submittedText.setText(correctText.toUpperCase()); } submittedAnswer.addSubmittedTexts(submittedText); // also invoke remove once submittedAnswer.removeSubmittedTexts(submittedText); submittedAnswer.addSubmittedTexts(submittedText); } return submittedAnswer; } return null; }
/** * Generates a submitted answer for a given question. * * @param question given question, the answer is for * @param correct boolean whether the answer should be correct or not * @return created SubmittedAnswer */
Generates a submitted answer for a given question. @param question given question, the answer is for @param correct boolean whether the answer should be correct or not @return created SubmittedAnswer
[ "Generates", "a", "submitted", "answer", "for", "a", "given", "question", ".", "@param", "question", "given", "question", "the", "answer", "is", "for", "@param", "correct", "boolean", "whether", "the", "answer", "should", "be", "correct", "or", "not", "@return", "created", "SubmittedAnswer" ]
public SubmittedAnswer generateSubmittedAnswerFor(QuizQuestion question, boolean correct) { if (question instanceof MultipleChoiceQuestion) { var submittedAnswer = new MultipleChoiceSubmittedAnswer(); submittedAnswer.setQuizQuestion(question); for (var answerOption : ((MultipleChoiceQuestion) question).getAnswerOptions()) { if (answerOption.isIsCorrect().equals(correct)) { submittedAnswer.addSelectedOptions(answerOption); } } return submittedAnswer; } else if (question instanceof DragAndDropQuestion) { var submittedAnswer = new DragAndDropSubmittedAnswer(); submittedAnswer.setQuizQuestion(question); DragItem dragItem1 = ((DragAndDropQuestion) question).getDragItems().get(0); dragItem1.setQuestion((DragAndDropQuestion) question); System.out.println(dragItem1); DragItem dragItem2 = ((DragAndDropQuestion) question).getDragItems().get(1); dragItem2.setQuestion((DragAndDropQuestion) question); System.out.println(dragItem2); DragItem dragItem3 = ((DragAndDropQuestion) question).getDragItems().get(2); dragItem3.setQuestion((DragAndDropQuestion) question); System.out.println(dragItem3); DropLocation dropLocation1 = ((DragAndDropQuestion) question).getDropLocations().get(0); dropLocation1.setQuestion((DragAndDropQuestion) question); System.out.println(dropLocation1); DropLocation dropLocation2 = ((DragAndDropQuestion) question).getDropLocations().get(1); dropLocation2.setQuestion((DragAndDropQuestion) question); System.out.println(dropLocation2); DropLocation dropLocation3 = ((DragAndDropQuestion) question).getDropLocations().get(2); dropLocation3.setQuestion((DragAndDropQuestion) question); System.out.println(dropLocation3); if (correct) { submittedAnswer.addMappings(new DragAndDropMapping().dragItem(dragItem1).dropLocation(dropLocation1)); submittedAnswer.addMappings(new DragAndDropMapping().dragItem(dragItem2).dropLocation(dropLocation2)); submittedAnswer.addMappings(new DragAndDropMapping().dragItem(dragItem3).dropLocation(dropLocation3)); } else { submittedAnswer.addMappings(new DragAndDropMapping().dragItem(dragItem2).dropLocation(dropLocation3)); submittedAnswer.addMappings(new DragAndDropMapping().dragItem(dragItem1).dropLocation(dropLocation2)); submittedAnswer.addMappings(new DragAndDropMapping().dragItem(dragItem3).dropLocation(dropLocation1)); } return submittedAnswer; } else if (question instanceof ShortAnswerQuestion) { var submittedAnswer = new ShortAnswerSubmittedAnswer(); submittedAnswer.setQuizQuestion(question); for (var spot : ((ShortAnswerQuestion) question).getSpots()) { ShortAnswerSubmittedText submittedText = new ShortAnswerSubmittedText(); submittedText.setSpot(spot); var correctText = ((ShortAnswerQuestion) question).getCorrectSolutionForSpot(spot).iterator().next().getText(); if (correct) { submittedText.setText(correctText); } else { submittedText.setText(correctText.toUpperCase()); } submittedAnswer.addSubmittedTexts(submittedText); submittedAnswer.removeSubmittedTexts(submittedText); submittedAnswer.addSubmittedTexts(submittedText); } return submittedAnswer; } return null; }
[ "public", "SubmittedAnswer", "generateSubmittedAnswerFor", "(", "QuizQuestion", "question", ",", "boolean", "correct", ")", "{", "if", "(", "question", "instanceof", "MultipleChoiceQuestion", ")", "{", "var", "submittedAnswer", "=", "new", "MultipleChoiceSubmittedAnswer", "(", ")", ";", "submittedAnswer", ".", "setQuizQuestion", "(", "question", ")", ";", "for", "(", "var", "answerOption", ":", "(", "(", "MultipleChoiceQuestion", ")", "question", ")", ".", "getAnswerOptions", "(", ")", ")", "{", "if", "(", "answerOption", ".", "isIsCorrect", "(", ")", ".", "equals", "(", "correct", ")", ")", "{", "submittedAnswer", ".", "addSelectedOptions", "(", "answerOption", ")", ";", "}", "}", "return", "submittedAnswer", ";", "}", "else", "if", "(", "question", "instanceof", "DragAndDropQuestion", ")", "{", "var", "submittedAnswer", "=", "new", "DragAndDropSubmittedAnswer", "(", ")", ";", "submittedAnswer", ".", "setQuizQuestion", "(", "question", ")", ";", "DragItem", "dragItem1", "=", "(", "(", "DragAndDropQuestion", ")", "question", ")", ".", "getDragItems", "(", ")", ".", "get", "(", "0", ")", ";", "dragItem1", ".", "setQuestion", "(", "(", "DragAndDropQuestion", ")", "question", ")", ";", "System", ".", "out", ".", "println", "(", "dragItem1", ")", ";", "DragItem", "dragItem2", "=", "(", "(", "DragAndDropQuestion", ")", "question", ")", ".", "getDragItems", "(", ")", ".", "get", "(", "1", ")", ";", "dragItem2", ".", "setQuestion", "(", "(", "DragAndDropQuestion", ")", "question", ")", ";", "System", ".", "out", ".", "println", "(", "dragItem2", ")", ";", "DragItem", "dragItem3", "=", "(", "(", "DragAndDropQuestion", ")", "question", ")", ".", "getDragItems", "(", ")", ".", "get", "(", "2", ")", ";", "dragItem3", ".", "setQuestion", "(", "(", "DragAndDropQuestion", ")", "question", ")", ";", "System", ".", "out", ".", "println", "(", "dragItem3", ")", ";", "DropLocation", "dropLocation1", "=", "(", "(", "DragAndDropQuestion", ")", "question", ")", ".", "getDropLocations", "(", ")", ".", "get", "(", "0", ")", ";", "dropLocation1", ".", "setQuestion", "(", "(", "DragAndDropQuestion", ")", "question", ")", ";", "System", ".", "out", ".", "println", "(", "dropLocation1", ")", ";", "DropLocation", "dropLocation2", "=", "(", "(", "DragAndDropQuestion", ")", "question", ")", ".", "getDropLocations", "(", ")", ".", "get", "(", "1", ")", ";", "dropLocation2", ".", "setQuestion", "(", "(", "DragAndDropQuestion", ")", "question", ")", ";", "System", ".", "out", ".", "println", "(", "dropLocation2", ")", ";", "DropLocation", "dropLocation3", "=", "(", "(", "DragAndDropQuestion", ")", "question", ")", ".", "getDropLocations", "(", ")", ".", "get", "(", "2", ")", ";", "dropLocation3", ".", "setQuestion", "(", "(", "DragAndDropQuestion", ")", "question", ")", ";", "System", ".", "out", ".", "println", "(", "dropLocation3", ")", ";", "if", "(", "correct", ")", "{", "submittedAnswer", ".", "addMappings", "(", "new", "DragAndDropMapping", "(", ")", ".", "dragItem", "(", "dragItem1", ")", ".", "dropLocation", "(", "dropLocation1", ")", ")", ";", "submittedAnswer", ".", "addMappings", "(", "new", "DragAndDropMapping", "(", ")", ".", "dragItem", "(", "dragItem2", ")", ".", "dropLocation", "(", "dropLocation2", ")", ")", ";", "submittedAnswer", ".", "addMappings", "(", "new", "DragAndDropMapping", "(", ")", ".", "dragItem", "(", "dragItem3", ")", ".", "dropLocation", "(", "dropLocation3", ")", ")", ";", "}", "else", "{", "submittedAnswer", ".", "addMappings", "(", "new", "DragAndDropMapping", "(", ")", ".", "dragItem", "(", "dragItem2", ")", ".", "dropLocation", "(", "dropLocation3", ")", ")", ";", "submittedAnswer", ".", "addMappings", "(", "new", "DragAndDropMapping", "(", ")", ".", "dragItem", "(", "dragItem1", ")", ".", "dropLocation", "(", "dropLocation2", ")", ")", ";", "submittedAnswer", ".", "addMappings", "(", "new", "DragAndDropMapping", "(", ")", ".", "dragItem", "(", "dragItem3", ")", ".", "dropLocation", "(", "dropLocation1", ")", ")", ";", "}", "return", "submittedAnswer", ";", "}", "else", "if", "(", "question", "instanceof", "ShortAnswerQuestion", ")", "{", "var", "submittedAnswer", "=", "new", "ShortAnswerSubmittedAnswer", "(", ")", ";", "submittedAnswer", ".", "setQuizQuestion", "(", "question", ")", ";", "for", "(", "var", "spot", ":", "(", "(", "ShortAnswerQuestion", ")", "question", ")", ".", "getSpots", "(", ")", ")", "{", "ShortAnswerSubmittedText", "submittedText", "=", "new", "ShortAnswerSubmittedText", "(", ")", ";", "submittedText", ".", "setSpot", "(", "spot", ")", ";", "var", "correctText", "=", "(", "(", "ShortAnswerQuestion", ")", "question", ")", ".", "getCorrectSolutionForSpot", "(", "spot", ")", ".", "iterator", "(", ")", ".", "next", "(", ")", ".", "getText", "(", ")", ";", "if", "(", "correct", ")", "{", "submittedText", ".", "setText", "(", "correctText", ")", ";", "}", "else", "{", "submittedText", ".", "setText", "(", "correctText", ".", "toUpperCase", "(", ")", ")", ";", "}", "submittedAnswer", ".", "addSubmittedTexts", "(", "submittedText", ")", ";", "submittedAnswer", ".", "removeSubmittedTexts", "(", "submittedText", ")", ";", "submittedAnswer", ".", "addSubmittedTexts", "(", "submittedText", ")", ";", "}", "return", "submittedAnswer", ";", "}", "return", "null", ";", "}" ]
Generates a submitted answer for a given question.
[ "Generates", "a", "submitted", "answer", "for", "a", "given", "question", "." ]
[ "// also invoke remove once" ]
[ { "param": "question", "type": "QuizQuestion" }, { "param": "correct", "type": "boolean" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "question", "type": "QuizQuestion", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "correct", "type": "boolean", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 2592, 7948, 13203, 2103, 28882, 13203, 1290, 12, 928, 452, 11665, 5073, 16, 1250, 3434, 13, 288, 203, 3639, 309, 261, 4173, 1276, 13531, 10538, 11665, 13, 288, 203, 5411, 569, 9638, 13203, 273, 394, 13531, 10538, 28882, 13203, 5621, 203, 5411, 9638, 13203, 18, 542, 928, 452, 11665, 12, 4173, 1769, 203, 203, 5411, 364, 261, 1401, 5803, 1895, 294, 14015, 8438, 10538, 11665, 13, 5073, 2934, 588, 13203, 1320, 10756, 288, 203, 7734, 309, 261, 13490, 1895, 18, 291, 2520, 16147, 7675, 14963, 12, 6746, 3719, 288, 203, 10792, 9638, 13203, 18, 1289, 7416, 1320, 12, 13490, 1895, 1769, 203, 7734, 289, 203, 5411, 289, 203, 5411, 327, 9638, 13203, 31, 203, 3639, 289, 203, 3639, 469, 309, 261, 4173, 1276, 28425, 1876, 7544, 11665, 13, 288, 203, 5411, 569, 9638, 13203, 273, 394, 28425, 1876, 7544, 28882, 13203, 5621, 203, 5411, 9638, 13203, 18, 542, 928, 452, 11665, 12, 4173, 1769, 203, 203, 5411, 28425, 1180, 8823, 1180, 21, 273, 14015, 11728, 1876, 7544, 11665, 13, 5073, 2934, 588, 11728, 3126, 7675, 588, 12, 20, 1769, 203, 5411, 8823, 1180, 21, 18, 542, 11665, 12443, 11728, 1876, 7544, 11665, 13, 5073, 1769, 203, 5411, 2332, 18, 659, 18, 8222, 12, 15997, 1180, 21, 1769, 203, 5411, 28425, 1180, 8823, 1180, 22, 273, 14015, 11728, 1876, 7544, 11665, 13, 5073, 2934, 588, 11728, 3126, 7675, 588, 12, 21, 1769, 203, 5411, 8823, 1180, 22, 18, 542, 11665, 12443, 11728, 1876, 7544, 11665, 13, 5073, 1769, 203, 5411, 2332, 18, 659, 18, 8222, 12, 15997, 1180, 22, 1769, 203, 5411, 28425, 1180, 8823, 1180, 23, 273, 14015, 11728, 1876, 7544, 11665, 13, 5073, 2934, 588, 11728, 3126, 7675, 588, 12, 22, 1769, 203, 5411, 8823, 1180, 23, 18, 542, 11665, 12443, 11728, 1876, 7544, 11665, 13, 5073, 1769, 203, 5411, 2332, 18, 659, 18, 8222, 12, 15997, 1180, 23, 1769, 203, 203, 5411, 10895, 2735, 3640, 2735, 21, 273, 14015, 11728, 1876, 7544, 11665, 13, 5073, 2934, 588, 7544, 10985, 7675, 588, 12, 20, 1769, 203, 5411, 3640, 2735, 21, 18, 542, 11665, 12443, 11728, 1876, 7544, 11665, 13, 5073, 1769, 203, 5411, 2332, 18, 659, 18, 8222, 12, 7285, 2735, 21, 1769, 203, 5411, 10895, 2735, 3640, 2735, 22, 273, 14015, 11728, 1876, 7544, 11665, 13, 5073, 2934, 588, 7544, 10985, 7675, 588, 12, 21, 1769, 203, 5411, 3640, 2735, 22, 18, 542, 11665, 12443, 11728, 1876, 7544, 11665, 13, 5073, 1769, 203, 5411, 2332, 18, 659, 18, 8222, 12, 7285, 2735, 22, 1769, 203, 5411, 10895, 2735, 3640, 2735, 23, 273, 14015, 11728, 1876, 7544, 11665, 13, 5073, 2934, 588, 7544, 10985, 7675, 588, 12, 22, 1769, 203, 5411, 3640, 2735, 23, 18, 542, 11665, 12443, 11728, 1876, 7544, 11665, 13, 5073, 1769, 203, 5411, 2332, 18, 659, 18, 8222, 12, 7285, 2735, 23, 1769, 203, 203, 5411, 309, 261, 6746, 13, 288, 203, 7734, 9638, 13203, 18, 1289, 7742, 12, 2704, 28425, 1876, 7544, 3233, 7675, 15997, 1180, 12, 15997, 1180, 21, 2934, 7285, 2735, 12, 7285, 2735, 21, 10019, 203, 2 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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, 5803, 1410, 506, 3434, 578, 486, 203, 377, 380, 632, 2463, 2522, 2592, 7948, 13203, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
fee534bcf99d9ac9b67f559575f41bbe3061ff22
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/service/CourseService.java
[ "MIT" ]
Java
registerUserForCourse
null
public void registerUserForCourse(User user, Course course) { userService.addUserToGroup(user, course.getStudentGroupName(), Role.STUDENT); final var auditEvent = new AuditEvent(user.getLogin(), Constants.REGISTER_FOR_COURSE, "course=" + course.getTitle()); auditEventRepository.add(auditEvent); log.info("User {} has successfully registered for course {}", user.getLogin(), course.getTitle()); }
/** * Registers a user in a course by adding him to the student group of the course * * @param user The user that should get added to the course * @param course The course to which the user should get added to */
Registers a user in a course by adding him to the student group of the course @param user The user that should get added to the course @param course The course to which the user should get added to
[ "Registers", "a", "user", "in", "a", "course", "by", "adding", "him", "to", "the", "student", "group", "of", "the", "course", "@param", "user", "The", "user", "that", "should", "get", "added", "to", "the", "course", "@param", "course", "The", "course", "to", "which", "the", "user", "should", "get", "added", "to" ]
public void registerUserForCourse(User user, Course course) { userService.addUserToGroup(user, course.getStudentGroupName(), Role.STUDENT); final var auditEvent = new AuditEvent(user.getLogin(), Constants.REGISTER_FOR_COURSE, "course=" + course.getTitle()); auditEventRepository.add(auditEvent); log.info("User {} has successfully registered for course {}", user.getLogin(), course.getTitle()); }
[ "public", "void", "registerUserForCourse", "(", "User", "user", ",", "Course", "course", ")", "{", "userService", ".", "addUserToGroup", "(", "user", ",", "course", ".", "getStudentGroupName", "(", ")", ",", "Role", ".", "STUDENT", ")", ";", "final", "var", "auditEvent", "=", "new", "AuditEvent", "(", "user", ".", "getLogin", "(", ")", ",", "Constants", ".", "REGISTER_FOR_COURSE", ",", "\"course=\"", "+", "course", ".", "getTitle", "(", ")", ")", ";", "auditEventRepository", ".", "add", "(", "auditEvent", ")", ";", "log", ".", "info", "(", "\"User {} has successfully registered for course {}\"", ",", "user", ".", "getLogin", "(", ")", ",", "course", ".", "getTitle", "(", ")", ")", ";", "}" ]
Registers a user in a course by adding him to the student group of the course @param user The user that should get added to the course @param course The course to which the user should get added to
[ "Registers", "a", "user", "in", "a", "course", "by", "adding", "him", "to", "the", "student", "group", "of", "the", "course", "@param", "user", "The", "user", "that", "should", "get", "added", "to", "the", "course", "@param", "course", "The", "course", "to", "which", "the", "user", "should", "get", "added", "to" ]
[]
[ { "param": "user", "type": "User" }, { "param": "course", "type": "Course" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "user", "type": "User", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "course", "type": "Course", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 918, 1744, 1299, 1290, 39, 3117, 12, 1299, 729, 16, 385, 3117, 4362, 13, 288, 203, 3639, 27625, 18, 1289, 1299, 774, 1114, 12, 1355, 16, 4362, 18, 588, 19943, 319, 3943, 9334, 6204, 18, 882, 12587, 2222, 1769, 203, 3639, 727, 569, 8215, 1133, 273, 394, 12975, 1133, 12, 1355, 18, 588, 5358, 9334, 5245, 18, 27511, 67, 7473, 67, 3865, 23875, 16, 315, 5566, 1546, 397, 4362, 18, 588, 4247, 10663, 203, 3639, 8215, 1133, 3305, 18, 1289, 12, 17413, 1133, 1769, 203, 3639, 613, 18, 1376, 2932, 1299, 2618, 711, 4985, 4104, 364, 4362, 3728, 16, 729, 18, 588, 5358, 9334, 4362, 18, 588, 4247, 10663, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 2526, 6045, 279, 729, 316, 279, 4362, 635, 6534, 366, 381, 358, 326, 18110, 1041, 434, 326, 4362, 203, 377, 380, 203, 377, 380, 632, 891, 729, 282, 1021, 729, 716, 1410, 336, 3096, 358, 326, 4362, 203, 377, 380, 632, 891, 4362, 1021, 4362, 358, 1492, 326, 729, 1410, 336, 3096, 358, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
fee534bcf99d9ac9b67f559575f41bbe3061ff22
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/service/CourseService.java
[ "MIT" ]
Java
removeDuplicateActiveUserRows
null
private List<StatisticsEntry> removeDuplicateActiveUserRows(List<StatisticsEntry> activeUserRows, ZonedDateTime startDate) { int startIndex = getWeekOfDate(startDate); Map<Object, List<String>> usersByDate = new HashMap<>(); for (StatisticsEntry listElement : activeUserRows) { // listElement.date has the form "2021-05-04", to convert it to ZonedDateTime, it needs a time String dateOfElement = listElement.getDate() + " 10:00"; var zone = startDate.getZone(); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"); ZonedDateTime date = LocalDateTime.parse(dateOfElement, formatter).atZone(zone); int index = getWeekOfDate(date); // the database stores entries in UTC, so it can happen that entries have a date one date before the startDate index = index == startIndex - 1 ? startIndex : index; String username = listElement.getUsername(); List<String> usersInSameSlot = usersByDate.get(index); // if this index is not yet existing in users if (usersInSameSlot == null) { usersInSameSlot = new ArrayList<>(); usersInSameSlot.add(username); usersByDate.put(index, usersInSameSlot); } // if the value of the map for this index does not contain this username else if (!usersInSameSlot.contains(username)) { usersInSameSlot.add(username); } } List<StatisticsEntry> returnList = new ArrayList<>(); usersByDate.forEach((date, users) -> { int year = (Integer) date < getWeekOfDate(startDate) ? startDate.getYear() + 1 : startDate.getYear(); ZonedDateTime firstDateOfYear = ZonedDateTime.of(year, 1, 1, 0, 0, 0, 0, startDate.getZone()); ZonedDateTime start = getWeekOfDate(firstDateOfYear) == 1 ? firstDateOfYear.plusWeeks(((Integer) date) - 1) : firstDateOfYear.plusWeeks((Integer) date); StatisticsEntry listElement = new StatisticsEntry(start, users.size()); returnList.add(listElement); }); return returnList; }
/** * The List of StatisticsEntries can contain duplicated entries, which means that a user has two entries in the same week. * This method compares the values and returns a List<StatisticsEntry> without duplicated entries. * * @param activeUserRows a list of entries * @param startDate the startDate of the period * @return a List<StatisticsEntry> containing date and amount of active users in this period */
The List of StatisticsEntries can contain duplicated entries, which means that a user has two entries in the same week. This method compares the values and returns a List without duplicated entries. @param activeUserRows a list of entries @param startDate the startDate of the period @return a List containing date and amount of active users in this period
[ "The", "List", "of", "StatisticsEntries", "can", "contain", "duplicated", "entries", "which", "means", "that", "a", "user", "has", "two", "entries", "in", "the", "same", "week", ".", "This", "method", "compares", "the", "values", "and", "returns", "a", "List", "without", "duplicated", "entries", ".", "@param", "activeUserRows", "a", "list", "of", "entries", "@param", "startDate", "the", "startDate", "of", "the", "period", "@return", "a", "List", "containing", "date", "and", "amount", "of", "active", "users", "in", "this", "period" ]
private List<StatisticsEntry> removeDuplicateActiveUserRows(List<StatisticsEntry> activeUserRows, ZonedDateTime startDate) { int startIndex = getWeekOfDate(startDate); Map<Object, List<String>> usersByDate = new HashMap<>(); for (StatisticsEntry listElement : activeUserRows) { String dateOfElement = listElement.getDate() + " 10:00"; var zone = startDate.getZone(); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"); ZonedDateTime date = LocalDateTime.parse(dateOfElement, formatter).atZone(zone); int index = getWeekOfDate(date); index = index == startIndex - 1 ? startIndex : index; String username = listElement.getUsername(); List<String> usersInSameSlot = usersByDate.get(index); if (usersInSameSlot == null) { usersInSameSlot = new ArrayList<>(); usersInSameSlot.add(username); usersByDate.put(index, usersInSameSlot); } else if (!usersInSameSlot.contains(username)) { usersInSameSlot.add(username); } } List<StatisticsEntry> returnList = new ArrayList<>(); usersByDate.forEach((date, users) -> { int year = (Integer) date < getWeekOfDate(startDate) ? startDate.getYear() + 1 : startDate.getYear(); ZonedDateTime firstDateOfYear = ZonedDateTime.of(year, 1, 1, 0, 0, 0, 0, startDate.getZone()); ZonedDateTime start = getWeekOfDate(firstDateOfYear) == 1 ? firstDateOfYear.plusWeeks(((Integer) date) - 1) : firstDateOfYear.plusWeeks((Integer) date); StatisticsEntry listElement = new StatisticsEntry(start, users.size()); returnList.add(listElement); }); return returnList; }
[ "private", "List", "<", "StatisticsEntry", ">", "removeDuplicateActiveUserRows", "(", "List", "<", "StatisticsEntry", ">", "activeUserRows", ",", "ZonedDateTime", "startDate", ")", "{", "int", "startIndex", "=", "getWeekOfDate", "(", "startDate", ")", ";", "Map", "<", "Object", ",", "List", "<", "String", ">", ">", "usersByDate", "=", "new", "HashMap", "<", ">", "(", ")", ";", "for", "(", "StatisticsEntry", "listElement", ":", "activeUserRows", ")", "{", "String", "dateOfElement", "=", "listElement", ".", "getDate", "(", ")", "+", "\" 10:00\"", ";", "var", "zone", "=", "startDate", ".", "getZone", "(", ")", ";", "DateTimeFormatter", "formatter", "=", "DateTimeFormatter", ".", "ofPattern", "(", "\"yyyy-MM-dd HH:mm\"", ")", ";", "ZonedDateTime", "date", "=", "LocalDateTime", ".", "parse", "(", "dateOfElement", ",", "formatter", ")", ".", "atZone", "(", "zone", ")", ";", "int", "index", "=", "getWeekOfDate", "(", "date", ")", ";", "index", "=", "index", "==", "startIndex", "-", "1", "?", "startIndex", ":", "index", ";", "String", "username", "=", "listElement", ".", "getUsername", "(", ")", ";", "List", "<", "String", ">", "usersInSameSlot", "=", "usersByDate", ".", "get", "(", "index", ")", ";", "if", "(", "usersInSameSlot", "==", "null", ")", "{", "usersInSameSlot", "=", "new", "ArrayList", "<", ">", "(", ")", ";", "usersInSameSlot", ".", "add", "(", "username", ")", ";", "usersByDate", ".", "put", "(", "index", ",", "usersInSameSlot", ")", ";", "}", "else", "if", "(", "!", "usersInSameSlot", ".", "contains", "(", "username", ")", ")", "{", "usersInSameSlot", ".", "add", "(", "username", ")", ";", "}", "}", "List", "<", "StatisticsEntry", ">", "returnList", "=", "new", "ArrayList", "<", ">", "(", ")", ";", "usersByDate", ".", "forEach", "(", "(", "date", ",", "users", ")", "->", "{", "int", "year", "=", "(", "Integer", ")", "date", "<", "getWeekOfDate", "(", "startDate", ")", "?", "startDate", ".", "getYear", "(", ")", "+", "1", ":", "startDate", ".", "getYear", "(", ")", ";", "ZonedDateTime", "firstDateOfYear", "=", "ZonedDateTime", ".", "of", "(", "year", ",", "1", ",", "1", ",", "0", ",", "0", ",", "0", ",", "0", ",", "startDate", ".", "getZone", "(", ")", ")", ";", "ZonedDateTime", "start", "=", "getWeekOfDate", "(", "firstDateOfYear", ")", "==", "1", "?", "firstDateOfYear", ".", "plusWeeks", "(", "(", "(", "Integer", ")", "date", ")", "-", "1", ")", ":", "firstDateOfYear", ".", "plusWeeks", "(", "(", "Integer", ")", "date", ")", ";", "StatisticsEntry", "listElement", "=", "new", "StatisticsEntry", "(", "start", ",", "users", ".", "size", "(", ")", ")", ";", "returnList", ".", "add", "(", "listElement", ")", ";", "}", ")", ";", "return", "returnList", ";", "}" ]
The List of StatisticsEntries can contain duplicated entries, which means that a user has two entries in the same week.
[ "The", "List", "of", "StatisticsEntries", "can", "contain", "duplicated", "entries", "which", "means", "that", "a", "user", "has", "two", "entries", "in", "the", "same", "week", "." ]
[ "// listElement.date has the form \"2021-05-04\", to convert it to ZonedDateTime, it needs a time", "// the database stores entries in UTC, so it can happen that entries have a date one date before the startDate", "// if this index is not yet existing in users", "// if the value of the map for this index does not contain this username" ]
[ { "param": "activeUserRows", "type": "List<StatisticsEntry>" }, { "param": "startDate", "type": "ZonedDateTime" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "activeUserRows", "type": "List<StatisticsEntry>", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "startDate", "type": "ZonedDateTime", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 3238, 987, 32, 8569, 1622, 34, 1206, 11826, 3896, 1299, 4300, 12, 682, 32, 8569, 1622, 34, 2695, 1299, 4300, 16, 24869, 12572, 13, 288, 203, 3639, 509, 10588, 273, 336, 6630, 951, 1626, 12, 1937, 1626, 1769, 203, 3639, 1635, 32, 921, 16, 987, 32, 780, 9778, 3677, 858, 1626, 273, 394, 4317, 29667, 5621, 203, 3639, 364, 261, 8569, 1622, 666, 1046, 294, 2695, 1299, 4300, 13, 288, 203, 5411, 368, 666, 1046, 18, 712, 711, 326, 646, 315, 18212, 21, 17, 6260, 17, 3028, 3113, 358, 1765, 518, 358, 24869, 16, 518, 4260, 279, 813, 203, 5411, 514, 1509, 951, 1046, 273, 666, 1046, 18, 588, 1626, 1435, 397, 315, 1728, 30, 713, 14432, 203, 5411, 569, 4157, 273, 12572, 18, 588, 4226, 5621, 203, 5411, 28066, 4453, 273, 28066, 18, 792, 3234, 2932, 17722, 17, 8206, 17, 449, 20842, 30, 7020, 8863, 203, 5411, 24869, 1509, 273, 21678, 18, 2670, 12, 712, 951, 1046, 16, 4453, 2934, 270, 4226, 12, 3486, 1769, 203, 5411, 509, 770, 273, 336, 6630, 951, 1626, 12, 712, 1769, 203, 5411, 368, 326, 2063, 9064, 3222, 316, 9951, 16, 1427, 518, 848, 5865, 716, 3222, 1240, 279, 1509, 1245, 1509, 1865, 326, 12572, 203, 5411, 770, 273, 770, 422, 10588, 300, 404, 692, 10588, 294, 770, 31, 203, 5411, 514, 2718, 273, 666, 1046, 18, 588, 8575, 5621, 203, 5411, 987, 32, 780, 34, 3677, 382, 8650, 8764, 273, 3677, 858, 1626, 18, 588, 12, 1615, 1769, 203, 5411, 368, 309, 333, 770, 353, 486, 4671, 2062, 316, 3677, 203, 5411, 309, 261, 5577, 382, 8650, 8764, 422, 446, 13, 288, 203, 7734, 3677, 382, 8650, 8764, 273, 394, 2407, 29667, 5621, 203, 7734, 3677, 382, 8650, 8764, 18, 1289, 12, 5053, 1769, 203, 7734, 3677, 858, 1626, 18, 458, 12, 1615, 16, 3677, 382, 8650, 8764, 1769, 203, 5411, 289, 282, 368, 309, 326, 460, 434, 326, 852, 364, 333, 770, 1552, 486, 912, 333, 2718, 203, 5411, 469, 309, 16051, 5577, 382, 8650, 8764, 18, 12298, 12, 5053, 3719, 288, 203, 7734, 3677, 382, 8650, 8764, 18, 1289, 12, 5053, 1769, 203, 5411, 289, 203, 3639, 289, 203, 3639, 987, 32, 8569, 1622, 34, 327, 682, 273, 394, 2407, 29667, 5621, 203, 3639, 3677, 858, 1626, 18, 1884, 3442, 12443, 712, 16, 3677, 13, 317, 288, 203, 5411, 509, 3286, 273, 261, 4522, 13, 1509, 411, 336, 6630, 951, 1626, 12, 1937, 1626, 13, 692, 12572, 18, 588, 5593, 1435, 397, 404, 294, 12572, 18, 588, 5593, 5621, 203, 5411, 24869, 1122, 1626, 19091, 273, 24869, 18, 792, 12, 6874, 16, 404, 16, 404, 16, 374, 16, 374, 16, 374, 16, 374, 16, 12572, 18, 588, 4226, 10663, 203, 5411, 24869, 787, 273, 336, 6630, 951, 1626, 12, 3645, 1626, 19091, 13, 422, 404, 692, 1122, 1626, 19091, 18, 10103, 6630, 87, 12443, 12, 4522, 13, 1509, 13, 300, 404, 13, 294, 1122, 1626, 19091, 18, 10103, 6630, 87, 12443, 4522, 13, 1509, 1769, 203, 5411, 22964, 1622, 666, 1046, 273, 394, 22964, 1622, 12, 2 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
[ 1, 26873, 203, 377, 380, 1021, 987, 434, 22964, 5400, 848, 912, 16975, 3222, 16, 1492, 4696, 716, 279, 729, 711, 2795, 3222, 316, 326, 1967, 4860, 18, 203, 377, 380, 1220, 707, 20670, 326, 924, 471, 1135, 279, 987, 32, 8569, 1622, 34, 2887, 16975, 3222, 18, 203, 377, 380, 203, 377, 380, 632, 891, 2695, 1299, 4300, 279, 666, 434, 3222, 203, 377, 380, 632, 891, 12572, 326, 12572, 434, 326, 3879, 203, 377, 380, 632, 2463, 279, 987, 32, 8569, 1622, 34, 4191, 1509, 471, 3844, 434, 2695, 3677, 316, 333, 3879, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
fee534bcf99d9ac9b67f559575f41bbe3061ff22
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/service/CourseService.java
[ "MIT" ]
Java
sortUserIntoWeeks
null
private Integer[] sortUserIntoWeeks(List<StatisticsEntry> outcome, ZonedDateTime startDate, int length) { Integer[] result = new Integer[length]; Arrays.fill(result, 0); for (StatisticsEntry map : outcome) { ZonedDateTime date = (ZonedDateTime) map.getDay(); int amount = Math.toIntExact(map.getAmount()); int dateWeek = getWeekOfDate(date); int startDateWeek = getWeekOfDate(startDate); int weeksDifference; weeksDifference = dateWeek < startDateWeek ? dateWeek == startDateWeek - 1 ? 0 : dateWeek + 53 - startDateWeek : dateWeek - startDateWeek; result[weeksDifference] += amount; } return result; }
/** * Gets a list of maps as parameter, each map describing an entry in the database. The map has the two keys "day" and "amount", * which map to the date and the amount of the findings. This Map-List is taken and converted into an Integer array, * containing the values for each point of the graph. In the course management overview, we want to display the last * 4 weeks, each week represented by one point in the graph. (Beginning with the current week.) In the course detail view, * we display 16 weeks at once. * * @param outcome A List<StatisticsEntry>, containing the content which should be refactored into an array * @param startDate the startDate * @param length the length of the chart which we want to fill. This can either be 4 for the course overview or 16 for the courde detail view * @return an array, containing the amount of active users. One entry corresponds to one week */
Gets a list of maps as parameter, each map describing an entry in the database. The map has the two keys "day" and "amount", which map to the date and the amount of the findings. This Map-List is taken and converted into an Integer array, containing the values for each point of the graph. In the course management overview, we want to display the last 4 weeks, each week represented by one point in the graph. (Beginning with the current week.) In the course detail view, we display 16 weeks at once. @param outcome A List, containing the content which should be refactored into an array @param startDate the startDate @param length the length of the chart which we want to fill. This can either be 4 for the course overview or 16 for the courde detail view @return an array, containing the amount of active users. One entry corresponds to one week
[ "Gets", "a", "list", "of", "maps", "as", "parameter", "each", "map", "describing", "an", "entry", "in", "the", "database", ".", "The", "map", "has", "the", "two", "keys", "\"", "day", "\"", "and", "\"", "amount", "\"", "which", "map", "to", "the", "date", "and", "the", "amount", "of", "the", "findings", ".", "This", "Map", "-", "List", "is", "taken", "and", "converted", "into", "an", "Integer", "array", "containing", "the", "values", "for", "each", "point", "of", "the", "graph", ".", "In", "the", "course", "management", "overview", "we", "want", "to", "display", "the", "last", "4", "weeks", "each", "week", "represented", "by", "one", "point", "in", "the", "graph", ".", "(", "Beginning", "with", "the", "current", "week", ".", ")", "In", "the", "course", "detail", "view", "we", "display", "16", "weeks", "at", "once", ".", "@param", "outcome", "A", "List", "containing", "the", "content", "which", "should", "be", "refactored", "into", "an", "array", "@param", "startDate", "the", "startDate", "@param", "length", "the", "length", "of", "the", "chart", "which", "we", "want", "to", "fill", ".", "This", "can", "either", "be", "4", "for", "the", "course", "overview", "or", "16", "for", "the", "courde", "detail", "view", "@return", "an", "array", "containing", "the", "amount", "of", "active", "users", ".", "One", "entry", "corresponds", "to", "one", "week" ]
private Integer[] sortUserIntoWeeks(List<StatisticsEntry> outcome, ZonedDateTime startDate, int length) { Integer[] result = new Integer[length]; Arrays.fill(result, 0); for (StatisticsEntry map : outcome) { ZonedDateTime date = (ZonedDateTime) map.getDay(); int amount = Math.toIntExact(map.getAmount()); int dateWeek = getWeekOfDate(date); int startDateWeek = getWeekOfDate(startDate); int weeksDifference; weeksDifference = dateWeek < startDateWeek ? dateWeek == startDateWeek - 1 ? 0 : dateWeek + 53 - startDateWeek : dateWeek - startDateWeek; result[weeksDifference] += amount; } return result; }
[ "private", "Integer", "[", "]", "sortUserIntoWeeks", "(", "List", "<", "StatisticsEntry", ">", "outcome", ",", "ZonedDateTime", "startDate", ",", "int", "length", ")", "{", "Integer", "[", "]", "result", "=", "new", "Integer", "[", "length", "]", ";", "Arrays", ".", "fill", "(", "result", ",", "0", ")", ";", "for", "(", "StatisticsEntry", "map", ":", "outcome", ")", "{", "ZonedDateTime", "date", "=", "(", "ZonedDateTime", ")", "map", ".", "getDay", "(", ")", ";", "int", "amount", "=", "Math", ".", "toIntExact", "(", "map", ".", "getAmount", "(", ")", ")", ";", "int", "dateWeek", "=", "getWeekOfDate", "(", "date", ")", ";", "int", "startDateWeek", "=", "getWeekOfDate", "(", "startDate", ")", ";", "int", "weeksDifference", ";", "weeksDifference", "=", "dateWeek", "<", "startDateWeek", "?", "dateWeek", "==", "startDateWeek", "-", "1", "?", "0", ":", "dateWeek", "+", "53", "-", "startDateWeek", ":", "dateWeek", "-", "startDateWeek", ";", "result", "[", "weeksDifference", "]", "+=", "amount", ";", "}", "return", "result", ";", "}" ]
Gets a list of maps as parameter, each map describing an entry in the database.
[ "Gets", "a", "list", "of", "maps", "as", "parameter", "each", "map", "describing", "an", "entry", "in", "the", "database", "." ]
[]
[ { "param": "outcome", "type": "List<StatisticsEntry>" }, { "param": "startDate", "type": "ZonedDateTime" }, { "param": "length", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "outcome", "type": "List<StatisticsEntry>", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "startDate", "type": "ZonedDateTime", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "length", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 3238, 2144, 8526, 1524, 1299, 5952, 6630, 87, 12, 682, 32, 8569, 1622, 34, 12884, 16, 24869, 12572, 16, 509, 769, 13, 288, 203, 3639, 2144, 8526, 563, 273, 394, 2144, 63, 2469, 15533, 203, 3639, 5647, 18, 5935, 12, 2088, 16, 374, 1769, 203, 3639, 364, 261, 8569, 1622, 852, 294, 12884, 13, 288, 203, 5411, 24869, 1509, 273, 261, 62, 20461, 13, 852, 18, 588, 4245, 5621, 203, 5411, 509, 3844, 273, 2361, 18, 869, 1702, 14332, 12, 1458, 18, 588, 6275, 10663, 203, 5411, 509, 1509, 6630, 273, 336, 6630, 951, 1626, 12, 712, 1769, 203, 5411, 509, 12572, 6630, 273, 336, 6630, 951, 1626, 12, 1937, 1626, 1769, 203, 5411, 509, 17314, 16220, 31, 203, 5411, 17314, 16220, 273, 1509, 6630, 411, 12572, 6630, 692, 1509, 6630, 422, 12572, 6630, 300, 404, 692, 374, 294, 1509, 6630, 397, 15935, 300, 12572, 6630, 294, 1509, 6630, 300, 12572, 6630, 31, 203, 5411, 563, 63, 10741, 87, 16220, 65, 1011, 3844, 31, 203, 3639, 289, 203, 3639, 327, 563, 31, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 11881, 279, 666, 434, 7565, 487, 1569, 16, 1517, 852, 16868, 392, 1241, 316, 326, 2063, 18, 1021, 852, 711, 326, 2795, 1311, 315, 2881, 6, 471, 315, 8949, 3113, 203, 377, 380, 1492, 852, 358, 326, 1509, 471, 326, 3844, 434, 326, 1104, 899, 18, 1220, 1635, 17, 682, 353, 9830, 471, 5970, 1368, 392, 2144, 526, 16, 203, 377, 380, 4191, 326, 924, 364, 1517, 1634, 434, 326, 2667, 18, 657, 326, 4362, 11803, 18471, 16, 732, 2545, 358, 2562, 326, 1142, 203, 377, 380, 1059, 17314, 16, 1517, 4860, 10584, 635, 1245, 1634, 316, 326, 2667, 18, 261, 8149, 2093, 598, 326, 783, 4860, 12998, 657, 326, 4362, 7664, 1476, 16, 203, 377, 380, 732, 2562, 2872, 17314, 622, 2 ]
fee534bcf99d9ac9b67f559575f41bbe3061ff22
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/service/CourseService.java
[ "MIT" ]
Java
archiveCourse
null
@Async public void archiveCourse(Course course) { SecurityUtils.setAuthorizationObject(); // Archiving a course is only possible after the course is over if (ZonedDateTime.now().isBefore(course.getEndDate())) { return; } // This contains possible errors encountered during the archive process ArrayList<String> exportErrors = new ArrayList<>(); groupNotificationService.notifyInstructorGroupAboutCourseArchiveState(course, NotificationType.COURSE_ARCHIVE_STARTED, exportErrors); try { // Create course archives directory if it doesn't exist Files.createDirectories(Path.of(courseArchivesDirPath)); log.info("Created the course archives directory at {} because it didn't exist.", courseArchivesDirPath); // Export the course to the archives directory. var archivedCoursePath = courseExamExportService.exportCourse(course, courseArchivesDirPath, exportErrors); // Attach the path to the archive to the course and save it in the database if (archivedCoursePath.isPresent()) { course.setCourseArchivePath(archivedCoursePath.get().getFileName().toString()); courseRepository.save(course); } else { groupNotificationService.notifyInstructorGroupAboutCourseArchiveState(course, NotificationType.COURSE_ARCHIVE_FAILED, exportErrors); return; } } catch (Exception e) { var error = "Failed to create course archives directory " + courseArchivesDirPath + ": " + e.getMessage(); exportErrors.add(error); log.info(error); } groupNotificationService.notifyInstructorGroupAboutCourseArchiveState(course, NotificationType.COURSE_ARCHIVE_FINISHED, exportErrors); }
/** * Archives the course by creating a zip file will student submissions for * both the course exercises and exams. * * @param course the course to archive */
Archives the course by creating a zip file will student submissions for both the course exercises and exams. @param course the course to archive
[ "Archives", "the", "course", "by", "creating", "a", "zip", "file", "will", "student", "submissions", "for", "both", "the", "course", "exercises", "and", "exams", ".", "@param", "course", "the", "course", "to", "archive" ]
@Async public void archiveCourse(Course course) { SecurityUtils.setAuthorizationObject(); if (ZonedDateTime.now().isBefore(course.getEndDate())) { return; } ArrayList<String> exportErrors = new ArrayList<>(); groupNotificationService.notifyInstructorGroupAboutCourseArchiveState(course, NotificationType.COURSE_ARCHIVE_STARTED, exportErrors); try { Files.createDirectories(Path.of(courseArchivesDirPath)); log.info("Created the course archives directory at {} because it didn't exist.", courseArchivesDirPath); var archivedCoursePath = courseExamExportService.exportCourse(course, courseArchivesDirPath, exportErrors); if (archivedCoursePath.isPresent()) { course.setCourseArchivePath(archivedCoursePath.get().getFileName().toString()); courseRepository.save(course); } else { groupNotificationService.notifyInstructorGroupAboutCourseArchiveState(course, NotificationType.COURSE_ARCHIVE_FAILED, exportErrors); return; } } catch (Exception e) { var error = "Failed to create course archives directory " + courseArchivesDirPath + ": " + e.getMessage(); exportErrors.add(error); log.info(error); } groupNotificationService.notifyInstructorGroupAboutCourseArchiveState(course, NotificationType.COURSE_ARCHIVE_FINISHED, exportErrors); }
[ "@", "Async", "public", "void", "archiveCourse", "(", "Course", "course", ")", "{", "SecurityUtils", ".", "setAuthorizationObject", "(", ")", ";", "if", "(", "ZonedDateTime", ".", "now", "(", ")", ".", "isBefore", "(", "course", ".", "getEndDate", "(", ")", ")", ")", "{", "return", ";", "}", "ArrayList", "<", "String", ">", "exportErrors", "=", "new", "ArrayList", "<", ">", "(", ")", ";", "groupNotificationService", ".", "notifyInstructorGroupAboutCourseArchiveState", "(", "course", ",", "NotificationType", ".", "COURSE_ARCHIVE_STARTED", ",", "exportErrors", ")", ";", "try", "{", "Files", ".", "createDirectories", "(", "Path", ".", "of", "(", "courseArchivesDirPath", ")", ")", ";", "log", ".", "info", "(", "\"Created the course archives directory at {} because it didn't exist.\"", ",", "courseArchivesDirPath", ")", ";", "var", "archivedCoursePath", "=", "courseExamExportService", ".", "exportCourse", "(", "course", ",", "courseArchivesDirPath", ",", "exportErrors", ")", ";", "if", "(", "archivedCoursePath", ".", "isPresent", "(", ")", ")", "{", "course", ".", "setCourseArchivePath", "(", "archivedCoursePath", ".", "get", "(", ")", ".", "getFileName", "(", ")", ".", "toString", "(", ")", ")", ";", "courseRepository", ".", "save", "(", "course", ")", ";", "}", "else", "{", "groupNotificationService", ".", "notifyInstructorGroupAboutCourseArchiveState", "(", "course", ",", "NotificationType", ".", "COURSE_ARCHIVE_FAILED", ",", "exportErrors", ")", ";", "return", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "var", "error", "=", "\"Failed to create course archives directory \"", "+", "courseArchivesDirPath", "+", "\": \"", "+", "e", ".", "getMessage", "(", ")", ";", "exportErrors", ".", "add", "(", "error", ")", ";", "log", ".", "info", "(", "error", ")", ";", "}", "groupNotificationService", ".", "notifyInstructorGroupAboutCourseArchiveState", "(", "course", ",", "NotificationType", ".", "COURSE_ARCHIVE_FINISHED", ",", "exportErrors", ")", ";", "}" ]
Archives the course by creating a zip file will student submissions for both the course exercises and exams.
[ "Archives", "the", "course", "by", "creating", "a", "zip", "file", "will", "student", "submissions", "for", "both", "the", "course", "exercises", "and", "exams", "." ]
[ "// Archiving a course is only possible after the course is over", "// This contains possible errors encountered during the archive process", "// Create course archives directory if it doesn't exist", "// Export the course to the archives directory.", "// Attach the path to the archive to the course and save it in the database" ]
[ { "param": "course", "type": "Course" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "course", "type": "Course", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 2771, 203, 565, 1071, 918, 5052, 39, 3117, 12, 39, 3117, 4362, 13, 288, 203, 3639, 6036, 1989, 18, 542, 6063, 921, 5621, 203, 203, 3639, 368, 16959, 9288, 279, 4362, 353, 1338, 3323, 1839, 326, 4362, 353, 1879, 203, 3639, 309, 261, 62, 20461, 18, 3338, 7675, 291, 4649, 12, 5566, 18, 588, 24640, 1435, 3719, 288, 203, 5411, 327, 31, 203, 3639, 289, 203, 203, 3639, 368, 1220, 1914, 3323, 1334, 9919, 4982, 326, 5052, 1207, 203, 3639, 2407, 32, 780, 34, 3359, 4229, 273, 394, 2407, 29667, 5621, 203, 203, 3639, 1041, 4386, 1179, 18, 12336, 382, 2732, 1114, 24813, 39, 3117, 7465, 1119, 12, 5566, 16, 8050, 559, 18, 3865, 23875, 67, 10586, 5354, 67, 20943, 6404, 16, 3359, 4229, 1769, 203, 203, 3639, 775, 288, 203, 5411, 368, 1788, 4362, 21997, 1867, 309, 518, 3302, 1404, 1005, 203, 5411, 6471, 18, 2640, 13071, 12, 743, 18, 792, 12, 5566, 12269, 3606, 20129, 10019, 203, 5411, 613, 18, 1376, 2932, 6119, 326, 4362, 21997, 1867, 622, 2618, 2724, 518, 10242, 1404, 1005, 1199, 16, 4362, 12269, 3606, 20129, 1769, 203, 203, 5411, 368, 11054, 326, 4362, 358, 326, 21997, 1867, 18, 203, 5411, 569, 23276, 39, 3117, 743, 273, 4362, 424, 301, 6144, 1179, 18, 6530, 39, 3117, 12, 5566, 16, 4362, 12269, 3606, 20129, 16, 3359, 4229, 1769, 203, 203, 5411, 368, 8659, 326, 589, 358, 326, 5052, 358, 326, 4362, 471, 1923, 518, 316, 326, 2063, 203, 5411, 309, 261, 991, 2950, 39, 3117, 743, 18, 291, 6351, 10756, 288, 203, 7734, 4362, 18, 542, 39, 3117, 7465, 743, 12, 991, 2950, 39, 3117, 743, 18, 588, 7675, 588, 4771, 7675, 10492, 10663, 203, 7734, 4362, 3305, 18, 5688, 12, 5566, 1769, 203, 5411, 289, 203, 5411, 469, 288, 203, 7734, 1041, 4386, 1179, 18, 12336, 382, 2732, 1114, 24813, 39, 3117, 7465, 1119, 12, 5566, 16, 8050, 559, 18, 3865, 23875, 67, 10586, 5354, 67, 11965, 16, 3359, 4229, 1769, 203, 7734, 327, 31, 203, 5411, 289, 203, 3639, 289, 203, 3639, 1044, 261, 503, 425, 13, 288, 203, 5411, 569, 555, 273, 315, 2925, 358, 752, 4362, 21997, 1867, 315, 397, 4362, 12269, 3606, 20129, 397, 6398, 315, 397, 425, 18, 24906, 5621, 203, 5411, 3359, 4229, 18, 1289, 12, 1636, 1769, 203, 5411, 613, 18, 1376, 12, 1636, 1769, 203, 3639, 289, 203, 203, 3639, 1041, 4386, 1179, 18, 12336, 382, 2732, 1114, 24813, 39, 3117, 7465, 1119, 12, 5566, 16, 8050, 559, 18, 3865, 23875, 67, 10586, 5354, 67, 23259, 2056, 16, 3359, 4229, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 16959, 3606, 326, 4362, 635, 4979, 279, 3144, 585, 903, 18110, 22071, 364, 203, 377, 380, 3937, 326, 4362, 431, 12610, 6141, 471, 19707, 87, 18, 203, 377, 380, 203, 377, 380, 632, 891, 4362, 326, 4362, 358, 5052, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
2267ce9672284063bfd19e82ba1d345b9b6fad30
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/service/metis/AnswerPostService.java
[ "MIT" ]
Java
createAnswerPost
AnswerPost
public AnswerPost createAnswerPost(Long courseId, AnswerPost answerPost) { final User user = this.userRepository.getUserWithGroupsAndAuthorities(); // check if (answerPost.getId() != null) { throw new BadRequestAlertException("A new answer post cannot already have an ID", METIS_ANSWER_POST_ENTITY_NAME, "idexists"); } preCheckUserAndCourse(user, courseId); Post post = postRepository.findByIdElseThrow(answerPost.getPost().getId()); // use post from database rather than user input answerPost.setPost(post); // set author to current user answerPost.setAuthor(user); // on creation of an answer post, we set the resolves_post field to false per default answerPost.setResolvesPost(false); AnswerPost savedAnswerPost = answerPostRepository.save(answerPost); sendNotification(savedAnswerPost); return savedAnswerPost; }
/** * Checks course, user and answer post and associated post validity, * determines the associated post, the answer post's author, * sets to approved if author is at least a tutor, * persists the answer post, and sends a notification to affected user groups * * @param courseId id of the course the answer post belongs to * @param answerPost answer post to create * @return created answer post that was persisted */
Checks course, user and answer post and associated post validity, determines the associated post, the answer post's author, sets to approved if author is at least a tutor, persists the answer post, and sends a notification to affected user groups @param courseId id of the course the answer post belongs to @param answerPost answer post to create @return created answer post that was persisted
[ "Checks", "course", "user", "and", "answer", "post", "and", "associated", "post", "validity", "determines", "the", "associated", "post", "the", "answer", "post", "'", "s", "author", "sets", "to", "approved", "if", "author", "is", "at", "least", "a", "tutor", "persists", "the", "answer", "post", "and", "sends", "a", "notification", "to", "affected", "user", "groups", "@param", "courseId", "id", "of", "the", "course", "the", "answer", "post", "belongs", "to", "@param", "answerPost", "answer", "post", "to", "create", "@return", "created", "answer", "post", "that", "was", "persisted" ]
public AnswerPost createAnswerPost(Long courseId, AnswerPost answerPost) { final User user = this.userRepository.getUserWithGroupsAndAuthorities(); if (answerPost.getId() != null) { throw new BadRequestAlertException("A new answer post cannot already have an ID", METIS_ANSWER_POST_ENTITY_NAME, "idexists"); } preCheckUserAndCourse(user, courseId); Post post = postRepository.findByIdElseThrow(answerPost.getPost().getId()); answerPost.setPost(post); answerPost.setAuthor(user); answerPost.setResolvesPost(false); AnswerPost savedAnswerPost = answerPostRepository.save(answerPost); sendNotification(savedAnswerPost); return savedAnswerPost; }
[ "public", "AnswerPost", "createAnswerPost", "(", "Long", "courseId", ",", "AnswerPost", "answerPost", ")", "{", "final", "User", "user", "=", "this", ".", "userRepository", ".", "getUserWithGroupsAndAuthorities", "(", ")", ";", "if", "(", "answerPost", ".", "getId", "(", ")", "!=", "null", ")", "{", "throw", "new", "BadRequestAlertException", "(", "\"A new answer post cannot already have an ID\"", ",", "METIS_ANSWER_POST_ENTITY_NAME", ",", "\"idexists\"", ")", ";", "}", "preCheckUserAndCourse", "(", "user", ",", "courseId", ")", ";", "Post", "post", "=", "postRepository", ".", "findByIdElseThrow", "(", "answerPost", ".", "getPost", "(", ")", ".", "getId", "(", ")", ")", ";", "answerPost", ".", "setPost", "(", "post", ")", ";", "answerPost", ".", "setAuthor", "(", "user", ")", ";", "answerPost", ".", "setResolvesPost", "(", "false", ")", ";", "AnswerPost", "savedAnswerPost", "=", "answerPostRepository", ".", "save", "(", "answerPost", ")", ";", "sendNotification", "(", "savedAnswerPost", ")", ";", "return", "savedAnswerPost", ";", "}" ]
Checks course, user and answer post and associated post validity, determines the associated post, the answer post's author, sets to approved if author is at least a tutor, persists the answer post, and sends a notification to affected user groups
[ "Checks", "course", "user", "and", "answer", "post", "and", "associated", "post", "validity", "determines", "the", "associated", "post", "the", "answer", "post", "'", "s", "author", "sets", "to", "approved", "if", "author", "is", "at", "least", "a", "tutor", "persists", "the", "answer", "post", "and", "sends", "a", "notification", "to", "affected", "user", "groups" ]
[ "// check", "// use post from database rather than user input", "// set author to current user", "// on creation of an answer post, we set the resolves_post field to false per default" ]
[ { "param": "courseId", "type": "Long" }, { "param": "answerPost", "type": "AnswerPost" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "courseId", "type": "Long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "answerPost", "type": "AnswerPost", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 21019, 3349, 752, 13203, 3349, 12, 3708, 4362, 548, 16, 21019, 3349, 5803, 3349, 13, 288, 203, 3639, 727, 2177, 729, 273, 333, 18, 1355, 3305, 18, 588, 1299, 1190, 3621, 1876, 3594, 1961, 5621, 203, 203, 3639, 368, 866, 203, 3639, 309, 261, 13490, 3349, 18, 26321, 1435, 480, 446, 13, 288, 203, 5411, 604, 394, 23223, 13298, 503, 2932, 37, 394, 5803, 1603, 2780, 1818, 1240, 392, 1599, 3113, 6791, 5127, 67, 11607, 18839, 67, 3798, 67, 11101, 67, 1985, 16, 315, 77, 561, 1486, 8863, 203, 3639, 289, 203, 3639, 675, 1564, 1299, 1876, 39, 3117, 12, 1355, 16, 4362, 548, 1769, 203, 3639, 5616, 1603, 273, 1603, 3305, 18, 4720, 5132, 12427, 8282, 12, 13490, 3349, 18, 588, 3349, 7675, 26321, 10663, 203, 203, 3639, 368, 999, 1603, 628, 2063, 9178, 2353, 729, 810, 203, 3639, 5803, 3349, 18, 542, 3349, 12, 2767, 1769, 203, 3639, 368, 444, 2869, 358, 783, 729, 203, 3639, 5803, 3349, 18, 542, 3594, 12, 1355, 1769, 203, 3639, 368, 603, 6710, 434, 392, 5803, 1603, 16, 732, 444, 326, 17385, 67, 2767, 652, 358, 629, 1534, 805, 203, 3639, 5803, 3349, 18, 542, 17453, 3349, 12, 5743, 1769, 203, 3639, 21019, 3349, 5198, 13203, 3349, 273, 5803, 3349, 3305, 18, 5688, 12, 13490, 3349, 1769, 203, 203, 3639, 1366, 4386, 12, 14077, 13203, 3349, 1769, 203, 203, 3639, 327, 5198, 13203, 3349, 31, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 1603, 471, 3627, 1603, 13800, 16, 203, 377, 380, 12949, 326, 3627, 1603, 16, 326, 5803, 1603, 1807, 2869, 16, 203, 377, 380, 1678, 358, 20412, 309, 2869, 353, 622, 4520, 279, 268, 3408, 16, 203, 377, 380, 13508, 1486, 326, 5803, 1603, 16, 471, 9573, 279, 3851, 358, 9844, 729, 3252, 203, 377, 380, 203, 377, 380, 632, 891, 4362, 548, 282, 612, 434, 326, 4362, 326, 5803, 1603, 11081, 358, 203, 377, 380, 632, 891, 5803, 3349, 5803, 1603, 358, 752, 203, 377, 380, 632, 2463, 2522, 5803, 1603, 716, 1703, 14249, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
2267ce9672284063bfd19e82ba1d345b9b6fad30
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/service/metis/AnswerPostService.java
[ "MIT" ]
Java
updateAnswerPost
AnswerPost
public AnswerPost updateAnswerPost(Long courseId, AnswerPost answerPost) { final User user = userRepository.getUserWithGroupsAndAuthorities(); // checks if (answerPost.getId() == null) { throw new BadRequestAlertException("Invalid id", METIS_ANSWER_POST_ENTITY_NAME, "idnull"); } AnswerPost existingAnswerPost = answerPostRepository.findByIdElseThrow(answerPost.getId()); Course course = preCheckUserAndCourse(user, courseId); AnswerPost updatedAnswerPost; // determine if the update operation is to mark the answer post as resolving the original post if (existingAnswerPost.doesResolvePost() != answerPost.doesResolvePost()) { // check if requesting user is allowed to mark this answer post as resolving, i.e. if user is author or original post or at least tutor mayMarkAnswerPostAsResolvingElseThrow(existingAnswerPost, user, course); existingAnswerPost.setResolvesPost(answerPost.doesResolvePost()); updatedAnswerPost = answerPostRepository.save(existingAnswerPost); } else { // check if requesting user is allowed to update the content, i.e. if user is author of answer post or at least tutor mayUpdateOrDeletePostingElseThrow(existingAnswerPost, user, course); existingAnswerPost.setContent(answerPost.getContent()); updatedAnswerPost = answerPostRepository.save(existingAnswerPost); } return updatedAnswerPost; }
/** * Checks course, user and associated post validity, * updates non-restricted field of the post, persists the post, * and ensures that sensitive information is filtered out * * @param courseId id of the course the answer post belongs to * @param answerPost answer post to update * @return updated answer post that was persisted */
Checks course, user and associated post validity, updates non-restricted field of the post, persists the post, and ensures that sensitive information is filtered out @param courseId id of the course the answer post belongs to @param answerPost answer post to update @return updated answer post that was persisted
[ "Checks", "course", "user", "and", "associated", "post", "validity", "updates", "non", "-", "restricted", "field", "of", "the", "post", "persists", "the", "post", "and", "ensures", "that", "sensitive", "information", "is", "filtered", "out", "@param", "courseId", "id", "of", "the", "course", "the", "answer", "post", "belongs", "to", "@param", "answerPost", "answer", "post", "to", "update", "@return", "updated", "answer", "post", "that", "was", "persisted" ]
public AnswerPost updateAnswerPost(Long courseId, AnswerPost answerPost) { final User user = userRepository.getUserWithGroupsAndAuthorities(); if (answerPost.getId() == null) { throw new BadRequestAlertException("Invalid id", METIS_ANSWER_POST_ENTITY_NAME, "idnull"); } AnswerPost existingAnswerPost = answerPostRepository.findByIdElseThrow(answerPost.getId()); Course course = preCheckUserAndCourse(user, courseId); AnswerPost updatedAnswerPost; if (existingAnswerPost.doesResolvePost() != answerPost.doesResolvePost()) { mayMarkAnswerPostAsResolvingElseThrow(existingAnswerPost, user, course); existingAnswerPost.setResolvesPost(answerPost.doesResolvePost()); updatedAnswerPost = answerPostRepository.save(existingAnswerPost); } else { mayUpdateOrDeletePostingElseThrow(existingAnswerPost, user, course); existingAnswerPost.setContent(answerPost.getContent()); updatedAnswerPost = answerPostRepository.save(existingAnswerPost); } return updatedAnswerPost; }
[ "public", "AnswerPost", "updateAnswerPost", "(", "Long", "courseId", ",", "AnswerPost", "answerPost", ")", "{", "final", "User", "user", "=", "userRepository", ".", "getUserWithGroupsAndAuthorities", "(", ")", ";", "if", "(", "answerPost", ".", "getId", "(", ")", "==", "null", ")", "{", "throw", "new", "BadRequestAlertException", "(", "\"Invalid id\"", ",", "METIS_ANSWER_POST_ENTITY_NAME", ",", "\"idnull\"", ")", ";", "}", "AnswerPost", "existingAnswerPost", "=", "answerPostRepository", ".", "findByIdElseThrow", "(", "answerPost", ".", "getId", "(", ")", ")", ";", "Course", "course", "=", "preCheckUserAndCourse", "(", "user", ",", "courseId", ")", ";", "AnswerPost", "updatedAnswerPost", ";", "if", "(", "existingAnswerPost", ".", "doesResolvePost", "(", ")", "!=", "answerPost", ".", "doesResolvePost", "(", ")", ")", "{", "mayMarkAnswerPostAsResolvingElseThrow", "(", "existingAnswerPost", ",", "user", ",", "course", ")", ";", "existingAnswerPost", ".", "setResolvesPost", "(", "answerPost", ".", "doesResolvePost", "(", ")", ")", ";", "updatedAnswerPost", "=", "answerPostRepository", ".", "save", "(", "existingAnswerPost", ")", ";", "}", "else", "{", "mayUpdateOrDeletePostingElseThrow", "(", "existingAnswerPost", ",", "user", ",", "course", ")", ";", "existingAnswerPost", ".", "setContent", "(", "answerPost", ".", "getContent", "(", ")", ")", ";", "updatedAnswerPost", "=", "answerPostRepository", ".", "save", "(", "existingAnswerPost", ")", ";", "}", "return", "updatedAnswerPost", ";", "}" ]
Checks course, user and associated post validity, updates non-restricted field of the post, persists the post, and ensures that sensitive information is filtered out
[ "Checks", "course", "user", "and", "associated", "post", "validity", "updates", "non", "-", "restricted", "field", "of", "the", "post", "persists", "the", "post", "and", "ensures", "that", "sensitive", "information", "is", "filtered", "out" ]
[ "// checks", "// determine if the update operation is to mark the answer post as resolving the original post", "// check if requesting user is allowed to mark this answer post as resolving, i.e. if user is author or original post or at least tutor", "// check if requesting user is allowed to update the content, i.e. if user is author of answer post or at least tutor" ]
[ { "param": "courseId", "type": "Long" }, { "param": "answerPost", "type": "AnswerPost" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "courseId", "type": "Long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "answerPost", "type": "AnswerPost", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 21019, 3349, 1089, 13203, 3349, 12, 3708, 4362, 548, 16, 21019, 3349, 5803, 3349, 13, 288, 203, 3639, 727, 2177, 729, 273, 729, 3305, 18, 588, 1299, 1190, 3621, 1876, 3594, 1961, 5621, 203, 203, 3639, 368, 4271, 203, 3639, 309, 261, 13490, 3349, 18, 26321, 1435, 422, 446, 13, 288, 203, 5411, 604, 394, 23223, 13298, 503, 2932, 1941, 612, 3113, 6791, 5127, 67, 11607, 18839, 67, 3798, 67, 11101, 67, 1985, 16, 315, 350, 2011, 8863, 203, 3639, 289, 203, 3639, 21019, 3349, 2062, 13203, 3349, 273, 5803, 3349, 3305, 18, 4720, 5132, 12427, 8282, 12, 13490, 3349, 18, 26321, 10663, 203, 3639, 385, 3117, 4362, 273, 675, 1564, 1299, 1876, 39, 3117, 12, 1355, 16, 4362, 548, 1769, 203, 203, 3639, 21019, 3349, 3526, 13203, 3349, 31, 203, 203, 3639, 368, 4199, 309, 326, 1089, 1674, 353, 358, 2267, 326, 5803, 1603, 487, 17188, 326, 2282, 1603, 203, 3639, 309, 261, 11711, 13203, 3349, 18, 20657, 8460, 3349, 1435, 480, 5803, 3349, 18, 20657, 8460, 3349, 10756, 288, 203, 5411, 368, 866, 309, 18709, 729, 353, 2935, 358, 2267, 333, 5803, 1603, 487, 17188, 16, 277, 18, 73, 18, 309, 729, 353, 2869, 578, 2282, 1603, 578, 622, 4520, 268, 3408, 203, 5411, 2026, 3882, 13203, 3349, 1463, 2903, 6282, 12427, 8282, 12, 11711, 13203, 3349, 16, 729, 16, 4362, 1769, 203, 5411, 2062, 13203, 3349, 18, 542, 17453, 3349, 12, 13490, 3349, 18, 20657, 8460, 3349, 10663, 203, 5411, 3526, 13203, 3349, 273, 5803, 3349, 3305, 18, 5688, 12, 11711, 13203, 3349, 1769, 203, 3639, 289, 203, 3639, 469, 288, 203, 5411, 368, 866, 309, 18709, 729, 353, 2935, 358, 1089, 326, 913, 16, 277, 18, 73, 18, 309, 729, 353, 2869, 434, 5803, 1603, 578, 622, 4520, 268, 3408, 203, 5411, 2026, 1891, 1162, 2613, 3349, 310, 12427, 8282, 12, 11711, 13203, 3349, 16, 729, 16, 4362, 1769, 203, 5411, 2062, 13203, 3349, 18, 542, 1350, 12, 13490, 3349, 18, 588, 1350, 10663, 203, 5411, 3526, 13203, 3349, 273, 5803, 3349, 3305, 18, 5688, 12, 11711, 13203, 3349, 1769, 203, 3639, 289, 203, 3639, 327, 3526, 13203, 3349, 31, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 13074, 4362, 16, 729, 471, 3627, 1603, 13800, 16, 203, 377, 380, 4533, 1661, 17, 29306, 652, 434, 326, 1603, 16, 13508, 1486, 326, 1603, 16, 203, 377, 380, 471, 11932, 716, 16692, 1779, 353, 5105, 596, 203, 377, 380, 203, 377, 380, 632, 891, 4362, 548, 282, 612, 434, 326, 4362, 326, 5803, 1603, 11081, 358, 203, 377, 380, 632, 891, 5803, 3349, 5803, 1603, 358, 1089, 203, 377, 380, 632, 2463, 3526, 5803, 1603, 716, 1703, 14249, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
2267ce9672284063bfd19e82ba1d345b9b6fad30
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/service/metis/AnswerPostService.java
[ "MIT" ]
Java
deleteAnswerPostById
null
public void deleteAnswerPostById(Long courseId, Long answerPostId) { final User user = userRepository.getUserWithGroupsAndAuthorities(); // checks final Course course = preCheckUserAndCourse(user, courseId); AnswerPost answerPost = answerPostRepository.findByIdElseThrow(answerPostId); mayUpdateOrDeletePostingElseThrow(answerPost, user, course); // delete answerPostRepository.deleteById(answerPostId); }
/** * Checks course and user validity, * determines authority to delete post and deletes the post * * @param courseId id of the course the answer post belongs to * @param answerPostId id of the answer post to delete */
Checks course and user validity, determines authority to delete post and deletes the post @param courseId id of the course the answer post belongs to @param answerPostId id of the answer post to delete
[ "Checks", "course", "and", "user", "validity", "determines", "authority", "to", "delete", "post", "and", "deletes", "the", "post", "@param", "courseId", "id", "of", "the", "course", "the", "answer", "post", "belongs", "to", "@param", "answerPostId", "id", "of", "the", "answer", "post", "to", "delete" ]
public void deleteAnswerPostById(Long courseId, Long answerPostId) { final User user = userRepository.getUserWithGroupsAndAuthorities(); final Course course = preCheckUserAndCourse(user, courseId); AnswerPost answerPost = answerPostRepository.findByIdElseThrow(answerPostId); mayUpdateOrDeletePostingElseThrow(answerPost, user, course); answerPostRepository.deleteById(answerPostId); }
[ "public", "void", "deleteAnswerPostById", "(", "Long", "courseId", ",", "Long", "answerPostId", ")", "{", "final", "User", "user", "=", "userRepository", ".", "getUserWithGroupsAndAuthorities", "(", ")", ";", "final", "Course", "course", "=", "preCheckUserAndCourse", "(", "user", ",", "courseId", ")", ";", "AnswerPost", "answerPost", "=", "answerPostRepository", ".", "findByIdElseThrow", "(", "answerPostId", ")", ";", "mayUpdateOrDeletePostingElseThrow", "(", "answerPost", ",", "user", ",", "course", ")", ";", "answerPostRepository", ".", "deleteById", "(", "answerPostId", ")", ";", "}" ]
Checks course and user validity, determines authority to delete post and deletes the post
[ "Checks", "course", "and", "user", "validity", "determines", "authority", "to", "delete", "post", "and", "deletes", "the", "post" ]
[ "// checks", "// delete" ]
[ { "param": "courseId", "type": "Long" }, { "param": "answerPostId", "type": "Long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "courseId", "type": "Long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "answerPostId", "type": "Long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 918, 1430, 13203, 3349, 5132, 12, 3708, 4362, 548, 16, 3407, 5803, 3349, 548, 13, 288, 203, 3639, 727, 2177, 729, 273, 729, 3305, 18, 588, 1299, 1190, 3621, 1876, 3594, 1961, 5621, 203, 203, 3639, 368, 4271, 203, 3639, 727, 385, 3117, 4362, 273, 675, 1564, 1299, 1876, 39, 3117, 12, 1355, 16, 4362, 548, 1769, 203, 3639, 21019, 3349, 5803, 3349, 273, 5803, 3349, 3305, 18, 4720, 5132, 12427, 8282, 12, 13490, 3349, 548, 1769, 203, 3639, 2026, 1891, 1162, 2613, 3349, 310, 12427, 8282, 12, 13490, 3349, 16, 729, 16, 4362, 1769, 203, 203, 3639, 368, 1430, 203, 3639, 5803, 3349, 3305, 18, 3733, 5132, 12, 13490, 3349, 548, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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891, 4362, 548, 377, 612, 434, 326, 4362, 326, 5803, 1603, 11081, 358, 203, 377, 380, 632, 891, 5803, 3349, 548, 612, 434, 326, 5803, 1603, 358, 1430, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
2267ce9672284063bfd19e82ba1d345b9b6fad30
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/service/metis/AnswerPostService.java
[ "MIT" ]
Java
sendNotification
null
void sendNotification(AnswerPost answerPost) { // notify via exercise if (answerPost.getPost().getExercise() != null) { Post post = answerPost.getPost(); // set exercise retrieved from database to show title in notification Exercise exercise = exerciseRepository.findByIdElseThrow(post.getExercise().getId()); post.setExercise(exercise); answerPost.setPost(post); groupNotificationService.notifyTutorAndEditorAndInstructorGroupAboutNewAnswerForExercise(answerPost); singleUserNotificationService.notifyUserAboutNewAnswerForExercise(answerPost); // protect Sample Solution, Grading Instructions, etc. answerPost.getPost().getExercise().filterSensitiveInformation(); } // notify via lecture if (answerPost.getPost().getLecture() != null) { Post post = answerPost.getPost(); // set lecture retrieved from database to show title in notification Lecture lecture = lectureRepository.findByIdElseThrow(post.getLecture().getId()); post.setLecture(lecture); answerPost.setPost(post); groupNotificationService.notifyTutorAndEditorAndInstructorGroupAboutNewAnswerForLecture(answerPost); singleUserNotificationService.notifyUserAboutNewAnswerForLecture(answerPost); } }
/** * Sends notification to affected groups * * @param answerPost answer post that triggered the notification */
Sends notification to affected groups @param answerPost answer post that triggered the notification
[ "Sends", "notification", "to", "affected", "groups", "@param", "answerPost", "answer", "post", "that", "triggered", "the", "notification" ]
void sendNotification(AnswerPost answerPost) { if (answerPost.getPost().getExercise() != null) { Post post = answerPost.getPost(); Exercise exercise = exerciseRepository.findByIdElseThrow(post.getExercise().getId()); post.setExercise(exercise); answerPost.setPost(post); groupNotificationService.notifyTutorAndEditorAndInstructorGroupAboutNewAnswerForExercise(answerPost); singleUserNotificationService.notifyUserAboutNewAnswerForExercise(answerPost); answerPost.getPost().getExercise().filterSensitiveInformation(); } if (answerPost.getPost().getLecture() != null) { Post post = answerPost.getPost(); Lecture lecture = lectureRepository.findByIdElseThrow(post.getLecture().getId()); post.setLecture(lecture); answerPost.setPost(post); groupNotificationService.notifyTutorAndEditorAndInstructorGroupAboutNewAnswerForLecture(answerPost); singleUserNotificationService.notifyUserAboutNewAnswerForLecture(answerPost); } }
[ "void", "sendNotification", "(", "AnswerPost", "answerPost", ")", "{", "if", "(", "answerPost", ".", "getPost", "(", ")", ".", "getExercise", "(", ")", "!=", "null", ")", "{", "Post", "post", "=", "answerPost", ".", "getPost", "(", ")", ";", "Exercise", "exercise", "=", "exerciseRepository", ".", "findByIdElseThrow", "(", "post", ".", "getExercise", "(", ")", ".", "getId", "(", ")", ")", ";", "post", ".", "setExercise", "(", "exercise", ")", ";", "answerPost", ".", "setPost", "(", "post", ")", ";", "groupNotificationService", ".", "notifyTutorAndEditorAndInstructorGroupAboutNewAnswerForExercise", "(", "answerPost", ")", ";", "singleUserNotificationService", ".", "notifyUserAboutNewAnswerForExercise", "(", "answerPost", ")", ";", "answerPost", ".", "getPost", "(", ")", ".", "getExercise", "(", ")", ".", "filterSensitiveInformation", "(", ")", ";", "}", "if", "(", "answerPost", ".", "getPost", "(", ")", ".", "getLecture", "(", ")", "!=", "null", ")", "{", "Post", "post", "=", "answerPost", ".", "getPost", "(", ")", ";", "Lecture", "lecture", "=", "lectureRepository", ".", "findByIdElseThrow", "(", "post", ".", "getLecture", "(", ")", ".", "getId", "(", ")", ")", ";", "post", ".", "setLecture", "(", "lecture", ")", ";", "answerPost", ".", "setPost", "(", "post", ")", ";", "groupNotificationService", ".", "notifyTutorAndEditorAndInstructorGroupAboutNewAnswerForLecture", "(", "answerPost", ")", ";", "singleUserNotificationService", ".", "notifyUserAboutNewAnswerForLecture", "(", "answerPost", ")", ";", "}", "}" ]
Sends notification to affected groups @param answerPost answer post that triggered the notification
[ "Sends", "notification", "to", "affected", "groups", "@param", "answerPost", "answer", "post", "that", "triggered", "the", "notification" ]
[ "// notify via exercise", "// set exercise retrieved from database to show title in notification", "// protect Sample Solution, Grading Instructions, etc.", "// notify via lecture", "// set lecture retrieved from database to show title in notification" ]
[ { "param": "answerPost", "type": "AnswerPost" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "answerPost", "type": "AnswerPost", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 918, 1366, 4386, 12, 13203, 3349, 5803, 3349, 13, 288, 203, 3639, 368, 5066, 3970, 24165, 203, 3639, 309, 261, 13490, 3349, 18, 588, 3349, 7675, 588, 424, 20603, 1435, 480, 446, 13, 288, 203, 5411, 5616, 1603, 273, 5803, 3349, 18, 588, 3349, 5621, 203, 5411, 368, 444, 24165, 10295, 628, 2063, 358, 2405, 2077, 316, 3851, 203, 5411, 1312, 20603, 24165, 273, 24165, 3305, 18, 4720, 5132, 12427, 8282, 12, 2767, 18, 588, 424, 20603, 7675, 26321, 10663, 203, 5411, 1603, 18, 542, 424, 20603, 12, 8913, 30708, 1769, 203, 5411, 5803, 3349, 18, 542, 3349, 12, 2767, 1769, 203, 5411, 1041, 4386, 1179, 18, 12336, 56, 3408, 1876, 6946, 1876, 382, 2732, 1114, 24813, 1908, 13203, 1290, 424, 20603, 12, 13490, 3349, 1769, 203, 5411, 2202, 1299, 4386, 1179, 18, 12336, 1299, 24813, 1908, 13203, 1290, 424, 20603, 12, 13490, 3349, 1769, 203, 203, 5411, 368, 17151, 11474, 29172, 16, 611, 6012, 310, 24605, 87, 16, 5527, 18, 203, 5411, 5803, 3349, 18, 588, 3349, 7675, 588, 424, 20603, 7675, 2188, 14220, 5369, 5621, 203, 3639, 289, 203, 3639, 368, 5066, 3970, 884, 299, 594, 203, 3639, 309, 261, 13490, 3349, 18, 588, 3349, 7675, 588, 48, 386, 594, 1435, 480, 446, 13, 288, 203, 5411, 5616, 1603, 273, 5803, 3349, 18, 588, 3349, 5621, 203, 5411, 368, 444, 884, 299, 594, 10295, 628, 2063, 358, 2405, 2077, 316, 3851, 203, 5411, 511, 386, 594, 884, 299, 594, 273, 884, 299, 594, 3305, 18, 4720, 5132, 12427, 8282, 12, 2767, 18, 588, 48, 386, 594, 7675, 26321, 10663, 203, 5411, 1603, 18, 542, 48, 386, 594, 12, 1582, 594, 1769, 203, 5411, 5803, 3349, 18, 542, 3349, 12, 2767, 1769, 203, 5411, 1041, 4386, 1179, 18, 12336, 56, 3408, 1876, 6946, 1876, 382, 2732, 1114, 24813, 1908, 13203, 1290, 48, 386, 594, 12, 13490, 3349, 1769, 203, 5411, 2202, 1299, 4386, 1179, 18, 12336, 1299, 24813, 1908, 13203, 1290, 48, 386, 594, 12, 13490, 3349, 1769, 203, 3639, 289, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 2479, 87, 3851, 358, 9844, 3252, 203, 377, 380, 203, 377, 380, 632, 891, 5803, 3349, 5803, 1603, 716, 10861, 326, 3851, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
ba9b92f7b79be1a257b83eef89c482b97ca6486b
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/service/GroupNotificationService.java
[ "MIT" ]
Java
saveAndSend
null
private void saveAndSend(GroupNotification notification) { if (NotificationTitleTypeConstants.LIVE_EXAM_EXERCISE_UPDATE_NOTIFICATION_TITLE.equals(notification.getTitle())) { saveExamNotification(notification); } else { groupNotificationRepository.save(notification); } messagingTemplate.convertAndSend(notification.getTopic(), notification); }
/** * Saves the given notification in database and sends it to the client via websocket. * * @param notification that should be saved and sent */
Saves the given notification in database and sends it to the client via websocket. @param notification that should be saved and sent
[ "Saves", "the", "given", "notification", "in", "database", "and", "sends", "it", "to", "the", "client", "via", "websocket", ".", "@param", "notification", "that", "should", "be", "saved", "and", "sent" ]
private void saveAndSend(GroupNotification notification) { if (NotificationTitleTypeConstants.LIVE_EXAM_EXERCISE_UPDATE_NOTIFICATION_TITLE.equals(notification.getTitle())) { saveExamNotification(notification); } else { groupNotificationRepository.save(notification); } messagingTemplate.convertAndSend(notification.getTopic(), notification); }
[ "private", "void", "saveAndSend", "(", "GroupNotification", "notification", ")", "{", "if", "(", "NotificationTitleTypeConstants", ".", "LIVE_EXAM_EXERCISE_UPDATE_NOTIFICATION_TITLE", ".", "equals", "(", "notification", ".", "getTitle", "(", ")", ")", ")", "{", "saveExamNotification", "(", "notification", ")", ";", "}", "else", "{", "groupNotificationRepository", ".", "save", "(", "notification", ")", ";", "}", "messagingTemplate", ".", "convertAndSend", "(", "notification", ".", "getTopic", "(", ")", ",", "notification", ")", ";", "}" ]
Saves the given notification in database and sends it to the client via websocket.
[ "Saves", "the", "given", "notification", "in", "database", "and", "sends", "it", "to", "the", "client", "via", "websocket", "." ]
[]
[ { "param": "notification", "type": "GroupNotification" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "notification", "type": "GroupNotification", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 3238, 918, 1923, 1876, 3826, 12, 1114, 4386, 3851, 13, 288, 203, 3639, 309, 261, 4386, 4247, 559, 2918, 18, 2053, 3412, 67, 2294, 2192, 67, 2294, 654, 7266, 1090, 67, 8217, 67, 4400, 14865, 67, 14123, 18, 14963, 12, 9927, 18, 588, 4247, 1435, 3719, 288, 203, 5411, 1923, 424, 301, 4386, 12, 9927, 1769, 203, 3639, 289, 203, 3639, 469, 288, 203, 5411, 1041, 4386, 3305, 18, 5688, 12, 9927, 1769, 203, 3639, 289, 203, 3639, 17301, 2283, 18, 6283, 1876, 3826, 12, 9927, 18, 588, 6657, 9334, 3851, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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203, 377, 380, 348, 6606, 326, 864, 3851, 316, 2063, 471, 9573, 518, 358, 326, 1004, 3970, 11537, 18, 203, 377, 380, 203, 377, 380, 632, 891, 3851, 716, 1410, 506, 5198, 471, 3271, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
594cc7d1552fab0068ab52f91a47ffbc55ebb0c9
ls1intum/Artemis
src/test/java/de/tum/in/www1/artemis/service/NotificationSettingsServiceTest.java
[ "MIT" ]
Java
testFindDeactivatedNotificationTypes
null
@Test public void testFindDeactivatedNotificationTypes() { NotificationSetting[] tmpNotificationSettingsArray = Arrays.copyOf(savedNotificationSettings, savedNotificationSettings.length); Set<NotificationSetting> tmpNotificationSettingsSet = new HashSet<>(Arrays.asList(tmpNotificationSettingsArray)); Set<NotificationType> resultingTypeSet = notificationSettingsService.findDeactivatedNotificationTypes(tmpNotificationSettingsSet); // SettingA : exercise-open-for-practice -> [EXERCISE_PRACTICE] : webapp deactivated // SettingB : attachment-changes -> [ATTACHMENT_CHANGE] : webapp activated <- not part of set // SettingC : course-and-exam-archiving-started -> [EXAM_ARCHIVE_STARTED, COURSE_ARCHIVE_STARTED] : webapp deactivated assertThat(resultingTypeSet).hasSize(3); assertThat(resultingTypeSet).contains(NotificationType.EXERCISE_PRACTICE); assertThat(resultingTypeSet).contains(NotificationType.EXAM_ARCHIVE_STARTED); assertThat(resultingTypeSet).contains(NotificationType.COURSE_ARCHIVE_STARTED); assertThat(resultingTypeSet).contains(NotificationType.COURSE_ARCHIVE_STARTED); assertThat(!resultingTypeSet.contains(NotificationType.ATTACHMENT_CHANGE)); }
/** * Tests the method findDeactivatedNotificationTypes * This test also tests the private methods convertNotificationSettingsToNotificationTypesWithActivationStatus * & convertNotificationSettingsToNotificationTypesWithActivationStatus */
Tests the method findDeactivatedNotificationTypes This test also tests the private methods convertNotificationSettingsToNotificationTypesWithActivationStatus & convertNotificationSettingsToNotificationTypesWithActivationStatus
[ "Tests", "the", "method", "findDeactivatedNotificationTypes", "This", "test", "also", "tests", "the", "private", "methods", "convertNotificationSettingsToNotificationTypesWithActivationStatus", "&", "convertNotificationSettingsToNotificationTypesWithActivationStatus" ]
@Test public void testFindDeactivatedNotificationTypes() { NotificationSetting[] tmpNotificationSettingsArray = Arrays.copyOf(savedNotificationSettings, savedNotificationSettings.length); Set<NotificationSetting> tmpNotificationSettingsSet = new HashSet<>(Arrays.asList(tmpNotificationSettingsArray)); Set<NotificationType> resultingTypeSet = notificationSettingsService.findDeactivatedNotificationTypes(tmpNotificationSettingsSet); assertThat(resultingTypeSet).hasSize(3); assertThat(resultingTypeSet).contains(NotificationType.EXERCISE_PRACTICE); assertThat(resultingTypeSet).contains(NotificationType.EXAM_ARCHIVE_STARTED); assertThat(resultingTypeSet).contains(NotificationType.COURSE_ARCHIVE_STARTED); assertThat(resultingTypeSet).contains(NotificationType.COURSE_ARCHIVE_STARTED); assertThat(!resultingTypeSet.contains(NotificationType.ATTACHMENT_CHANGE)); }
[ "@", "Test", "public", "void", "testFindDeactivatedNotificationTypes", "(", ")", "{", "NotificationSetting", "[", "]", "tmpNotificationSettingsArray", "=", "Arrays", ".", "copyOf", "(", "savedNotificationSettings", ",", "savedNotificationSettings", ".", "length", ")", ";", "Set", "<", "NotificationSetting", ">", "tmpNotificationSettingsSet", "=", "new", "HashSet", "<", ">", "(", "Arrays", ".", "asList", "(", "tmpNotificationSettingsArray", ")", ")", ";", "Set", "<", "NotificationType", ">", "resultingTypeSet", "=", "notificationSettingsService", ".", "findDeactivatedNotificationTypes", "(", "tmpNotificationSettingsSet", ")", ";", "assertThat", "(", "resultingTypeSet", ")", ".", "hasSize", "(", "3", ")", ";", "assertThat", "(", "resultingTypeSet", ")", ".", "contains", "(", "NotificationType", ".", "EXERCISE_PRACTICE", ")", ";", "assertThat", "(", "resultingTypeSet", ")", ".", "contains", "(", "NotificationType", ".", "EXAM_ARCHIVE_STARTED", ")", ";", "assertThat", "(", "resultingTypeSet", ")", ".", "contains", "(", "NotificationType", ".", "COURSE_ARCHIVE_STARTED", ")", ";", "assertThat", "(", "resultingTypeSet", ")", ".", "contains", "(", "NotificationType", ".", "COURSE_ARCHIVE_STARTED", ")", ";", "assertThat", "(", "!", "resultingTypeSet", ".", "contains", "(", "NotificationType", ".", "ATTACHMENT_CHANGE", ")", ")", ";", "}" ]
Tests the method findDeactivatedNotificationTypes This test also tests the private methods convertNotificationSettingsToNotificationTypesWithActivationStatus & convertNotificationSettingsToNotificationTypesWithActivationStatus
[ "Tests", "the", "method", "findDeactivatedNotificationTypes", "This", "test", "also", "tests", "the", "private", "methods", "convertNotificationSettingsToNotificationTypesWithActivationStatus", "&", "convertNotificationSettingsToNotificationTypesWithActivationStatus" ]
[ "// SettingA : exercise-open-for-practice -> [EXERCISE_PRACTICE] : webapp deactivated", "// SettingB : attachment-changes -> [ATTACHMENT_CHANGE] : webapp activated <- not part of set", "// SettingC : course-and-exam-archiving-started -> [EXAM_ARCHIVE_STARTED, COURSE_ARCHIVE_STARTED] : webapp deactivated" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 4709, 203, 565, 1071, 918, 1842, 3125, 758, 18836, 4386, 2016, 1435, 288, 203, 3639, 8050, 5568, 8526, 1853, 4386, 2628, 1076, 273, 5647, 18, 3530, 951, 12, 14077, 4386, 2628, 16, 5198, 4386, 2628, 18, 2469, 1769, 203, 3639, 1000, 32, 4386, 5568, 34, 1853, 4386, 2628, 694, 273, 394, 6847, 29667, 12, 12726, 18, 345, 682, 12, 5645, 4386, 2628, 1076, 10019, 203, 3639, 1000, 32, 4386, 559, 34, 8156, 559, 694, 273, 3851, 2628, 1179, 18, 4720, 758, 18836, 4386, 2016, 12, 5645, 4386, 2628, 694, 1769, 203, 3639, 368, 13274, 37, 294, 24165, 17, 3190, 17, 1884, 17, 84, 14266, 1812, 317, 306, 2294, 654, 7266, 1090, 67, 52, 2849, 1268, 11774, 65, 294, 28945, 443, 18836, 203, 3639, 368, 13274, 38, 294, 6042, 17, 6329, 317, 306, 789, 9833, 1792, 3212, 67, 14473, 65, 294, 28945, 14892, 3290, 486, 1087, 434, 444, 203, 3639, 368, 13274, 39, 294, 4362, 17, 464, 17, 338, 301, 17, 991, 9288, 17, 14561, 317, 306, 2294, 2192, 67, 10586, 5354, 67, 20943, 6404, 16, 7910, 23875, 67, 10586, 5354, 67, 20943, 6404, 65, 294, 28945, 443, 18836, 203, 3639, 1815, 18163, 12, 2088, 310, 559, 694, 2934, 5332, 1225, 12, 23, 1769, 203, 3639, 1815, 18163, 12, 2088, 310, 559, 694, 2934, 12298, 12, 4386, 559, 18, 2294, 654, 7266, 1090, 67, 52, 2849, 1268, 11774, 1769, 203, 3639, 1815, 18163, 12, 2088, 310, 559, 694, 2934, 12298, 12, 4386, 559, 18, 2294, 2192, 67, 10586, 5354, 67, 20943, 6404, 1769, 203, 3639, 1815, 18163, 12, 2088, 310, 559, 694, 2934, 12298, 12, 4386, 559, 18, 3865, 23875, 67, 10586, 5354, 67, 20943, 6404, 1769, 203, 3639, 1815, 18163, 12, 2088, 310, 559, 694, 2934, 12298, 12, 4386, 559, 18, 3865, 23875, 67, 10586, 5354, 67, 20943, 6404, 1769, 203, 3639, 1815, 18163, 12, 5, 2088, 310, 559, 694, 18, 12298, 12, 4386, 559, 18, 789, 9833, 1792, 3212, 67, 14473, 10019, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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836, 4386, 2016, 203, 377, 380, 1220, 1842, 2546, 7434, 326, 3238, 2590, 1765, 4386, 2628, 774, 4386, 2016, 1190, 14857, 1482, 203, 377, 380, 473, 1765, 4386, 2628, 774, 4386, 2016, 1190, 14857, 1482, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
002cf1595de93691cfa595b050b1c573f5934675
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/repository/ResultRepository.java
[ "MIT" ]
Java
countNumberOfAutomaticAssistedAssessmentsForExercise
DueDateStat
default DueDateStat countNumberOfAutomaticAssistedAssessmentsForExercise(Long exerciseId) { List<AssessmentType> automaticAssessmentTypes = asList(AssessmentType.AUTOMATIC, AssessmentType.SEMI_AUTOMATIC); return new DueDateStat(countNumberOfAssessmentsByTypeForExerciseBeforeDueDate(exerciseId, automaticAssessmentTypes), countNumberOfAssessmentsByTypeForExerciseAfterDueDate(exerciseId, automaticAssessmentTypes)); }
/** * Calculate the number of assessments which are either AUTOMATIC, SEMI_AUTOMATIC for a given exercise * * @param exerciseId the exercise we are interested in * @return number of assessments for the exercise */
Calculate the number of assessments which are either AUTOMATIC, SEMI_AUTOMATIC for a given exercise @param exerciseId the exercise we are interested in @return number of assessments for the exercise
[ "Calculate", "the", "number", "of", "assessments", "which", "are", "either", "AUTOMATIC", "SEMI_AUTOMATIC", "for", "a", "given", "exercise", "@param", "exerciseId", "the", "exercise", "we", "are", "interested", "in", "@return", "number", "of", "assessments", "for", "the", "exercise" ]
default DueDateStat countNumberOfAutomaticAssistedAssessmentsForExercise(Long exerciseId) { List<AssessmentType> automaticAssessmentTypes = asList(AssessmentType.AUTOMATIC, AssessmentType.SEMI_AUTOMATIC); return new DueDateStat(countNumberOfAssessmentsByTypeForExerciseBeforeDueDate(exerciseId, automaticAssessmentTypes), countNumberOfAssessmentsByTypeForExerciseAfterDueDate(exerciseId, automaticAssessmentTypes)); }
[ "default", "DueDateStat", "countNumberOfAutomaticAssistedAssessmentsForExercise", "(", "Long", "exerciseId", ")", "{", "List", "<", "AssessmentType", ">", "automaticAssessmentTypes", "=", "asList", "(", "AssessmentType", ".", "AUTOMATIC", ",", "AssessmentType", ".", "SEMI_AUTOMATIC", ")", ";", "return", "new", "DueDateStat", "(", "countNumberOfAssessmentsByTypeForExerciseBeforeDueDate", "(", "exerciseId", ",", "automaticAssessmentTypes", ")", ",", "countNumberOfAssessmentsByTypeForExerciseAfterDueDate", "(", "exerciseId", ",", "automaticAssessmentTypes", ")", ")", ";", "}" ]
Calculate the number of assessments which are either AUTOMATIC, SEMI_AUTOMATIC for a given exercise @param exerciseId the exercise we are interested in @return number of assessments for the exercise
[ "Calculate", "the", "number", "of", "assessments", "which", "are", "either", "AUTOMATIC", "SEMI_AUTOMATIC", "for", "a", "given", "exercise", "@param", "exerciseId", "the", "exercise", "we", "are", "interested", "in", "@return", "number", "of", "assessments", "for", "the", "exercise" ]
[]
[ { "param": "exerciseId", "type": "Long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "exerciseId", "type": "Long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 805, 463, 344, 1626, 5000, 1056, 9226, 7150, 4941, 2610, 25444, 2610, 403, 1346, 1290, 424, 20603, 12, 3708, 24165, 548, 13, 288, 203, 3639, 987, 32, 15209, 559, 34, 5859, 15209, 2016, 273, 8528, 12, 15209, 559, 18, 37, 1693, 1872, 11781, 16, 25241, 559, 18, 1090, 7492, 67, 37, 1693, 1872, 11781, 1769, 203, 3639, 327, 394, 463, 344, 1626, 5000, 12, 1883, 9226, 2610, 403, 1346, 14145, 1290, 424, 20603, 4649, 30023, 1626, 12, 8913, 30708, 548, 16, 5859, 15209, 2016, 3631, 203, 7734, 1056, 9226, 2610, 403, 1346, 14145, 1290, 424, 20603, 4436, 30023, 1626, 12, 8913, 30708, 548, 16, 5859, 15209, 2016, 10019, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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506, 316, 203, 377, 380, 632, 2463, 1300, 434, 1551, 403, 1346, 364, 326, 24165, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
002cf1595de93691cfa595b050b1c573f5934675
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/repository/ResultRepository.java
[ "MIT" ]
Java
submitResult
Result
default Result submitResult(Result result, Exercise exercise) { double maxPoints = exercise.getMaxPoints(); double bonusPoints = Optional.ofNullable(exercise.getBonusPoints()).orElse(0.0); // Exam results and manual results of programming exercises and example submissions are always to rated if (exercise.isExamExercise() || exercise instanceof ProgrammingExercise || (result.getSubmission().isExampleSubmission() != null && result.getSubmission().isExampleSubmission())) { result.setRated(true); } else { result.setRatedIfNotExceeded(exercise.getDueDate(), result.getSubmission().getSubmissionDate()); } result.setCompletionDate(ZonedDateTime.now()); // Take bonus points into account to achieve a result score > 100% double calculatedPoints = calculateTotalPoints(result.getFeedbacks()); double totalPoints = constrainToRange(calculatedPoints, maxPoints + bonusPoints); // Set score and resultString according to maxPoints, to establish results with score > 100% result.setScore(totalPoints, maxPoints, exercise.getCourseViaExerciseGroupOrCourseMember()); result.setResultString(totalPoints, maxPoints, exercise.getCourseViaExerciseGroupOrCourseMember()); // Workaround to prevent the assessor turning into a proxy object after saving var assessor = result.getAssessor(); result = save(result); result.setAssessor(assessor); return result; }
/** * submit the result means it is saved with a calculated score, result string and a completion date. * @param result the result which should be set to submitted * @param exercise the exercises to which the result belongs, which is needed to get points and to determine if the result is rated or not * @return the saved result */
submit the result means it is saved with a calculated score, result string and a completion date. @param result the result which should be set to submitted @param exercise the exercises to which the result belongs, which is needed to get points and to determine if the result is rated or not @return the saved result
[ "submit", "the", "result", "means", "it", "is", "saved", "with", "a", "calculated", "score", "result", "string", "and", "a", "completion", "date", ".", "@param", "result", "the", "result", "which", "should", "be", "set", "to", "submitted", "@param", "exercise", "the", "exercises", "to", "which", "the", "result", "belongs", "which", "is", "needed", "to", "get", "points", "and", "to", "determine", "if", "the", "result", "is", "rated", "or", "not", "@return", "the", "saved", "result" ]
default Result submitResult(Result result, Exercise exercise) { double maxPoints = exercise.getMaxPoints(); double bonusPoints = Optional.ofNullable(exercise.getBonusPoints()).orElse(0.0); if (exercise.isExamExercise() || exercise instanceof ProgrammingExercise || (result.getSubmission().isExampleSubmission() != null && result.getSubmission().isExampleSubmission())) { result.setRated(true); } else { result.setRatedIfNotExceeded(exercise.getDueDate(), result.getSubmission().getSubmissionDate()); } result.setCompletionDate(ZonedDateTime.now()); double calculatedPoints = calculateTotalPoints(result.getFeedbacks()); double totalPoints = constrainToRange(calculatedPoints, maxPoints + bonusPoints); result.setScore(totalPoints, maxPoints, exercise.getCourseViaExerciseGroupOrCourseMember()); result.setResultString(totalPoints, maxPoints, exercise.getCourseViaExerciseGroupOrCourseMember()); var assessor = result.getAssessor(); result = save(result); result.setAssessor(assessor); return result; }
[ "default", "Result", "submitResult", "(", "Result", "result", ",", "Exercise", "exercise", ")", "{", "double", "maxPoints", "=", "exercise", ".", "getMaxPoints", "(", ")", ";", "double", "bonusPoints", "=", "Optional", ".", "ofNullable", "(", "exercise", ".", "getBonusPoints", "(", ")", ")", ".", "orElse", "(", "0.0", ")", ";", "if", "(", "exercise", ".", "isExamExercise", "(", ")", "||", "exercise", "instanceof", "ProgrammingExercise", "||", "(", "result", ".", "getSubmission", "(", ")", ".", "isExampleSubmission", "(", ")", "!=", "null", "&&", "result", ".", "getSubmission", "(", ")", ".", "isExampleSubmission", "(", ")", ")", ")", "{", "result", ".", "setRated", "(", "true", ")", ";", "}", "else", "{", "result", ".", "setRatedIfNotExceeded", "(", "exercise", ".", "getDueDate", "(", ")", ",", "result", ".", "getSubmission", "(", ")", ".", "getSubmissionDate", "(", ")", ")", ";", "}", "result", ".", "setCompletionDate", "(", "ZonedDateTime", ".", "now", "(", ")", ")", ";", "double", "calculatedPoints", "=", "calculateTotalPoints", "(", "result", ".", "getFeedbacks", "(", ")", ")", ";", "double", "totalPoints", "=", "constrainToRange", "(", "calculatedPoints", ",", "maxPoints", "+", "bonusPoints", ")", ";", "result", ".", "setScore", "(", "totalPoints", ",", "maxPoints", ",", "exercise", ".", "getCourseViaExerciseGroupOrCourseMember", "(", ")", ")", ";", "result", ".", "setResultString", "(", "totalPoints", ",", "maxPoints", ",", "exercise", ".", "getCourseViaExerciseGroupOrCourseMember", "(", ")", ")", ";", "var", "assessor", "=", "result", ".", "getAssessor", "(", ")", ";", "result", "=", "save", "(", "result", ")", ";", "result", ".", "setAssessor", "(", "assessor", ")", ";", "return", "result", ";", "}" ]
submit the result means it is saved with a calculated score, result string and a completion date.
[ "submit", "the", "result", "means", "it", "is", "saved", "with", "a", "calculated", "score", "result", "string", "and", "a", "completion", "date", "." ]
[ "// Exam results and manual results of programming exercises and example submissions are always to rated", "// Take bonus points into account to achieve a result score > 100%", "// Set score and resultString according to maxPoints, to establish results with score > 100%", "// Workaround to prevent the assessor turning into a proxy object after saving" ]
[ { "param": "result", "type": "Result" }, { "param": "exercise", "type": "Exercise" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "result", "type": "Result", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "exercise", "type": "Exercise", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 805, 3438, 4879, 1253, 12, 1253, 563, 16, 1312, 20603, 24165, 13, 288, 203, 3639, 1645, 943, 5636, 273, 24165, 18, 588, 2747, 5636, 5621, 203, 3639, 1645, 324, 22889, 5636, 273, 4055, 18, 792, 13349, 12, 8913, 30708, 18, 588, 38, 22889, 5636, 1435, 2934, 280, 12427, 12, 20, 18, 20, 1769, 203, 203, 3639, 368, 1312, 301, 1686, 471, 11297, 1686, 434, 5402, 11987, 431, 12610, 6141, 471, 3454, 22071, 854, 3712, 358, 436, 690, 203, 3639, 309, 261, 8913, 30708, 18, 291, 424, 301, 424, 20603, 1435, 747, 24165, 1276, 13586, 11987, 424, 20603, 203, 7734, 747, 261, 2088, 18, 588, 17865, 7675, 291, 10908, 17865, 1435, 480, 446, 597, 563, 18, 588, 17865, 7675, 291, 10908, 17865, 1435, 3719, 288, 203, 5411, 563, 18, 542, 54, 690, 12, 3767, 1769, 203, 3639, 289, 203, 3639, 469, 288, 203, 5411, 563, 18, 542, 54, 690, 10288, 10069, 12, 8913, 30708, 18, 588, 30023, 1626, 9334, 563, 18, 588, 17865, 7675, 588, 17865, 1626, 10663, 203, 3639, 289, 203, 203, 3639, 563, 18, 542, 11238, 1626, 12, 62, 20461, 18, 3338, 10663, 203, 3639, 368, 17129, 324, 22889, 3143, 1368, 2236, 358, 20186, 537, 279, 563, 4462, 405, 2130, 9, 203, 3639, 1645, 8894, 5636, 273, 4604, 5269, 5636, 12, 2088, 18, 588, 15888, 87, 10663, 203, 3639, 1645, 2078, 5636, 273, 30593, 774, 2655, 12, 22113, 5636, 16, 943, 5636, 397, 324, 22889, 5636, 1769, 203, 3639, 368, 1000, 4462, 471, 563, 780, 4888, 358, 943, 5636, 16, 358, 18312, 1686, 598, 4462, 405, 2130, 9, 203, 3639, 563, 18, 542, 7295, 12, 4963, 5636, 16, 943, 5636, 16, 24165, 18, 588, 39, 3117, 21246, 424, 20603, 1114, 1162, 39, 3117, 4419, 10663, 203, 3639, 563, 18, 542, 1253, 780, 12, 4963, 5636, 16, 943, 5636, 16, 24165, 18, 588, 39, 3117, 21246, 424, 20603, 1114, 1162, 39, 3117, 4419, 10663, 203, 203, 3639, 368, 4147, 12716, 358, 5309, 326, 1551, 403, 280, 7005, 310, 1368, 279, 2889, 733, 1839, 12392, 203, 3639, 569, 1551, 403, 280, 273, 563, 18, 588, 2610, 403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, 377, 380, 4879, 326, 563, 4696, 518, 353, 5198, 598, 279, 8894, 4462, 16, 563, 533, 471, 279, 8364, 1509, 18, 203, 377, 380, 632, 891, 563, 326, 563, 1492, 1410, 506, 444, 358, 9638, 203, 377, 380, 632, 891, 24165, 326, 431, 12610, 6141, 358, 1492, 326, 563, 11081, 16, 1492, 353, 3577, 358, 336, 3143, 471, 358, 4199, 309, 326, 563, 353, 436, 690, 578, 486, 203, 377, 380, 632, 2463, 326, 5198, 563, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
bcc0a7c3c17fb6ad3f94a4c80f1fccee3fdebf55
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/web/rest/FileUploadExerciseResource.java
[ "MIT" ]
Java
createFileUploadExercise
null
@PostMapping("/file-upload-exercises") @PreAuthorize("hasRole('EDITOR')") public ResponseEntity<FileUploadExercise> createFileUploadExercise(@RequestBody FileUploadExercise fileUploadExercise) throws URISyntaxException { log.debug("REST request to save FileUploadExercise : {}", fileUploadExercise); if (fileUploadExercise.getId() != null) { return ResponseEntity.badRequest().headers(HeaderUtil.createAlert(applicationName, "A new fileUploadExercise cannot already have an ID", "idexists")).body(null); } // validates general settings: points, dates exerciseService.validateGeneralSettings(fileUploadExercise); // Validate the new file upload exercise validateNewOrUpdatedFileUploadExercise(fileUploadExercise); // Retrieve the course over the exerciseGroup or the given courseId Course course = courseService.retrieveCourseOverExerciseGroupOrCourseId(fileUploadExercise); // Check that the user is authorized to create the exercise User user = userRepository.getUserWithGroupsAndAuthorities(); if (!authCheckService.isAtLeastEditorInCourse(course, user)) { return forbidden(); } FileUploadExercise result = fileUploadExerciseRepository.save(fileUploadExercise); // Only notify students and tutors when the exercise is created for a course if (fileUploadExercise.isCourseExercise()) { instanceMessageSendService.sendExerciseReleaseNotificationSchedule(fileUploadExercise.getId()); } return ResponseEntity.created(new URI("/api/file-upload-exercises/" + result.getId())) .headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString())).body(result); }
/** * POST /file-upload-exercises : Create a new fileUploadExercise. * * @param fileUploadExercise the fileUploadExercise to create * @return the ResponseEntity with status 201 (Created) and with body the new fileUploadExercise, or with status 400 (Bad Request) if the fileUploadExercise has already an ID * @throws URISyntaxException if the Location URI syntax is incorrect */
POST /file-upload-exercises : Create a new fileUploadExercise. @param fileUploadExercise the fileUploadExercise to create @return the ResponseEntity with status 201 (Created) and with body the new fileUploadExercise, or with status 400 (Bad Request) if the fileUploadExercise has already an ID @throws URISyntaxException if the Location URI syntax is incorrect
[ "POST", "/", "file", "-", "upload", "-", "exercises", ":", "Create", "a", "new", "fileUploadExercise", ".", "@param", "fileUploadExercise", "the", "fileUploadExercise", "to", "create", "@return", "the", "ResponseEntity", "with", "status", "201", "(", "Created", ")", "and", "with", "body", "the", "new", "fileUploadExercise", "or", "with", "status", "400", "(", "Bad", "Request", ")", "if", "the", "fileUploadExercise", "has", "already", "an", "ID", "@throws", "URISyntaxException", "if", "the", "Location", "URI", "syntax", "is", "incorrect" ]
@PostMapping("/file-upload-exercises") @PreAuthorize("hasRole('EDITOR')") public ResponseEntity<FileUploadExercise> createFileUploadExercise(@RequestBody FileUploadExercise fileUploadExercise) throws URISyntaxException { log.debug("REST request to save FileUploadExercise : {}", fileUploadExercise); if (fileUploadExercise.getId() != null) { return ResponseEntity.badRequest().headers(HeaderUtil.createAlert(applicationName, "A new fileUploadExercise cannot already have an ID", "idexists")).body(null); } exerciseService.validateGeneralSettings(fileUploadExercise); validateNewOrUpdatedFileUploadExercise(fileUploadExercise); Course course = courseService.retrieveCourseOverExerciseGroupOrCourseId(fileUploadExercise); User user = userRepository.getUserWithGroupsAndAuthorities(); if (!authCheckService.isAtLeastEditorInCourse(course, user)) { return forbidden(); } FileUploadExercise result = fileUploadExerciseRepository.save(fileUploadExercise); if (fileUploadExercise.isCourseExercise()) { instanceMessageSendService.sendExerciseReleaseNotificationSchedule(fileUploadExercise.getId()); } return ResponseEntity.created(new URI("/api/file-upload-exercises/" + result.getId())) .headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString())).body(result); }
[ "@", "PostMapping", "(", "\"/file-upload-exercises\"", ")", "@", "PreAuthorize", "(", "\"hasRole('EDITOR')\"", ")", "public", "ResponseEntity", "<", "FileUploadExercise", ">", "createFileUploadExercise", "(", "@", "RequestBody", "FileUploadExercise", "fileUploadExercise", ")", "throws", "URISyntaxException", "{", "log", ".", "debug", "(", "\"REST request to save FileUploadExercise : {}\"", ",", "fileUploadExercise", ")", ";", "if", "(", "fileUploadExercise", ".", "getId", "(", ")", "!=", "null", ")", "{", "return", "ResponseEntity", ".", "badRequest", "(", ")", ".", "headers", "(", "HeaderUtil", ".", "createAlert", "(", "applicationName", ",", "\"A new fileUploadExercise cannot already have an ID\"", ",", "\"idexists\"", ")", ")", ".", "body", "(", "null", ")", ";", "}", "exerciseService", ".", "validateGeneralSettings", "(", "fileUploadExercise", ")", ";", "validateNewOrUpdatedFileUploadExercise", "(", "fileUploadExercise", ")", ";", "Course", "course", "=", "courseService", ".", "retrieveCourseOverExerciseGroupOrCourseId", "(", "fileUploadExercise", ")", ";", "User", "user", "=", "userRepository", ".", "getUserWithGroupsAndAuthorities", "(", ")", ";", "if", "(", "!", "authCheckService", ".", "isAtLeastEditorInCourse", "(", "course", ",", "user", ")", ")", "{", "return", "forbidden", "(", ")", ";", "}", "FileUploadExercise", "result", "=", "fileUploadExerciseRepository", ".", "save", "(", "fileUploadExercise", ")", ";", "if", "(", "fileUploadExercise", ".", "isCourseExercise", "(", ")", ")", "{", "instanceMessageSendService", ".", "sendExerciseReleaseNotificationSchedule", "(", "fileUploadExercise", ".", "getId", "(", ")", ")", ";", "}", "return", "ResponseEntity", ".", "created", "(", "new", "URI", "(", "\"/api/file-upload-exercises/\"", "+", "result", ".", "getId", "(", ")", ")", ")", ".", "headers", "(", "HeaderUtil", ".", "createEntityCreationAlert", "(", "applicationName", ",", "true", ",", "ENTITY_NAME", ",", "result", ".", "getId", "(", ")", ".", "toString", "(", ")", ")", ")", ".", "body", "(", "result", ")", ";", "}" ]
POST /file-upload-exercises : Create a new fileUploadExercise.
[ "POST", "/", "file", "-", "upload", "-", "exercises", ":", "Create", "a", "new", "fileUploadExercise", "." ]
[ "// validates general settings: points, dates", "// Validate the new file upload exercise", "// Retrieve the course over the exerciseGroup or the given courseId", "// Check that the user is authorized to create the exercise", "// Only notify students and tutors when the exercise is created for a course" ]
[ { "param": "fileUploadExercise", "type": "FileUploadExercise" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "fileUploadExercise", "type": "FileUploadExercise", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 3349, 3233, 2932, 19, 768, 17, 6327, 17, 8913, 71, 6141, 7923, 203, 565, 632, 1386, 18987, 2932, 5332, 2996, 2668, 13208, 23291, 13, 203, 565, 1071, 2306, 1943, 32, 812, 4777, 424, 20603, 34, 21266, 4777, 424, 20603, 26964, 28843, 1387, 4777, 424, 20603, 585, 4777, 424, 20603, 13, 1216, 19883, 288, 203, 3639, 613, 18, 4148, 2932, 12030, 590, 358, 1923, 1387, 4777, 424, 20603, 294, 3728, 16, 585, 4777, 424, 20603, 1769, 203, 3639, 309, 261, 768, 4777, 424, 20603, 18, 26321, 1435, 480, 446, 13, 288, 203, 5411, 327, 2306, 1943, 18, 8759, 691, 7675, 2485, 12, 1864, 1304, 18, 2640, 13298, 12, 3685, 461, 16, 315, 37, 394, 585, 4777, 424, 20603, 2780, 1818, 1240, 392, 1599, 3113, 315, 77, 561, 1486, 7923, 2934, 3432, 12, 2011, 1769, 203, 3639, 289, 203, 203, 3639, 368, 11964, 7470, 1947, 30, 3143, 16, 7811, 203, 3639, 24165, 1179, 18, 5662, 12580, 2628, 12, 768, 4777, 424, 20603, 1769, 203, 203, 3639, 368, 3554, 326, 394, 585, 3617, 24165, 203, 3639, 1954, 1908, 1162, 7381, 812, 4777, 424, 20603, 12, 768, 4777, 424, 20603, 1769, 203, 203, 3639, 368, 10708, 326, 4362, 1879, 326, 24165, 1114, 578, 326, 864, 4362, 548, 203, 3639, 385, 3117, 4362, 273, 4362, 1179, 18, 17466, 39, 3117, 4851, 424, 20603, 1114, 1162, 39, 3117, 548, 12, 768, 4777, 424, 20603, 1769, 203, 203, 3639, 368, 2073, 716, 326, 729, 353, 10799, 358, 752, 326, 24165, 203, 3639, 2177, 729, 273, 729, 3305, 18, 588, 1299, 1190, 3621, 1876, 3594, 1961, 5621, 203, 3639, 309, 16051, 1944, 1564, 1179, 18, 291, 25070, 6946, 382, 39, 3117, 12, 5566, 16, 729, 3719, 288, 203, 5411, 327, 17987, 5621, 203, 3639, 289, 203, 203, 3639, 1387, 4777, 424, 20603, 563, 273, 585, 4777, 424, 20603, 3305, 18, 5688, 12, 768, 4777, 424, 20603, 1769, 203, 203, 3639, 368, 5098, 5066, 10068, 4877, 471, 268, 13595, 1347, 326, 24165, 353, 2522, 364, 279, 4362, 203, 3639, 309, 261, 768, 4777, 424, 20603, 18, 291, 39, 3117, 424, 20603, 10756, 288, 203, 5411, 791, 1079, 3826, 1179, 18, 4661, 424, 20603, 7391, 4386, 6061, 12, 768, 4777, 424, 20603, 18, 26321, 10663, 203, 3639, 289, 203, 3639, 327, 2306, 1943, 18, 4824, 12, 2704, 3699, 2932, 19, 2425, 19, 768, 17, 6327, 17, 8913, 71, 6141, 4898, 397, 563, 18, 26321, 1435, 3719, 203, 7734, 263, 2485, 12, 1864, 1304, 18, 2640, 1943, 9906, 13298, 12, 3685, 461, 16, 638, 16, 17020, 67, 1985, 16, 563, 18, 26321, 7675, 10492, 10756, 2934, 3432, 12, 2088, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 5485, 342, 768, 17, 6327, 17, 8913, 71, 6141, 294, 1788, 279, 394, 585, 4777, 424, 20603, 18, 203, 377, 380, 203, 377, 380, 632, 891, 585, 4777, 424, 20603, 326, 585, 4777, 424, 20603, 358, 752, 203, 377, 380, 632, 2463, 326, 2306, 1943, 598, 1267, 3786, 261, 6119, 13, 471, 598, 1417, 326, 394, 585, 4777, 424, 20603, 16, 578, 598, 1267, 7409, 261, 6434, 1567, 13, 309, 326, 585, 4777, 424, 20603, 711, 1818, 392, 1599, 203, 377, 380, 632, 15069, 19883, 309, 326, 7050, 3699, 6279, 353, 11332, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
bcc0a7c3c17fb6ad3f94a4c80f1fccee3fdebf55
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/web/rest/FileUploadExerciseResource.java
[ "MIT" ]
Java
updateFileUploadExercise
null
@PutMapping("/file-upload-exercises/{exerciseId}") @PreAuthorize("hasRole('EDITOR')") public ResponseEntity<FileUploadExercise> updateFileUploadExercise(@RequestBody FileUploadExercise fileUploadExercise, @RequestParam(value = "notificationText", required = false) String notificationText, @PathVariable Long exerciseId) { log.debug("REST request to update FileUploadExercise : {}", fileUploadExercise); // TODO: The route has an exerciseId but we don't do anything useful with it. Change route and client requests? // Validate the updated file upload exercise validateNewOrUpdatedFileUploadExercise(fileUploadExercise); // validates general settings: points, dates exerciseService.validateGeneralSettings(fileUploadExercise); // Retrieve the course over the exerciseGroup or the given courseId Course course = courseService.retrieveCourseOverExerciseGroupOrCourseId(fileUploadExercise); // Check that the user is authorized to update the exercise User user = userRepository.getUserWithGroupsAndAuthorities(); if (!authCheckService.isAtLeastEditorInCourse(course, user)) { return forbidden(); } FileUploadExercise fileUploadExerciseBeforeUpdate = fileUploadExerciseRepository.findOneByIdElseThrow(fileUploadExercise.getId()); // Forbid conversion between normal course exercise and exam exercise exerciseService.checkForConversionBetweenExamAndCourseExercise(fileUploadExercise, fileUploadExerciseBeforeUpdate, ENTITY_NAME); FileUploadExercise updatedExercise = fileUploadExerciseRepository.save(fileUploadExercise); exerciseService.logUpdate(updatedExercise, updatedExercise.getCourseViaExerciseGroupOrCourseMember(), user); exerciseService.updatePointsInRelatedParticipantScores(fileUploadExerciseBeforeUpdate, updatedExercise); if ((notificationText != null && fileUploadExercise.isCourseExercise()) || fileUploadExercise.isExamExercise()) { groupNotificationService.notifyStudentAndEditorAndInstructorGroupAboutExerciseUpdate(fileUploadExercise, notificationText); } return ResponseEntity.ok().headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, exerciseId.toString())).body(updatedExercise); }
/** * PUT /file-upload-exercises : Updates an existing fileUploadExercise. * * @param fileUploadExercise the fileUploadExercise to update * @param notificationText the text shown to students * @param exerciseId the id of exercise * @return the ResponseEntity with status 200 (OK) and with body the updated fileUploadExercise, or with status 400 (Bad Request) if the fileUploadExercise is not valid, or * with status 500 (Internal Server Error) if the fileUploadExercise couldn't be updated */
PUT /file-upload-exercises : Updates an existing fileUploadExercise. @param fileUploadExercise the fileUploadExercise to update @param notificationText the text shown to students @param exerciseId the id of exercise @return the ResponseEntity with status 200 (OK) and with body the updated fileUploadExercise, or with status 400 (Bad Request) if the fileUploadExercise is not valid, or with status 500 (Internal Server Error) if the fileUploadExercise couldn't be updated
[ "PUT", "/", "file", "-", "upload", "-", "exercises", ":", "Updates", "an", "existing", "fileUploadExercise", ".", "@param", "fileUploadExercise", "the", "fileUploadExercise", "to", "update", "@param", "notificationText", "the", "text", "shown", "to", "students", "@param", "exerciseId", "the", "id", "of", "exercise", "@return", "the", "ResponseEntity", "with", "status", "200", "(", "OK", ")", "and", "with", "body", "the", "updated", "fileUploadExercise", "or", "with", "status", "400", "(", "Bad", "Request", ")", "if", "the", "fileUploadExercise", "is", "not", "valid", "or", "with", "status", "500", "(", "Internal", "Server", "Error", ")", "if", "the", "fileUploadExercise", "couldn", "'", "t", "be", "updated" ]
@PutMapping("/file-upload-exercises/{exerciseId}") @PreAuthorize("hasRole('EDITOR')") public ResponseEntity<FileUploadExercise> updateFileUploadExercise(@RequestBody FileUploadExercise fileUploadExercise, @RequestParam(value = "notificationText", required = false) String notificationText, @PathVariable Long exerciseId) { log.debug("REST request to update FileUploadExercise : {}", fileUploadExercise); validateNewOrUpdatedFileUploadExercise(fileUploadExercise); exerciseService.validateGeneralSettings(fileUploadExercise); Course course = courseService.retrieveCourseOverExerciseGroupOrCourseId(fileUploadExercise); User user = userRepository.getUserWithGroupsAndAuthorities(); if (!authCheckService.isAtLeastEditorInCourse(course, user)) { return forbidden(); } FileUploadExercise fileUploadExerciseBeforeUpdate = fileUploadExerciseRepository.findOneByIdElseThrow(fileUploadExercise.getId()); exerciseService.checkForConversionBetweenExamAndCourseExercise(fileUploadExercise, fileUploadExerciseBeforeUpdate, ENTITY_NAME); FileUploadExercise updatedExercise = fileUploadExerciseRepository.save(fileUploadExercise); exerciseService.logUpdate(updatedExercise, updatedExercise.getCourseViaExerciseGroupOrCourseMember(), user); exerciseService.updatePointsInRelatedParticipantScores(fileUploadExerciseBeforeUpdate, updatedExercise); if ((notificationText != null && fileUploadExercise.isCourseExercise()) || fileUploadExercise.isExamExercise()) { groupNotificationService.notifyStudentAndEditorAndInstructorGroupAboutExerciseUpdate(fileUploadExercise, notificationText); } return ResponseEntity.ok().headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, exerciseId.toString())).body(updatedExercise); }
[ "@", "PutMapping", "(", "\"/file-upload-exercises/{exerciseId}\"", ")", "@", "PreAuthorize", "(", "\"hasRole('EDITOR')\"", ")", "public", "ResponseEntity", "<", "FileUploadExercise", ">", "updateFileUploadExercise", "(", "@", "RequestBody", "FileUploadExercise", "fileUploadExercise", ",", "@", "RequestParam", "(", "value", "=", "\"notificationText\"", ",", "required", "=", "false", ")", "String", "notificationText", ",", "@", "PathVariable", "Long", "exerciseId", ")", "{", "log", ".", "debug", "(", "\"REST request to update FileUploadExercise : {}\"", ",", "fileUploadExercise", ")", ";", "validateNewOrUpdatedFileUploadExercise", "(", "fileUploadExercise", ")", ";", "exerciseService", ".", "validateGeneralSettings", "(", "fileUploadExercise", ")", ";", "Course", "course", "=", "courseService", ".", "retrieveCourseOverExerciseGroupOrCourseId", "(", "fileUploadExercise", ")", ";", "User", "user", "=", "userRepository", ".", "getUserWithGroupsAndAuthorities", "(", ")", ";", "if", "(", "!", "authCheckService", ".", "isAtLeastEditorInCourse", "(", "course", ",", "user", ")", ")", "{", "return", "forbidden", "(", ")", ";", "}", "FileUploadExercise", "fileUploadExerciseBeforeUpdate", "=", "fileUploadExerciseRepository", ".", "findOneByIdElseThrow", "(", "fileUploadExercise", ".", "getId", "(", ")", ")", ";", "exerciseService", ".", "checkForConversionBetweenExamAndCourseExercise", "(", "fileUploadExercise", ",", "fileUploadExerciseBeforeUpdate", ",", "ENTITY_NAME", ")", ";", "FileUploadExercise", "updatedExercise", "=", "fileUploadExerciseRepository", ".", "save", "(", "fileUploadExercise", ")", ";", "exerciseService", ".", "logUpdate", "(", "updatedExercise", ",", "updatedExercise", ".", "getCourseViaExerciseGroupOrCourseMember", "(", ")", ",", "user", ")", ";", "exerciseService", ".", "updatePointsInRelatedParticipantScores", "(", "fileUploadExerciseBeforeUpdate", ",", "updatedExercise", ")", ";", "if", "(", "(", "notificationText", "!=", "null", "&&", "fileUploadExercise", ".", "isCourseExercise", "(", ")", ")", "||", "fileUploadExercise", ".", "isExamExercise", "(", ")", ")", "{", "groupNotificationService", ".", "notifyStudentAndEditorAndInstructorGroupAboutExerciseUpdate", "(", "fileUploadExercise", ",", "notificationText", ")", ";", "}", "return", "ResponseEntity", ".", "ok", "(", ")", ".", "headers", "(", "HeaderUtil", ".", "createEntityUpdateAlert", "(", "applicationName", ",", "true", ",", "ENTITY_NAME", ",", "exerciseId", ".", "toString", "(", ")", ")", ")", ".", "body", "(", "updatedExercise", ")", ";", "}" ]
PUT /file-upload-exercises : Updates an existing fileUploadExercise.
[ "PUT", "/", "file", "-", "upload", "-", "exercises", ":", "Updates", "an", "existing", "fileUploadExercise", "." ]
[ "// TODO: The route has an exerciseId but we don't do anything useful with it. Change route and client requests?", "// Validate the updated file upload exercise", "// validates general settings: points, dates", "// Retrieve the course over the exerciseGroup or the given courseId", "// Check that the user is authorized to update the exercise", "// Forbid conversion between normal course exercise and exam exercise" ]
[ { "param": "fileUploadExercise", "type": "FileUploadExercise" }, { "param": "notificationText", "type": "String" }, { "param": "exerciseId", "type": "Long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "fileUploadExercise", "type": "FileUploadExercise", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "notificationText", "type": "String", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "exerciseId", "type": "Long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 6426, 3233, 2932, 19, 768, 17, 6327, 17, 8913, 71, 6141, 4938, 8913, 30708, 548, 1532, 13, 203, 565, 632, 1386, 18987, 2932, 5332, 2996, 2668, 13208, 23291, 13, 203, 565, 1071, 2306, 1943, 32, 812, 4777, 424, 20603, 34, 1089, 812, 4777, 424, 20603, 26964, 28843, 1387, 4777, 424, 20603, 585, 4777, 424, 20603, 16, 203, 5411, 632, 691, 786, 12, 1132, 273, 315, 9927, 1528, 3113, 1931, 273, 629, 13, 514, 3851, 1528, 16, 632, 743, 3092, 3407, 24165, 548, 13, 288, 203, 3639, 613, 18, 4148, 2932, 12030, 590, 358, 1089, 1387, 4777, 424, 20603, 294, 3728, 16, 585, 4777, 424, 20603, 1769, 203, 203, 3639, 368, 2660, 30, 1021, 1946, 711, 392, 24165, 548, 1496, 732, 2727, 1404, 741, 6967, 5301, 598, 518, 18, 7576, 1946, 471, 1004, 3285, 35, 203, 203, 3639, 368, 3554, 326, 3526, 585, 3617, 24165, 203, 3639, 1954, 1908, 1162, 7381, 812, 4777, 424, 20603, 12, 768, 4777, 424, 20603, 1769, 203, 3639, 368, 11964, 7470, 1947, 30, 3143, 16, 7811, 203, 3639, 24165, 1179, 18, 5662, 12580, 2628, 12, 768, 4777, 424, 20603, 1769, 203, 203, 3639, 368, 10708, 326, 4362, 1879, 326, 24165, 1114, 578, 326, 864, 4362, 548, 203, 3639, 385, 3117, 4362, 273, 4362, 1179, 18, 17466, 39, 3117, 4851, 424, 20603, 1114, 1162, 39, 3117, 548, 12, 768, 4777, 424, 20603, 1769, 203, 203, 3639, 368, 2073, 716, 326, 729, 353, 10799, 358, 1089, 326, 24165, 203, 3639, 2177, 729, 273, 729, 3305, 18, 588, 1299, 1190, 3621, 1876, 3594, 1961, 5621, 203, 3639, 309, 16051, 1944, 1564, 1179, 18, 291, 25070, 6946, 382, 39, 3117, 12, 5566, 16, 729, 3719, 288, 203, 5411, 327, 17987, 5621, 203, 3639, 289, 203, 3639, 1387, 4777, 424, 20603, 585, 4777, 424, 20603, 4649, 1891, 273, 585, 4777, 424, 20603, 3305, 18, 4720, 3335, 5132, 12427, 8282, 12, 768, 4777, 424, 20603, 18, 26321, 10663, 203, 203, 3639, 368, 2457, 19773, 4105, 3086, 2212, 4362, 24165, 471, 19707, 24165, 203, 3639, 24165, 1179, 18, 1893, 1290, 6814, 11831, 424, 301, 1876, 39, 3117, 424, 20603, 12, 768, 4777, 424, 20603, 16, 585, 4777, 424, 20603, 4649, 1891, 16, 17020, 67, 1985, 1769, 203, 203, 3639, 1387, 4777, 424, 20603, 3526, 424, 20603, 273, 585, 4777, 424, 20603, 3305, 18, 5688, 12, 768, 4777, 424, 20603, 1769, 203, 3639, 24165, 1179, 18, 1330, 1891, 12, 7007, 424, 20603, 16, 3526, 424, 20603, 18, 588, 39, 3117, 21246, 424, 20603, 1114, 1162, 39, 3117, 4419, 9334, 729, 1769, 203, 3639, 24165, 1179, 18, 2725, 5636, 382, 8017, 22540, 20037, 12, 768, 4777, 424, 20603, 4649, 1891, 16, 3526, 424, 20603, 1769, 203, 203, 3639, 309, 14015, 9927, 1528, 480, 446, 597, 585, 4777, 424, 20603, 18, 291, 39, 3117, 424, 20603, 10756, 747, 585, 4777, 424, 20603, 18, 291, 424, 301, 424, 20603, 10756, 288, 203, 5411, 1041, 4386, 1179, 18, 12336, 19943, 319, 1876, 6946, 1876, 382, 2732, 1114, 24813, 424, 20603, 1891, 12, 768, 4777, 424, 20603, 16, 3851, 1528, 1769, 203, 3639, 289, 2 ]
[ 1, 1, 1, 1, 1, 1, 1, 1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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
[ 1, 26873, 203, 377, 380, 11443, 342, 768, 17, 6327, 17, 8913, 71, 6141, 294, 15419, 392, 2062, 585, 4777, 424, 20603, 18, 203, 377, 380, 203, 377, 380, 632, 891, 585, 4777, 424, 20603, 326, 585, 4777, 424, 20603, 358, 1089, 203, 377, 380, 632, 891, 3851, 1528, 326, 977, 12188, 358, 10068, 4877, 203, 377, 380, 632, 891, 24165, 548, 326, 612, 434, 24165, 203, 377, 380, 632, 2463, 326, 2306, 1943, 598, 1267, 4044, 261, 3141, 13, 471, 598, 1417, 326, 3526, 585, 4777, 424, 20603, 16, 578, 598, 1267, 7409, 261, 6434, 1567, 13, 309, 326, 585, 4777, 424, 20603, 353, 486, 923, 16, 578, 203, 377, 380, 540, 598, 1267, 6604, 261, 3061, 3224, 1068, 13, 309, 326, 585, 4777, 424, 20603, 2 ]
bcc0a7c3c17fb6ad3f94a4c80f1fccee3fdebf55
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/web/rest/FileUploadExerciseResource.java
[ "MIT" ]
Java
exportSubmissions
null
@PostMapping("/file-upload-exercises/{exerciseId}/export-submissions") @PreAuthorize("hasRole('TA')") public ResponseEntity<Resource> exportSubmissions(@PathVariable long exerciseId, @RequestBody SubmissionExportOptionsDTO submissionExportOptions) { FileUploadExercise fileUploadExercise = fileUploadExerciseRepository.findOneByIdElseThrow(exerciseId); authCheckService.checkHasAtLeastRoleForExerciseElseThrow(Role.TEACHING_ASSISTANT, fileUploadExercise, null); // TAs are not allowed to download all participations if (submissionExportOptions.isExportAllParticipants()) { authCheckService.checkHasAtLeastRoleInCourseElseThrow(Role.INSTRUCTOR, fileUploadExercise.getCourseViaExerciseGroupOrCourseMember(), null); } File zipFile = fileUploadSubmissionExportService.exportStudentSubmissionsElseThrow(exerciseId, submissionExportOptions); return ResponseUtil.ok(zipFile); }
/** * POST /file-upload-exercises/:exerciseId/export-submissions : sends exercise submissions as zip * * @param exerciseId the id of the exercise to get the repos from * @param submissionExportOptions the options that should be used for the export * @return ResponseEntity with status */
POST /file-upload-exercises/:exerciseId/export-submissions : sends exercise submissions as zip @param exerciseId the id of the exercise to get the repos from @param submissionExportOptions the options that should be used for the export @return ResponseEntity with status
[ "POST", "/", "file", "-", "upload", "-", "exercises", "/", ":", "exerciseId", "/", "export", "-", "submissions", ":", "sends", "exercise", "submissions", "as", "zip", "@param", "exerciseId", "the", "id", "of", "the", "exercise", "to", "get", "the", "repos", "from", "@param", "submissionExportOptions", "the", "options", "that", "should", "be", "used", "for", "the", "export", "@return", "ResponseEntity", "with", "status" ]
@PostMapping("/file-upload-exercises/{exerciseId}/export-submissions") @PreAuthorize("hasRole('TA')") public ResponseEntity<Resource> exportSubmissions(@PathVariable long exerciseId, @RequestBody SubmissionExportOptionsDTO submissionExportOptions) { FileUploadExercise fileUploadExercise = fileUploadExerciseRepository.findOneByIdElseThrow(exerciseId); authCheckService.checkHasAtLeastRoleForExerciseElseThrow(Role.TEACHING_ASSISTANT, fileUploadExercise, null); if (submissionExportOptions.isExportAllParticipants()) { authCheckService.checkHasAtLeastRoleInCourseElseThrow(Role.INSTRUCTOR, fileUploadExercise.getCourseViaExerciseGroupOrCourseMember(), null); } File zipFile = fileUploadSubmissionExportService.exportStudentSubmissionsElseThrow(exerciseId, submissionExportOptions); return ResponseUtil.ok(zipFile); }
[ "@", "PostMapping", "(", "\"/file-upload-exercises/{exerciseId}/export-submissions\"", ")", "@", "PreAuthorize", "(", "\"hasRole('TA')\"", ")", "public", "ResponseEntity", "<", "Resource", ">", "exportSubmissions", "(", "@", "PathVariable", "long", "exerciseId", ",", "@", "RequestBody", "SubmissionExportOptionsDTO", "submissionExportOptions", ")", "{", "FileUploadExercise", "fileUploadExercise", "=", "fileUploadExerciseRepository", ".", "findOneByIdElseThrow", "(", "exerciseId", ")", ";", "authCheckService", ".", "checkHasAtLeastRoleForExerciseElseThrow", "(", "Role", ".", "TEACHING_ASSISTANT", ",", "fileUploadExercise", ",", "null", ")", ";", "if", "(", "submissionExportOptions", ".", "isExportAllParticipants", "(", ")", ")", "{", "authCheckService", ".", "checkHasAtLeastRoleInCourseElseThrow", "(", "Role", ".", "INSTRUCTOR", ",", "fileUploadExercise", ".", "getCourseViaExerciseGroupOrCourseMember", "(", ")", ",", "null", ")", ";", "}", "File", "zipFile", "=", "fileUploadSubmissionExportService", ".", "exportStudentSubmissionsElseThrow", "(", "exerciseId", ",", "submissionExportOptions", ")", ";", "return", "ResponseUtil", ".", "ok", "(", "zipFile", ")", ";", "}" ]
POST /file-upload-exercises/:exerciseId/export-submissions : sends exercise submissions as zip @param exerciseId the id of the exercise to get the repos from @param submissionExportOptions the options that should be used for the export @return ResponseEntity with status
[ "POST", "/", "file", "-", "upload", "-", "exercises", "/", ":", "exerciseId", "/", "export", "-", "submissions", ":", "sends", "exercise", "submissions", "as", "zip", "@param", "exerciseId", "the", "id", "of", "the", "exercise", "to", "get", "the", "repos", "from", "@param", "submissionExportOptions", "the", "options", "that", "should", "be", "used", "for", "the", "export", "@return", "ResponseEntity", "with", "status" ]
[ "// TAs are not allowed to download all participations" ]
[ { "param": "exerciseId", "type": "long" }, { "param": "submissionExportOptions", "type": "SubmissionExportOptionsDTO" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "exerciseId", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "submissionExportOptions", "type": "SubmissionExportOptionsDTO", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 3349, 3233, 2932, 19, 768, 17, 6327, 17, 8913, 71, 6141, 4938, 8913, 30708, 548, 4004, 6530, 17, 25675, 7923, 203, 565, 632, 1386, 18987, 2932, 5332, 2996, 2668, 9833, 23291, 13, 203, 565, 1071, 2306, 1943, 32, 1420, 34, 3359, 1676, 7300, 26964, 743, 3092, 1525, 24165, 548, 16, 632, 28843, 2592, 3951, 6144, 1320, 19792, 8515, 6144, 1320, 13, 288, 203, 203, 3639, 1387, 4777, 424, 20603, 585, 4777, 424, 20603, 273, 585, 4777, 424, 20603, 3305, 18, 4720, 3335, 5132, 12427, 8282, 12, 8913, 30708, 548, 1769, 203, 203, 3639, 1357, 1564, 1179, 18, 1893, 5582, 25070, 2996, 1290, 424, 20603, 12427, 8282, 12, 2996, 18, 1448, 18133, 1360, 67, 8423, 5511, 6856, 16, 585, 4777, 424, 20603, 16, 446, 1769, 203, 203, 3639, 368, 399, 1463, 854, 486, 2935, 358, 4224, 777, 30891, 1012, 203, 3639, 309, 261, 12684, 6144, 1320, 18, 291, 6144, 1595, 1988, 27620, 10756, 288, 203, 5411, 1357, 1564, 1179, 18, 1893, 5582, 25070, 2996, 382, 39, 3117, 12427, 8282, 12, 2996, 18, 706, 13915, 916, 16, 585, 4777, 424, 20603, 18, 588, 39, 3117, 21246, 424, 20603, 1114, 1162, 39, 3117, 4419, 9334, 446, 1769, 203, 3639, 289, 203, 203, 3639, 1387, 19450, 273, 585, 4777, 17865, 6144, 1179, 18, 6530, 19943, 319, 1676, 7300, 12427,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 5485, 342, 768, 17, 6327, 17, 8913, 71, 6141, 16880, 8913, 30708, 548, 19, 6530, 17, 25675, 294, 9573, 24165, 22071, 487, 3144, 203, 377, 380, 203, 377, 380, 632, 891, 24165, 548, 326, 612, 434, 326, 24165, 358, 336, 326, 13686, 628, 203, 377, 380, 632, 891, 8515, 6144, 1320, 326, 702, 716, 1410, 506, 1399, 364, 326, 3359, 203, 377, 380, 632, 2463, 2306, 1943, 598, 1267, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
bcc0a7c3c17fb6ad3f94a4c80f1fccee3fdebf55
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/web/rest/FileUploadExerciseResource.java
[ "MIT" ]
Java
reEvaluateAndUpdateFileUploadExercise
null
@PutMapping(Endpoints.REEVALUATE_EXERCISE) @PreAuthorize("hasRole('EDITOR')") public ResponseEntity<FileUploadExercise> reEvaluateAndUpdateFileUploadExercise(@PathVariable long exerciseId, @RequestBody FileUploadExercise fileUploadExercise, @RequestParam(value = "deleteFeedback", required = false) Boolean deleteFeedbackAfterGradingInstructionUpdate) { log.debug("REST request to re-evaluate FileUploadExercise : {}", fileUploadExercise); // check that the exercise is exist for given id fileUploadExerciseRepository.findOneByIdElseThrow(exerciseId); authCheckService.checkGivenExerciseIdSameForExerciseInRequestBodyElseThrow(exerciseId, fileUploadExercise); Course course = courseService.retrieveCourseOverExerciseGroupOrCourseId(fileUploadExercise); // Check that the user is authorized to update the exercise User user = userRepository.getUserWithGroupsAndAuthorities(); authCheckService.checkHasAtLeastRoleInCourseElseThrow(Role.EDITOR, course, user); exerciseService.reEvaluateExercise(fileUploadExercise, deleteFeedbackAfterGradingInstructionUpdate); return updateFileUploadExercise(fileUploadExercise, null, fileUploadExercise.getId()); }
/** * PUT /file-upload-exercises/{exerciseId}/re-evaluate : Re-evaluates and updates an existing fileUploadExercise. * * @param exerciseId of the exercise * @param fileUploadExercise the fileUploadExercise to re-evaluate and update * @param deleteFeedbackAfterGradingInstructionUpdate boolean flag that indicates whether the associated feedback should be deleted or not * * @return the ResponseEntity with status 200 (OK) and with body the updated fileUploadExercise, or * with status 400 (Bad Request) if the fileUploadExercise is not valid, or with status 409 (Conflict) * if given exerciseId is not same as in the object of the request body, or with status 500 (Internal * Server Error) if the fileUploadExercise couldn't be updated * @throws URISyntaxException if the Location URI syntax is incorrect */
PUT /file-upload-exercises/{exerciseId}/re-evaluate : Re-evaluates and updates an existing fileUploadExercise. @param exerciseId of the exercise @param fileUploadExercise the fileUploadExercise to re-evaluate and update @param deleteFeedbackAfterGradingInstructionUpdate boolean flag that indicates whether the associated feedback should be deleted or not @return the ResponseEntity with status 200 (OK) and with body the updated fileUploadExercise, or with status 400 (Bad Request) if the fileUploadExercise is not valid, or with status 409 (Conflict) if given exerciseId is not same as in the object of the request body, or with status 500 (Internal Server Error) if the fileUploadExercise couldn't be updated @throws URISyntaxException if the Location URI syntax is incorrect
[ "PUT", "/", "file", "-", "upload", "-", "exercises", "/", "{", "exerciseId", "}", "/", "re", "-", "evaluate", ":", "Re", "-", "evaluates", "and", "updates", "an", "existing", "fileUploadExercise", ".", "@param", "exerciseId", "of", "the", "exercise", "@param", "fileUploadExercise", "the", "fileUploadExercise", "to", "re", "-", "evaluate", "and", "update", "@param", "deleteFeedbackAfterGradingInstructionUpdate", "boolean", "flag", "that", "indicates", "whether", "the", "associated", "feedback", "should", "be", "deleted", "or", "not", "@return", "the", "ResponseEntity", "with", "status", "200", "(", "OK", ")", "and", "with", "body", "the", "updated", "fileUploadExercise", "or", "with", "status", "400", "(", "Bad", "Request", ")", "if", "the", "fileUploadExercise", "is", "not", "valid", "or", "with", "status", "409", "(", "Conflict", ")", "if", "given", "exerciseId", "is", "not", "same", "as", "in", "the", "object", "of", "the", "request", "body", "or", "with", "status", "500", "(", "Internal", "Server", "Error", ")", "if", "the", "fileUploadExercise", "couldn", "'", "t", "be", "updated", "@throws", "URISyntaxException", "if", "the", "Location", "URI", "syntax", "is", "incorrect" ]
@PutMapping(Endpoints.REEVALUATE_EXERCISE) @PreAuthorize("hasRole('EDITOR')") public ResponseEntity<FileUploadExercise> reEvaluateAndUpdateFileUploadExercise(@PathVariable long exerciseId, @RequestBody FileUploadExercise fileUploadExercise, @RequestParam(value = "deleteFeedback", required = false) Boolean deleteFeedbackAfterGradingInstructionUpdate) { log.debug("REST request to re-evaluate FileUploadExercise : {}", fileUploadExercise); fileUploadExerciseRepository.findOneByIdElseThrow(exerciseId); authCheckService.checkGivenExerciseIdSameForExerciseInRequestBodyElseThrow(exerciseId, fileUploadExercise); Course course = courseService.retrieveCourseOverExerciseGroupOrCourseId(fileUploadExercise); User user = userRepository.getUserWithGroupsAndAuthorities(); authCheckService.checkHasAtLeastRoleInCourseElseThrow(Role.EDITOR, course, user); exerciseService.reEvaluateExercise(fileUploadExercise, deleteFeedbackAfterGradingInstructionUpdate); return updateFileUploadExercise(fileUploadExercise, null, fileUploadExercise.getId()); }
[ "@", "PutMapping", "(", "Endpoints", ".", "REEVALUATE_EXERCISE", ")", "@", "PreAuthorize", "(", "\"hasRole('EDITOR')\"", ")", "public", "ResponseEntity", "<", "FileUploadExercise", ">", "reEvaluateAndUpdateFileUploadExercise", "(", "@", "PathVariable", "long", "exerciseId", ",", "@", "RequestBody", "FileUploadExercise", "fileUploadExercise", ",", "@", "RequestParam", "(", "value", "=", "\"deleteFeedback\"", ",", "required", "=", "false", ")", "Boolean", "deleteFeedbackAfterGradingInstructionUpdate", ")", "{", "log", ".", "debug", "(", "\"REST request to re-evaluate FileUploadExercise : {}\"", ",", "fileUploadExercise", ")", ";", "fileUploadExerciseRepository", ".", "findOneByIdElseThrow", "(", "exerciseId", ")", ";", "authCheckService", ".", "checkGivenExerciseIdSameForExerciseInRequestBodyElseThrow", "(", "exerciseId", ",", "fileUploadExercise", ")", ";", "Course", "course", "=", "courseService", ".", "retrieveCourseOverExerciseGroupOrCourseId", "(", "fileUploadExercise", ")", ";", "User", "user", "=", "userRepository", ".", "getUserWithGroupsAndAuthorities", "(", ")", ";", "authCheckService", ".", "checkHasAtLeastRoleInCourseElseThrow", "(", "Role", ".", "EDITOR", ",", "course", ",", "user", ")", ";", "exerciseService", ".", "reEvaluateExercise", "(", "fileUploadExercise", ",", "deleteFeedbackAfterGradingInstructionUpdate", ")", ";", "return", "updateFileUploadExercise", "(", "fileUploadExercise", ",", "null", ",", "fileUploadExercise", ".", "getId", "(", ")", ")", ";", "}" ]
PUT /file-upload-exercises/{exerciseId}/re-evaluate : Re-evaluates and updates an existing fileUploadExercise.
[ "PUT", "/", "file", "-", "upload", "-", "exercises", "/", "{", "exerciseId", "}", "/", "re", "-", "evaluate", ":", "Re", "-", "evaluates", "and", "updates", "an", "existing", "fileUploadExercise", "." ]
[ "// check that the exercise is exist for given id", "// Check that the user is authorized to update the exercise" ]
[ { "param": "exerciseId", "type": "long" }, { "param": "fileUploadExercise", "type": "FileUploadExercise" }, { "param": "deleteFeedbackAfterGradingInstructionUpdate", "type": "Boolean" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "exerciseId", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "fileUploadExercise", "type": "FileUploadExercise", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "deleteFeedbackAfterGradingInstructionUpdate", "type": "Boolean", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 6426, 3233, 12, 10357, 18, 9719, 2669, 57, 1777, 67, 2294, 654, 7266, 1090, 13, 203, 565, 632, 1386, 18987, 2932, 5332, 2996, 2668, 13208, 23291, 13, 203, 565, 1071, 2306, 1943, 32, 812, 4777, 424, 20603, 34, 283, 15369, 1876, 1891, 812, 4777, 424, 20603, 26964, 743, 3092, 1525, 24165, 548, 16, 632, 28843, 1387, 4777, 424, 20603, 585, 4777, 424, 20603, 16, 203, 5411, 632, 691, 786, 12, 1132, 273, 315, 3733, 15888, 3113, 1931, 273, 629, 13, 3411, 1430, 15888, 4436, 30420, 310, 11983, 1891, 13, 288, 203, 3639, 613, 18, 4148, 2932, 12030, 590, 358, 283, 17, 21024, 1387, 4777, 424, 20603, 294, 3728, 16, 585, 4777, 424, 20603, 1769, 203, 203, 3639, 368, 866, 716, 326, 24165, 353, 1005, 364, 864, 612, 203, 3639, 585, 4777, 424, 20603, 3305, 18, 4720, 3335, 5132, 12427, 8282, 12, 8913, 30708, 548, 1769, 203, 203, 3639, 1357, 1564, 1179, 18, 1893, 6083, 424, 20603, 548, 8650, 1290, 424, 20603, 382, 28843, 12427, 8282, 12, 8913, 30708, 548, 16, 585, 4777, 424, 20603, 1769, 203, 203, 3639, 385, 3117, 4362, 273, 4362, 1179, 18, 17466, 39, 3117, 4851, 424, 20603, 1114, 1162, 39, 3117, 548, 12, 768, 4777, 424, 20603, 1769, 203, 203, 3639, 368, 2073, 716, 326, 729, 353, 10799, 358, 1089, 326, 24165, 203, 3639, 2177, 729, 273, 729, 3305, 18, 588, 1299, 1190, 3621, 1876, 3594, 1961, 5621, 203, 3639, 1357, 1564, 1179, 18, 1893, 5582, 25070, 2996, 382, 39, 3117, 12427, 8282, 12, 2996, 18, 13208, 16, 4362, 16, 729, 1769, 203, 203, 3639, 24165, 1179, 18, 266, 15369, 424, 20603, 12, 768, 4777, 424, 20603, 16, 1430, 15888, 4436, 30420, 310, 11983, 1891, 1769, 203, 203, 3639, 327, 1089, 812, 4777, 424, 20603, 12, 768, 4777, 424, 20603, 16, 446, 16, 585, 4777, 424, 20603, 18, 26321, 10663, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 11443, 342, 768, 17, 6327, 17, 8913, 71, 6141, 4938, 8913, 30708, 548, 4004, 266, 17, 21024, 294, 868, 17, 14168, 815, 471, 4533, 392, 2062, 585, 4777, 424, 20603, 18, 203, 377, 380, 203, 377, 380, 632, 891, 24165, 548, 4766, 282, 434, 326, 24165, 203, 377, 380, 632, 891, 585, 4777, 424, 20603, 21821, 326, 585, 4777, 424, 20603, 358, 283, 17, 21024, 471, 1089, 203, 377, 380, 632, 891, 1430, 15888, 4436, 30420, 310, 11983, 1891, 225, 1250, 2982, 716, 8527, 2856, 326, 3627, 10762, 1410, 506, 4282, 578, 486, 203, 377, 380, 203, 377, 380, 632, 2463, 326, 2306, 1943, 598, 1267, 4044, 261, 3141, 13, 471, 598, 1417, 326, 3526, 585, 4777, 424, 20603, 16, 578, 203, 2 ]
149ac9ebcbc48e7571ea3ff315cb4c11bbf8d26e
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/service/exam/ExamService.java
[ "MIT" ]
Java
findByIdWithExerciseGroupsAndExercisesElseThrow
Exam
@NotNull public Exam findByIdWithExerciseGroupsAndExercisesElseThrow(Long examId) { log.debug("Request to get exam with exercise groups : {}", examId); Exam exam = examRepository.findWithExerciseGroupsAndExercisesById(examId).orElseThrow(() -> new EntityNotFoundException("Exam", examId)); for (ExerciseGroup exerciseGroup : exam.getExerciseGroups()) { for (Exercise exercise : exerciseGroup.getExercises()) { if (exercise instanceof ProgrammingExercise) { ProgrammingExercise exerciseWithTemplateAndSolutionParticipation = programmingExerciseRepository .findByIdWithTemplateAndSolutionParticipationWithResultsElseThrow(exercise.getId()); ((ProgrammingExercise) exercise).setTemplateParticipation(exerciseWithTemplateAndSolutionParticipation.getTemplateParticipation()); ((ProgrammingExercise) exercise).setSolutionParticipation(exerciseWithTemplateAndSolutionParticipation.getSolutionParticipation()); } if (exercise instanceof QuizExercise) { QuizExercise quizExercise = quizExerciseRepository.findByIdWithQuestionsElseThrow(exercise.getId()); ((QuizExercise) exercise).setQuizQuestions(quizExercise.getQuizQuestions()); } } } return exam; }
/** * Get one exam by id with exercise groups and exercises. * Also fetches the template and solution participation for programming exercises and questions for quiz exercises. * * @param examId the id of the entity * @return the exam with exercise groups */
Get one exam by id with exercise groups and exercises. Also fetches the template and solution participation for programming exercises and questions for quiz exercises. @param examId the id of the entity @return the exam with exercise groups
[ "Get", "one", "exam", "by", "id", "with", "exercise", "groups", "and", "exercises", ".", "Also", "fetches", "the", "template", "and", "solution", "participation", "for", "programming", "exercises", "and", "questions", "for", "quiz", "exercises", ".", "@param", "examId", "the", "id", "of", "the", "entity", "@return", "the", "exam", "with", "exercise", "groups" ]
@NotNull public Exam findByIdWithExerciseGroupsAndExercisesElseThrow(Long examId) { log.debug("Request to get exam with exercise groups : {}", examId); Exam exam = examRepository.findWithExerciseGroupsAndExercisesById(examId).orElseThrow(() -> new EntityNotFoundException("Exam", examId)); for (ExerciseGroup exerciseGroup : exam.getExerciseGroups()) { for (Exercise exercise : exerciseGroup.getExercises()) { if (exercise instanceof ProgrammingExercise) { ProgrammingExercise exerciseWithTemplateAndSolutionParticipation = programmingExerciseRepository .findByIdWithTemplateAndSolutionParticipationWithResultsElseThrow(exercise.getId()); ((ProgrammingExercise) exercise).setTemplateParticipation(exerciseWithTemplateAndSolutionParticipation.getTemplateParticipation()); ((ProgrammingExercise) exercise).setSolutionParticipation(exerciseWithTemplateAndSolutionParticipation.getSolutionParticipation()); } if (exercise instanceof QuizExercise) { QuizExercise quizExercise = quizExerciseRepository.findByIdWithQuestionsElseThrow(exercise.getId()); ((QuizExercise) exercise).setQuizQuestions(quizExercise.getQuizQuestions()); } } } return exam; }
[ "@", "NotNull", "public", "Exam", "findByIdWithExerciseGroupsAndExercisesElseThrow", "(", "Long", "examId", ")", "{", "log", ".", "debug", "(", "\"Request to get exam with exercise groups : {}\"", ",", "examId", ")", ";", "Exam", "exam", "=", "examRepository", ".", "findWithExerciseGroupsAndExercisesById", "(", "examId", ")", ".", "orElseThrow", "(", "(", ")", "->", "new", "EntityNotFoundException", "(", "\"Exam\"", ",", "examId", ")", ")", ";", "for", "(", "ExerciseGroup", "exerciseGroup", ":", "exam", ".", "getExerciseGroups", "(", ")", ")", "{", "for", "(", "Exercise", "exercise", ":", "exerciseGroup", ".", "getExercises", "(", ")", ")", "{", "if", "(", "exercise", "instanceof", "ProgrammingExercise", ")", "{", "ProgrammingExercise", "exerciseWithTemplateAndSolutionParticipation", "=", "programmingExerciseRepository", ".", "findByIdWithTemplateAndSolutionParticipationWithResultsElseThrow", "(", "exercise", ".", "getId", "(", ")", ")", ";", "(", "(", "ProgrammingExercise", ")", "exercise", ")", ".", "setTemplateParticipation", "(", "exerciseWithTemplateAndSolutionParticipation", ".", "getTemplateParticipation", "(", ")", ")", ";", "(", "(", "ProgrammingExercise", ")", "exercise", ")", ".", "setSolutionParticipation", "(", "exerciseWithTemplateAndSolutionParticipation", ".", "getSolutionParticipation", "(", ")", ")", ";", "}", "if", "(", "exercise", "instanceof", "QuizExercise", ")", "{", "QuizExercise", "quizExercise", "=", "quizExerciseRepository", ".", "findByIdWithQuestionsElseThrow", "(", "exercise", ".", "getId", "(", ")", ")", ";", "(", "(", "QuizExercise", ")", "exercise", ")", ".", "setQuizQuestions", "(", "quizExercise", ".", "getQuizQuestions", "(", ")", ")", ";", "}", "}", "}", "return", "exam", ";", "}" ]
Get one exam by id with exercise groups and exercises.
[ "Get", "one", "exam", "by", "id", "with", "exercise", "groups", "and", "exercises", "." ]
[]
[ { "param": "examId", "type": "Long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "examId", "type": "Long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 5962, 203, 565, 1071, 1312, 301, 23131, 1190, 424, 20603, 3621, 1876, 424, 12610, 6141, 12427, 8282, 12, 3708, 19707, 548, 13, 288, 203, 3639, 613, 18, 4148, 2932, 691, 358, 336, 19707, 598, 24165, 3252, 294, 3728, 16, 19707, 548, 1769, 203, 3639, 1312, 301, 19707, 273, 19707, 3305, 18, 4720, 1190, 424, 20603, 3621, 1876, 424, 12610, 6141, 5132, 12, 338, 301, 548, 2934, 280, 12427, 8282, 12, 1435, 317, 394, 3887, 3990, 2932, 424, 301, 3113, 19707, 548, 10019, 203, 3639, 364, 261, 424, 20603, 1114, 24165, 1114, 294, 19707, 18, 588, 424, 20603, 3621, 10756, 288, 203, 5411, 364, 261, 424, 20603, 24165, 294, 24165, 1114, 18, 588, 424, 12610, 6141, 10756, 288, 203, 7734, 309, 261, 8913, 30708, 1276, 13586, 11987, 424, 20603, 13, 288, 203, 10792, 13586, 11987, 424, 20603, 24165, 1190, 2283, 1876, 16135, 1988, 24629, 367, 273, 5402, 11987, 424, 20603, 3305, 203, 18701, 263, 4720, 5132, 1190, 2283, 1876, 16135, 1988, 24629, 367, 1190, 3447, 12427, 8282, 12, 8913, 30708, 18, 26321, 10663, 203, 10792, 14015, 9459, 11987, 424, 20603, 13, 24165, 2934, 542, 2283, 1988, 24629, 367, 12, 8913, 30708, 1190, 2283, 1876, 16135, 1988, 24629, 367, 18, 588, 2283, 1988, 24629, 367, 10663, 203, 10792, 14015, 9459, 11987, 424, 20603, 13, 24165, 2934, 542, 16135, 1988, 24629, 367, 12, 8913, 30708, 1190, 2283, 1876, 16135, 1988, 24629, 367, 18, 588, 16135, 1988, 24629, 367, 10663, 203, 7734, 289, 203, 7734, 309, 261, 8913, 30708, 1276, 4783, 452, 424, 20603, 13, 288, 203, 10792, 4783, 452, 424, 20603, 16479, 424, 20603, 273, 16479, 424, 20603, 3305, 18, 4720, 5132, 1190, 30791, 1115, 12427, 8282, 12, 8913, 30708, 18, 26321, 10663, 203, 10792, 14015, 928, 452, 424, 20603, 13, 24165, 2934, 542, 928, 452, 30791, 1115, 12, 18345, 424, 20603, 18, 588, 928, 452, 30791, 1115, 10663, 203, 7734, 289, 203, 5411, 289, 203, 3639, 289, 203, 3639, 327, 19707, 31, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 968, 1245, 19707, 635, 612, 598, 24165, 3252, 471, 431, 12610, 6141, 18, 203, 377, 380, 8080, 17675, 326, 1542, 471, 6959, 30891, 367, 364, 5402, 11987, 431, 12610, 6141, 471, 13494, 364, 16479, 431, 12610, 6141, 18, 203, 377, 380, 203, 377, 380, 632, 891, 19707, 548, 326, 612, 434, 326, 1522, 203, 377, 380, 632, 2463, 326, 19707, 598, 24165, 3252, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
149ac9ebcbc48e7571ea3ff315cb4c11bbf8d26e
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/service/exam/ExamService.java
[ "MIT" ]
Java
delete
null
public void delete(@NotNull long examId) { User user = userRepository.getUser(); Exam exam = examRepository.findOneWithEagerExercisesGroupsAndStudentExams(examId); log.info("User {} has requested to delete the exam {}", user.getLogin(), exam.getTitle()); AuditEvent auditEvent = new AuditEvent(user.getLogin(), Constants.DELETE_EXAM, "exam=" + exam.getTitle()); auditEventRepository.add(auditEvent); for (ExerciseGroup exerciseGroup : exam.getExerciseGroups()) { if (exerciseGroup != null) { for (Exercise exercise : exerciseGroup.getExercises()) { exerciseService.delete(exercise.getId(), true, true); } } } deleteGradingScaleOfExam(exam); examRepository.deleteById(exam.getId()); }
/** * Fetches the exam and eagerly loads all required elements and deletes all elements associated with the * exam including: * <ul> * <li>The Exam</li> * <li>All ExerciseGroups</li> * <li>All Exercises including: * Submissions, Participations, Results, Repositories and build plans, see {@link ExerciseService#delete}</li> * <li>All StudentExams</li> * <li>The exam Grading Scale if such exists</li> * </ul> * Note: StudentExams and ExerciseGroups are not explicitly deleted as the delete operation of the exam is cascaded by the database. * * @param examId the ID of the exam to be deleted */
Fetches the exam and eagerly loads all required elements and deletes all elements associated with the exam including: The Exam All ExerciseGroups All Exercises including: Submissions, Participations, Results, Repositories and build plans, see ExerciseService#delete All StudentExams The exam Grading Scale if such exists Note: StudentExams and ExerciseGroups are not explicitly deleted as the delete operation of the exam is cascaded by the database. @param examId the ID of the exam to be deleted
[ "Fetches", "the", "exam", "and", "eagerly", "loads", "all", "required", "elements", "and", "deletes", "all", "elements", "associated", "with", "the", "exam", "including", ":", "The", "Exam", "All", "ExerciseGroups", "All", "Exercises", "including", ":", "Submissions", "Participations", "Results", "Repositories", "and", "build", "plans", "see", "ExerciseService#delete", "All", "StudentExams", "The", "exam", "Grading", "Scale", "if", "such", "exists", "Note", ":", "StudentExams", "and", "ExerciseGroups", "are", "not", "explicitly", "deleted", "as", "the", "delete", "operation", "of", "the", "exam", "is", "cascaded", "by", "the", "database", ".", "@param", "examId", "the", "ID", "of", "the", "exam", "to", "be", "deleted" ]
public void delete(@NotNull long examId) { User user = userRepository.getUser(); Exam exam = examRepository.findOneWithEagerExercisesGroupsAndStudentExams(examId); log.info("User {} has requested to delete the exam {}", user.getLogin(), exam.getTitle()); AuditEvent auditEvent = new AuditEvent(user.getLogin(), Constants.DELETE_EXAM, "exam=" + exam.getTitle()); auditEventRepository.add(auditEvent); for (ExerciseGroup exerciseGroup : exam.getExerciseGroups()) { if (exerciseGroup != null) { for (Exercise exercise : exerciseGroup.getExercises()) { exerciseService.delete(exercise.getId(), true, true); } } } deleteGradingScaleOfExam(exam); examRepository.deleteById(exam.getId()); }
[ "public", "void", "delete", "(", "@", "NotNull", "long", "examId", ")", "{", "User", "user", "=", "userRepository", ".", "getUser", "(", ")", ";", "Exam", "exam", "=", "examRepository", ".", "findOneWithEagerExercisesGroupsAndStudentExams", "(", "examId", ")", ";", "log", ".", "info", "(", "\"User {} has requested to delete the exam {}\"", ",", "user", ".", "getLogin", "(", ")", ",", "exam", ".", "getTitle", "(", ")", ")", ";", "AuditEvent", "auditEvent", "=", "new", "AuditEvent", "(", "user", ".", "getLogin", "(", ")", ",", "Constants", ".", "DELETE_EXAM", ",", "\"exam=\"", "+", "exam", ".", "getTitle", "(", ")", ")", ";", "auditEventRepository", ".", "add", "(", "auditEvent", ")", ";", "for", "(", "ExerciseGroup", "exerciseGroup", ":", "exam", ".", "getExerciseGroups", "(", ")", ")", "{", "if", "(", "exerciseGroup", "!=", "null", ")", "{", "for", "(", "Exercise", "exercise", ":", "exerciseGroup", ".", "getExercises", "(", ")", ")", "{", "exerciseService", ".", "delete", "(", "exercise", ".", "getId", "(", ")", ",", "true", ",", "true", ")", ";", "}", "}", "}", "deleteGradingScaleOfExam", "(", "exam", ")", ";", "examRepository", ".", "deleteById", "(", "exam", ".", "getId", "(", ")", ")", ";", "}" ]
Fetches the exam and eagerly loads all required elements and deletes all elements associated with the exam including: <ul> <li>The Exam</li> <li>All ExerciseGroups</li> <li>All Exercises including: Submissions, Participations, Results, Repositories and build plans, see {@link ExerciseService#delete}</li> <li>All StudentExams</li> <li>The exam Grading Scale if such exists</li> </ul> Note: StudentExams and ExerciseGroups are not explicitly deleted as the delete operation of the exam is cascaded by the database.
[ "Fetches", "the", "exam", "and", "eagerly", "loads", "all", "required", "elements", "and", "deletes", "all", "elements", "associated", "with", "the", "exam", "including", ":", "<ul", ">", "<li", ">", "The", "Exam<", "/", "li", ">", "<li", ">", "All", "ExerciseGroups<", "/", "li", ">", "<li", ">", "All", "Exercises", "including", ":", "Submissions", "Participations", "Results", "Repositories", "and", "build", "plans", "see", "{", "@link", "ExerciseService#delete", "}", "<", "/", "li", ">", "<li", ">", "All", "StudentExams<", "/", "li", ">", "<li", ">", "The", "exam", "Grading", "Scale", "if", "such", "exists<", "/", "li", ">", "<", "/", "ul", ">", "Note", ":", "StudentExams", "and", "ExerciseGroups", "are", "not", "explicitly", "deleted", "as", "the", "delete", "operation", "of", "the", "exam", "is", "cascaded", "by", "the", "database", "." ]
[]
[ { "param": "examId", "type": "long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "examId", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 918, 1430, 26964, 5962, 1525, 19707, 548, 13, 288, 203, 3639, 2177, 729, 273, 729, 3305, 18, 588, 1299, 5621, 203, 3639, 1312, 301, 19707, 273, 19707, 3305, 18, 4720, 3335, 1190, 41, 6817, 424, 12610, 6141, 3621, 1876, 19943, 319, 424, 301, 87, 12, 338, 301, 548, 1769, 203, 3639, 613, 18, 1376, 2932, 1299, 2618, 711, 3764, 358, 1430, 326, 19707, 3728, 16, 729, 18, 588, 5358, 9334, 19707, 18, 588, 4247, 10663, 203, 3639, 12975, 1133, 8215, 1133, 273, 394, 12975, 1133, 12, 1355, 18, 588, 5358, 9334, 5245, 18, 6460, 67, 2294, 2192, 16, 315, 338, 301, 1546, 397, 19707, 18, 588, 4247, 10663, 203, 3639, 8215, 1133, 3305, 18, 1289, 12, 17413, 1133, 1769, 203, 203, 3639, 364, 261, 424, 20603, 1114, 24165, 1114, 294, 19707, 18, 588, 424, 20603, 3621, 10756, 288, 203, 5411, 309, 261, 8913, 30708, 1114, 480, 446, 13, 288, 203, 7734, 364, 261, 424, 20603, 24165, 294, 24165, 1114, 18, 588, 424, 12610, 6141, 10756, 288, 203, 10792, 24165, 1179, 18, 3733, 12, 8913, 30708, 18, 26321, 9334, 638, 16, 638, 1769, 203, 7734, 289, 203, 5411, 289, 203, 3639, 289, 203, 3639, 1430, 30420, 310, 5587, 951, 424, 301, 12, 338, 301, 1769, 203, 3639, 19707, 3305, 18, 3733, 5132, 12, 338, 301, 18, 26321, 10663, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 8065, 281, 326, 19707, 471, 18853, 715, 6277, 777, 1931, 2186, 471, 9792, 777, 2186, 3627, 598, 326, 203, 377, 380, 19707, 6508, 30, 203, 377, 380, 411, 332, 34, 203, 377, 380, 377, 411, 549, 34, 1986, 1312, 301, 1757, 549, 34, 203, 377, 380, 377, 411, 549, 34, 1595, 1312, 20603, 3621, 1757, 549, 34, 203, 377, 380, 377, 411, 549, 34, 1595, 1312, 12610, 6141, 6508, 30, 203, 377, 380, 377, 2592, 7300, 16, 6393, 24629, 1012, 16, 10351, 16, 30111, 471, 1361, 21440, 16, 2621, 8901, 1232, 1312, 20603, 1179, 7, 3733, 12863, 549, 34, 203, 377, 380, 377, 411, 549, 34, 1595, 934, 1100, 319, 424, 301, 87, 1757, 549, 34, 203, 377, 380, 377, 411, 549, 2 ]
149ac9ebcbc48e7571ea3ff315cb4c11bbf8d26e
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/service/exam/ExamService.java
[ "MIT" ]
Java
calculateExamScores
ExamScoresDTO
public ExamScoresDTO calculateExamScores(Long examId) { Exam exam = examRepository.findWithExerciseGroupsAndExercisesById(examId).orElseThrow(() -> new EntityNotFoundException("Exam", examId)); List<StudentParticipation> studentParticipations = studentParticipationRepository.findByExamIdWithSubmissionRelevantResult(examId); // without test run participations // Adding exam information to DTO ExamScoresDTO scores = new ExamScoresDTO(exam.getId(), exam.getTitle(), exam.getMaxPoints()); // setting multiplicity of correction rounds scores.hasSecondCorrectionAndStarted = false; // Counts how many participants each exercise has Map<Long, Long> exerciseIdToNumberParticipations = studentParticipations.stream() .collect(Collectors.groupingBy(studentParticipation -> studentParticipation.getExercise().getId(), Collectors.counting())); // Adding exercise group information to DTO for (ExerciseGroup exerciseGroup : exam.getExerciseGroups()) { // Find the maximum points for this exercise group OptionalDouble optionalMaxPointsGroup = exerciseGroup.getExercises().stream().mapToDouble(Exercise::getMaxPoints).max(); Double maxPointsGroup = optionalMaxPointsGroup.orElse(0); // Counter for exerciseGroup participations. Is calculated by summing up the number of exercise participations long numberOfExerciseGroupParticipants = 0; // Add information about exercise groups and exercises var exerciseGroupDTO = new ExamScoresDTO.ExerciseGroup(exerciseGroup.getId(), exerciseGroup.getTitle(), maxPointsGroup); for (Exercise exercise : exerciseGroup.getExercises()) { Long participantsForExercise = exerciseIdToNumberParticipations.get(exercise.getId()); // If no participation exists for an exercise then no entry exists in the map if (participantsForExercise == null) { participantsForExercise = 0L; } numberOfExerciseGroupParticipants += participantsForExercise; exerciseGroupDTO.containedExercises.add(new ExamScoresDTO.ExerciseGroup.ExerciseInfo(exercise.getId(), exercise.getTitle(), exercise.getMaxPoints(), participantsForExercise, exercise.getClass().getSimpleName())); } exerciseGroupDTO.numberOfParticipants = numberOfExerciseGroupParticipants; scores.exerciseGroups.add(exerciseGroupDTO); } // Adding registered student information to DTO Set<StudentExam> studentExams = studentExamRepository.findByExamId(examId); // fetched without test runs ObjectMapper objectMapper = new ObjectMapper(); for (StudentExam studentExam : studentExams) { User user = studentExam.getUser(); var studentResult = new ExamScoresDTO.StudentResult(user.getId(), user.getName(), user.getEmail(), user.getLogin(), user.getRegistrationNumber(), studentExam.isSubmitted()); // Adding student results information to DTO List<StudentParticipation> participationsOfStudent = studentParticipations.stream() .filter(studentParticipation -> studentParticipation.getStudent().get().getId().equals(studentResult.userId)).collect(Collectors.toList()); studentResult.overallPointsAchieved = 0.0; studentResult.overallPointsAchievedInFirstCorrection = 0.0; for (StudentParticipation studentParticipation : participationsOfStudent) { Exercise exercise = studentParticipation.getExercise(); // Relevant Result is already calculated if (studentParticipation.getResults() != null && !studentParticipation.getResults().isEmpty()) { Result relevantResult = studentParticipation.getResults().iterator().next(); // Note: It is important that we round on the individual exercise level first and then sum up. // This is necessary so that the student arrives at the same overall result when doing his own recalculation. // Let's assume that the student achieved 1.05 points in each of 5 exercises. // In the client, these are now displayed rounded as 1.1 points. // If the student adds up the displayed points, he gets a total of 5.5 points. // In order to get the same total result as the student, we have to round before summing. double achievedPoints = roundScoreSpecifiedByCourseSettings(relevantResult.getScore() / 100.0 * exercise.getMaxPoints(), exam.getCourse()); // points earned in NOT_INCLUDED exercises do not count towards the students result in the exam if (!exercise.getIncludedInOverallScore().equals(IncludedInOverallScore.NOT_INCLUDED)) { studentResult.overallPointsAchieved += achievedPoints; } // collect points of first correction, if a second correction exists if (exam.getNumberOfCorrectionRoundsInExam() == 2 && !exercise.getIncludedInOverallScore().equals(IncludedInOverallScore.NOT_INCLUDED)) { Optional<Submission> latestSubmission = studentParticipation.findLatestSubmission(); if (latestSubmission.isPresent()) { Submission submission = latestSubmission.get(); // Check if second correction already started if (submission.getManualResults().size() > 1) { if (!scores.hasSecondCorrectionAndStarted) { scores.hasSecondCorrectionAndStarted = true; } Result firstManualResult = submission.getFirstManualResult(); double achievedPointsInFirstCorrection = 0.0; if (firstManualResult != null) { Double resultScore = firstManualResult.getScore(); achievedPointsInFirstCorrection = resultScore != null ? roundScoreSpecifiedByCourseSettings(resultScore / 100.0 * exercise.getMaxPoints(), exam.getCourse()) : 0.0; } studentResult.overallPointsAchievedInFirstCorrection += achievedPointsInFirstCorrection; } } } // Check whether the student attempted to solve the exercise boolean hasNonEmptySubmission = hasNonEmptySubmission(studentParticipation.getSubmissions(), exercise, objectMapper); studentResult.exerciseGroupIdToExerciseResult.put(exercise.getExerciseGroup().getId(), new ExamScoresDTO.ExerciseResult(exercise.getId(), exercise.getTitle(), exercise.getMaxPoints(), relevantResult.getScore(), achievedPoints, hasNonEmptySubmission)); } } if (scores.maxPoints != null) { studentResult.overallScoreAchieved = (studentResult.overallPointsAchieved / scores.maxPoints) * 100.0; var overallScoreAchievedInFirstCorrection = (studentResult.overallPointsAchievedInFirstCorrection / scores.maxPoints) * 100.0; // Sets grading scale related properties for exam scores Optional<GradingScale> gradingScale = gradingScaleRepository.findByExamId(examId); if (gradingScale.isPresent()) { // Calculate current student grade GradeStep studentGrade = gradingScaleRepository.matchPercentageToGradeStep(studentResult.overallScoreAchieved, gradingScale.get().getId()); GradeStep studentGradeInFirstCorrection = gradingScaleRepository.matchPercentageToGradeStep(overallScoreAchievedInFirstCorrection, gradingScale.get().getId()); studentResult.overallGrade = studentGrade.getGradeName(); studentResult.overallGradeInFirstCorrection = studentGradeInFirstCorrection.getGradeName(); studentResult.hasPassed = studentGrade.getIsPassingGrade(); } } scores.studentResults.add(studentResult); } // Updating exam information in DTO double sumOverallPoints = scores.studentResults.stream().mapToDouble(studentResult -> studentResult.overallPointsAchieved).sum(); int numberOfStudentResults = scores.studentResults.size(); if (numberOfStudentResults != 0) { scores.averagePointsAchieved = sumOverallPoints / numberOfStudentResults; } return scores; }
/** * Puts students, result and exerciseGroups together for ExamScoresDTO * * @param examId the id of the exam * @return return ExamScoresDTO with students, scores and exerciseGroups for exam */
Puts students, result and exerciseGroups together for ExamScoresDTO @param examId the id of the exam @return return ExamScoresDTO with students, scores and exerciseGroups for exam
[ "Puts", "students", "result", "and", "exerciseGroups", "together", "for", "ExamScoresDTO", "@param", "examId", "the", "id", "of", "the", "exam", "@return", "return", "ExamScoresDTO", "with", "students", "scores", "and", "exerciseGroups", "for", "exam" ]
public ExamScoresDTO calculateExamScores(Long examId) { Exam exam = examRepository.findWithExerciseGroupsAndExercisesById(examId).orElseThrow(() -> new EntityNotFoundException("Exam", examId)); List<StudentParticipation> studentParticipations = studentParticipationRepository.findByExamIdWithSubmissionRelevantResult(examId); ExamScoresDTO scores = new ExamScoresDTO(exam.getId(), exam.getTitle(), exam.getMaxPoints()); scores.hasSecondCorrectionAndStarted = false; Map<Long, Long> exerciseIdToNumberParticipations = studentParticipations.stream() .collect(Collectors.groupingBy(studentParticipation -> studentParticipation.getExercise().getId(), Collectors.counting())); for (ExerciseGroup exerciseGroup : exam.getExerciseGroups()) { OptionalDouble optionalMaxPointsGroup = exerciseGroup.getExercises().stream().mapToDouble(Exercise::getMaxPoints).max(); Double maxPointsGroup = optionalMaxPointsGroup.orElse(0); long numberOfExerciseGroupParticipants = 0; var exerciseGroupDTO = new ExamScoresDTO.ExerciseGroup(exerciseGroup.getId(), exerciseGroup.getTitle(), maxPointsGroup); for (Exercise exercise : exerciseGroup.getExercises()) { Long participantsForExercise = exerciseIdToNumberParticipations.get(exercise.getId()); if (participantsForExercise == null) { participantsForExercise = 0L; } numberOfExerciseGroupParticipants += participantsForExercise; exerciseGroupDTO.containedExercises.add(new ExamScoresDTO.ExerciseGroup.ExerciseInfo(exercise.getId(), exercise.getTitle(), exercise.getMaxPoints(), participantsForExercise, exercise.getClass().getSimpleName())); } exerciseGroupDTO.numberOfParticipants = numberOfExerciseGroupParticipants; scores.exerciseGroups.add(exerciseGroupDTO); } Set<StudentExam> studentExams = studentExamRepository.findByExamId(examId); ObjectMapper objectMapper = new ObjectMapper(); for (StudentExam studentExam : studentExams) { User user = studentExam.getUser(); var studentResult = new ExamScoresDTO.StudentResult(user.getId(), user.getName(), user.getEmail(), user.getLogin(), user.getRegistrationNumber(), studentExam.isSubmitted()); List<StudentParticipation> participationsOfStudent = studentParticipations.stream() .filter(studentParticipation -> studentParticipation.getStudent().get().getId().equals(studentResult.userId)).collect(Collectors.toList()); studentResult.overallPointsAchieved = 0.0; studentResult.overallPointsAchievedInFirstCorrection = 0.0; for (StudentParticipation studentParticipation : participationsOfStudent) { Exercise exercise = studentParticipation.getExercise(); if (studentParticipation.getResults() != null && !studentParticipation.getResults().isEmpty()) { Result relevantResult = studentParticipation.getResults().iterator().next(); double achievedPoints = roundScoreSpecifiedByCourseSettings(relevantResult.getScore() / 100.0 * exercise.getMaxPoints(), exam.getCourse()); if (!exercise.getIncludedInOverallScore().equals(IncludedInOverallScore.NOT_INCLUDED)) { studentResult.overallPointsAchieved += achievedPoints; } if (exam.getNumberOfCorrectionRoundsInExam() == 2 && !exercise.getIncludedInOverallScore().equals(IncludedInOverallScore.NOT_INCLUDED)) { Optional<Submission> latestSubmission = studentParticipation.findLatestSubmission(); if (latestSubmission.isPresent()) { Submission submission = latestSubmission.get(); if (submission.getManualResults().size() > 1) { if (!scores.hasSecondCorrectionAndStarted) { scores.hasSecondCorrectionAndStarted = true; } Result firstManualResult = submission.getFirstManualResult(); double achievedPointsInFirstCorrection = 0.0; if (firstManualResult != null) { Double resultScore = firstManualResult.getScore(); achievedPointsInFirstCorrection = resultScore != null ? roundScoreSpecifiedByCourseSettings(resultScore / 100.0 * exercise.getMaxPoints(), exam.getCourse()) : 0.0; } studentResult.overallPointsAchievedInFirstCorrection += achievedPointsInFirstCorrection; } } } boolean hasNonEmptySubmission = hasNonEmptySubmission(studentParticipation.getSubmissions(), exercise, objectMapper); studentResult.exerciseGroupIdToExerciseResult.put(exercise.getExerciseGroup().getId(), new ExamScoresDTO.ExerciseResult(exercise.getId(), exercise.getTitle(), exercise.getMaxPoints(), relevantResult.getScore(), achievedPoints, hasNonEmptySubmission)); } } if (scores.maxPoints != null) { studentResult.overallScoreAchieved = (studentResult.overallPointsAchieved / scores.maxPoints) * 100.0; var overallScoreAchievedInFirstCorrection = (studentResult.overallPointsAchievedInFirstCorrection / scores.maxPoints) * 100.0; Optional<GradingScale> gradingScale = gradingScaleRepository.findByExamId(examId); if (gradingScale.isPresent()) { GradeStep studentGrade = gradingScaleRepository.matchPercentageToGradeStep(studentResult.overallScoreAchieved, gradingScale.get().getId()); GradeStep studentGradeInFirstCorrection = gradingScaleRepository.matchPercentageToGradeStep(overallScoreAchievedInFirstCorrection, gradingScale.get().getId()); studentResult.overallGrade = studentGrade.getGradeName(); studentResult.overallGradeInFirstCorrection = studentGradeInFirstCorrection.getGradeName(); studentResult.hasPassed = studentGrade.getIsPassingGrade(); } } scores.studentResults.add(studentResult); } double sumOverallPoints = scores.studentResults.stream().mapToDouble(studentResult -> studentResult.overallPointsAchieved).sum(); int numberOfStudentResults = scores.studentResults.size(); if (numberOfStudentResults != 0) { scores.averagePointsAchieved = sumOverallPoints / numberOfStudentResults; } return scores; }
[ "public", "ExamScoresDTO", "calculateExamScores", "(", "Long", "examId", ")", "{", "Exam", "exam", "=", "examRepository", ".", "findWithExerciseGroupsAndExercisesById", "(", "examId", ")", ".", "orElseThrow", "(", "(", ")", "->", "new", "EntityNotFoundException", "(", "\"Exam\"", ",", "examId", ")", ")", ";", "List", "<", "StudentParticipation", ">", "studentParticipations", "=", "studentParticipationRepository", ".", "findByExamIdWithSubmissionRelevantResult", "(", "examId", ")", ";", "ExamScoresDTO", "scores", "=", "new", "ExamScoresDTO", "(", "exam", ".", "getId", "(", ")", ",", "exam", ".", "getTitle", "(", ")", ",", "exam", ".", "getMaxPoints", "(", ")", ")", ";", "scores", ".", "hasSecondCorrectionAndStarted", "=", "false", ";", "Map", "<", "Long", ",", "Long", ">", "exerciseIdToNumberParticipations", "=", "studentParticipations", ".", "stream", "(", ")", ".", "collect", "(", "Collectors", ".", "groupingBy", "(", "studentParticipation", "->", "studentParticipation", ".", "getExercise", "(", ")", ".", "getId", "(", ")", ",", "Collectors", ".", "counting", "(", ")", ")", ")", ";", "for", "(", "ExerciseGroup", "exerciseGroup", ":", "exam", ".", "getExerciseGroups", "(", ")", ")", "{", "OptionalDouble", "optionalMaxPointsGroup", "=", "exerciseGroup", ".", "getExercises", "(", ")", ".", "stream", "(", ")", ".", "mapToDouble", "(", "Exercise", "::", "getMaxPoints", ")", ".", "max", "(", ")", ";", "Double", "maxPointsGroup", "=", "optionalMaxPointsGroup", ".", "orElse", "(", "0", ")", ";", "long", "numberOfExerciseGroupParticipants", "=", "0", ";", "var", "exerciseGroupDTO", "=", "new", "ExamScoresDTO", ".", "ExerciseGroup", "(", "exerciseGroup", ".", "getId", "(", ")", ",", "exerciseGroup", ".", "getTitle", "(", ")", ",", "maxPointsGroup", ")", ";", "for", "(", "Exercise", "exercise", ":", "exerciseGroup", ".", "getExercises", "(", ")", ")", "{", "Long", "participantsForExercise", "=", "exerciseIdToNumberParticipations", ".", "get", "(", "exercise", ".", "getId", "(", ")", ")", ";", "if", "(", "participantsForExercise", "==", "null", ")", "{", "participantsForExercise", "=", "0L", ";", "}", "numberOfExerciseGroupParticipants", "+=", "participantsForExercise", ";", "exerciseGroupDTO", ".", "containedExercises", ".", "add", "(", "new", "ExamScoresDTO", ".", "ExerciseGroup", ".", "ExerciseInfo", "(", "exercise", ".", "getId", "(", ")", ",", "exercise", ".", "getTitle", "(", ")", ",", "exercise", ".", "getMaxPoints", "(", ")", ",", "participantsForExercise", ",", "exercise", ".", "getClass", "(", ")", ".", "getSimpleName", "(", ")", ")", ")", ";", "}", "exerciseGroupDTO", ".", "numberOfParticipants", "=", "numberOfExerciseGroupParticipants", ";", "scores", ".", "exerciseGroups", ".", "add", "(", "exerciseGroupDTO", ")", ";", "}", "Set", "<", "StudentExam", ">", "studentExams", "=", "studentExamRepository", ".", "findByExamId", "(", "examId", ")", ";", "ObjectMapper", "objectMapper", "=", "new", "ObjectMapper", "(", ")", ";", "for", "(", "StudentExam", "studentExam", ":", "studentExams", ")", "{", "User", "user", "=", "studentExam", ".", "getUser", "(", ")", ";", "var", "studentResult", "=", "new", "ExamScoresDTO", ".", "StudentResult", "(", "user", ".", "getId", "(", ")", ",", "user", ".", "getName", "(", ")", ",", "user", ".", "getEmail", "(", ")", ",", "user", ".", "getLogin", "(", ")", ",", "user", ".", "getRegistrationNumber", "(", ")", ",", "studentExam", ".", "isSubmitted", "(", ")", ")", ";", "List", "<", "StudentParticipation", ">", "participationsOfStudent", "=", "studentParticipations", ".", "stream", "(", ")", ".", "filter", "(", "studentParticipation", "->", "studentParticipation", ".", "getStudent", "(", ")", ".", "get", "(", ")", ".", "getId", "(", ")", ".", "equals", "(", "studentResult", ".", "userId", ")", ")", ".", "collect", "(", "Collectors", ".", "toList", "(", ")", ")", ";", "studentResult", ".", "overallPointsAchieved", "=", "0.0", ";", "studentResult", ".", "overallPointsAchievedInFirstCorrection", "=", "0.0", ";", "for", "(", "StudentParticipation", "studentParticipation", ":", "participationsOfStudent", ")", "{", "Exercise", "exercise", "=", "studentParticipation", ".", "getExercise", "(", ")", ";", "if", "(", "studentParticipation", ".", "getResults", "(", ")", "!=", "null", "&&", "!", "studentParticipation", ".", "getResults", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "Result", "relevantResult", "=", "studentParticipation", ".", "getResults", "(", ")", ".", "iterator", "(", ")", ".", "next", "(", ")", ";", "double", "achievedPoints", "=", "roundScoreSpecifiedByCourseSettings", "(", "relevantResult", ".", "getScore", "(", ")", "/", "100.0", "*", "exercise", ".", "getMaxPoints", "(", ")", ",", "exam", ".", "getCourse", "(", ")", ")", ";", "if", "(", "!", "exercise", ".", "getIncludedInOverallScore", "(", ")", ".", "equals", "(", "IncludedInOverallScore", ".", "NOT_INCLUDED", ")", ")", "{", "studentResult", ".", "overallPointsAchieved", "+=", "achievedPoints", ";", "}", "if", "(", "exam", ".", "getNumberOfCorrectionRoundsInExam", "(", ")", "==", "2", "&&", "!", "exercise", ".", "getIncludedInOverallScore", "(", ")", ".", "equals", "(", "IncludedInOverallScore", ".", "NOT_INCLUDED", ")", ")", "{", "Optional", "<", "Submission", ">", "latestSubmission", "=", "studentParticipation", ".", "findLatestSubmission", "(", ")", ";", "if", "(", "latestSubmission", ".", "isPresent", "(", ")", ")", "{", "Submission", "submission", "=", "latestSubmission", ".", "get", "(", ")", ";", "if", "(", "submission", ".", "getManualResults", "(", ")", ".", "size", "(", ")", ">", "1", ")", "{", "if", "(", "!", "scores", ".", "hasSecondCorrectionAndStarted", ")", "{", "scores", ".", "hasSecondCorrectionAndStarted", "=", "true", ";", "}", "Result", "firstManualResult", "=", "submission", ".", "getFirstManualResult", "(", ")", ";", "double", "achievedPointsInFirstCorrection", "=", "0.0", ";", "if", "(", "firstManualResult", "!=", "null", ")", "{", "Double", "resultScore", "=", "firstManualResult", ".", "getScore", "(", ")", ";", "achievedPointsInFirstCorrection", "=", "resultScore", "!=", "null", "?", "roundScoreSpecifiedByCourseSettings", "(", "resultScore", "/", "100.0", "*", "exercise", ".", "getMaxPoints", "(", ")", ",", "exam", ".", "getCourse", "(", ")", ")", ":", "0.0", ";", "}", "studentResult", ".", "overallPointsAchievedInFirstCorrection", "+=", "achievedPointsInFirstCorrection", ";", "}", "}", "}", "boolean", "hasNonEmptySubmission", "=", "hasNonEmptySubmission", "(", "studentParticipation", ".", "getSubmissions", "(", ")", ",", "exercise", ",", "objectMapper", ")", ";", "studentResult", ".", "exerciseGroupIdToExerciseResult", ".", "put", "(", "exercise", ".", "getExerciseGroup", "(", ")", ".", "getId", "(", ")", ",", "new", "ExamScoresDTO", ".", "ExerciseResult", "(", "exercise", ".", "getId", "(", ")", ",", "exercise", ".", "getTitle", "(", ")", ",", "exercise", ".", "getMaxPoints", "(", ")", ",", "relevantResult", ".", "getScore", "(", ")", ",", "achievedPoints", ",", "hasNonEmptySubmission", ")", ")", ";", "}", "}", "if", "(", "scores", ".", "maxPoints", "!=", "null", ")", "{", "studentResult", ".", "overallScoreAchieved", "=", "(", "studentResult", ".", "overallPointsAchieved", "/", "scores", ".", "maxPoints", ")", "*", "100.0", ";", "var", "overallScoreAchievedInFirstCorrection", "=", "(", "studentResult", ".", "overallPointsAchievedInFirstCorrection", "/", "scores", ".", "maxPoints", ")", "*", "100.0", ";", "Optional", "<", "GradingScale", ">", "gradingScale", "=", "gradingScaleRepository", ".", "findByExamId", "(", "examId", ")", ";", "if", "(", "gradingScale", ".", "isPresent", "(", ")", ")", "{", "GradeStep", "studentGrade", "=", "gradingScaleRepository", ".", "matchPercentageToGradeStep", "(", "studentResult", ".", "overallScoreAchieved", ",", "gradingScale", ".", "get", "(", ")", ".", "getId", "(", ")", ")", ";", "GradeStep", "studentGradeInFirstCorrection", "=", "gradingScaleRepository", ".", "matchPercentageToGradeStep", "(", "overallScoreAchievedInFirstCorrection", ",", "gradingScale", ".", "get", "(", ")", ".", "getId", "(", ")", ")", ";", "studentResult", ".", "overallGrade", "=", "studentGrade", ".", "getGradeName", "(", ")", ";", "studentResult", ".", "overallGradeInFirstCorrection", "=", "studentGradeInFirstCorrection", ".", "getGradeName", "(", ")", ";", "studentResult", ".", "hasPassed", "=", "studentGrade", ".", "getIsPassingGrade", "(", ")", ";", "}", "}", "scores", ".", "studentResults", ".", "add", "(", "studentResult", ")", ";", "}", "double", "sumOverallPoints", "=", "scores", ".", "studentResults", ".", "stream", "(", ")", ".", "mapToDouble", "(", "studentResult", "->", "studentResult", ".", "overallPointsAchieved", ")", ".", "sum", "(", ")", ";", "int", "numberOfStudentResults", "=", "scores", ".", "studentResults", ".", "size", "(", ")", ";", "if", "(", "numberOfStudentResults", "!=", "0", ")", "{", "scores", ".", "averagePointsAchieved", "=", "sumOverallPoints", "/", "numberOfStudentResults", ";", "}", "return", "scores", ";", "}" ]
Puts students, result and exerciseGroups together for ExamScoresDTO @param examId the id of the exam @return return ExamScoresDTO with students, scores and exerciseGroups for exam
[ "Puts", "students", "result", "and", "exerciseGroups", "together", "for", "ExamScoresDTO", "@param", "examId", "the", "id", "of", "the", "exam", "@return", "return", "ExamScoresDTO", "with", "students", "scores", "and", "exerciseGroups", "for", "exam" ]
[ "// without test run participations", "// Adding exam information to DTO", "// setting multiplicity of correction rounds", "// Counts how many participants each exercise has", "// Adding exercise group information to DTO", "// Find the maximum points for this exercise group", "// Counter for exerciseGroup participations. Is calculated by summing up the number of exercise participations", "// Add information about exercise groups and exercises", "// If no participation exists for an exercise then no entry exists in the map", "// Adding registered student information to DTO", "// fetched without test runs", "// Adding student results information to DTO", "// Relevant Result is already calculated", "// Note: It is important that we round on the individual exercise level first and then sum up.", "// This is necessary so that the student arrives at the same overall result when doing his own recalculation.", "// Let's assume that the student achieved 1.05 points in each of 5 exercises.", "// In the client, these are now displayed rounded as 1.1 points.", "// If the student adds up the displayed points, he gets a total of 5.5 points.", "// In order to get the same total result as the student, we have to round before summing.", "// points earned in NOT_INCLUDED exercises do not count towards the students result in the exam", "// collect points of first correction, if a second correction exists", "// Check if second correction already started", "// Check whether the student attempted to solve the exercise", "// Sets grading scale related properties for exam scores", "// Calculate current student grade", "// Updating exam information in DTO" ]
[ { "param": "examId", "type": "Long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "examId", "type": "Long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 1312, 301, 20037, 19792, 4604, 424, 301, 20037, 12, 3708, 19707, 548, 13, 288, 203, 3639, 1312, 301, 19707, 273, 19707, 3305, 18, 4720, 1190, 424, 20603, 3621, 1876, 424, 12610, 6141, 5132, 12, 338, 301, 548, 2934, 280, 12427, 8282, 12, 1435, 317, 394, 3887, 3990, 2932, 424, 301, 3113, 19707, 548, 10019, 203, 203, 3639, 987, 32, 19943, 319, 1988, 24629, 367, 34, 18110, 1988, 24629, 1012, 273, 18110, 1988, 24629, 367, 3305, 18, 4720, 858, 424, 301, 548, 1190, 17865, 17018, 7445, 1253, 12, 338, 301, 548, 1769, 368, 2887, 1842, 1086, 30891, 1012, 203, 203, 3639, 368, 21240, 19707, 1779, 358, 463, 4296, 203, 3639, 1312, 301, 20037, 19792, 8474, 273, 394, 1312, 301, 20037, 19792, 12, 338, 301, 18, 26321, 9334, 19707, 18, 588, 4247, 9334, 19707, 18, 588, 2747, 5636, 10663, 203, 203, 3639, 368, 3637, 3309, 20458, 434, 15104, 21196, 203, 3639, 8474, 18, 5332, 8211, 20884, 1876, 9217, 273, 629, 31, 203, 203, 3639, 368, 6974, 87, 3661, 4906, 22346, 1517, 24165, 711, 203, 3639, 1635, 32, 3708, 16, 3407, 34, 24165, 28803, 1854, 1988, 24629, 1012, 273, 18110, 1988, 24629, 1012, 18, 3256, 1435, 203, 7734, 263, 14676, 12, 10808, 1383, 18, 25592, 858, 12, 26240, 1988, 24629, 367, 317, 18110, 1988, 24629, 367, 18, 588, 424, 20603, 7675, 26321, 9334, 13994, 18, 1883, 310, 1435, 10019, 203, 203, 3639, 368, 21240, 24165, 1041, 1779, 358, 463, 4296, 203, 3639, 364, 261, 424, 20603, 1114, 24165, 1114, 294, 19707, 18, 588, 424, 20603, 3621, 10756, 288, 203, 5411, 368, 4163, 326, 4207, 3143, 364, 333, 24165, 1041, 203, 5411, 4055, 5265, 3129, 2747, 5636, 1114, 273, 24165, 1114, 18, 588, 424, 12610, 6141, 7675, 3256, 7675, 1458, 774, 5265, 12, 424, 20603, 2866, 588, 2747, 5636, 2934, 1896, 5621, 203, 5411, 3698, 943, 5636, 1114, 273, 3129, 2747, 5636, 1114, 18, 280, 12427, 12, 20, 1769, 203, 203, 5411, 368, 9354, 364, 24165, 1114, 30891, 1012, 18, 2585, 8894, 635, 2142, 11987, 731, 326, 1300, 434, 24165, 30891, 1012, 203, 5411, 1525, 7922, 424, 20603, 1114, 1988, 27620, 273, 374, 31, 203, 5411, 368, 1436, 1779, 2973, 24165, 3252, 471, 431, 12610, 6141, 203, 5411, 569, 24165, 1114, 19792, 273, 394, 1312, 301, 20037, 19792, 18, 424, 20603, 1114, 12, 8913, 30708, 1114, 18, 26321, 9334, 24165, 1114, 18, 588, 4247, 9334, 943, 5636, 1114, 1769, 203, 5411, 364, 261, 424, 20603, 24165, 294, 24165, 1114, 18, 588, 424, 12610, 6141, 10756, 288, 203, 7734, 3407, 22346, 1290, 424, 20603, 273, 24165, 28803, 1854, 1988, 24629, 1012, 18, 588, 12, 8913, 30708, 18, 26321, 10663, 203, 7734, 368, 971, 1158, 30891, 367, 1704, 364, 392, 24165, 1508, 1158, 1241, 1704, 316, 326, 852, 203, 7734, 309, 261, 2680, 27620, 1290, 424, 20603, 422, 446, 13, 288, 203, 10792, 22346, 1290, 424, 20603, 273, 374, 48, 31, 203, 7734, 289, 203, 7734, 7922, 424, 20603, 1114, 1988, 27620, 1011, 22346, 1290, 424, 20603, 31, 203, 7734, 24165, 1114, 19792, 18, 1213, 8707, 424, 12610, 6141, 18, 1289, 2 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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, 26873, 203, 377, 380, 4399, 87, 10068, 4877, 16, 563, 471, 24165, 3621, 9475, 364, 1312, 301, 20037, 19792, 203, 377, 380, 203, 377, 380, 632, 891, 19707, 548, 326, 612, 434, 326, 19707, 203, 377, 380, 632, 2463, 327, 1312, 301, 20037, 19792, 598, 10068, 4877, 16, 8474, 471, 24165, 3621, 364, 19707, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
149ac9ebcbc48e7571ea3ff315cb4c11bbf8d26e
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/service/exam/ExamService.java
[ "MIT" ]
Java
validateForStudentExamGeneration
null
public void validateForStudentExamGeneration(Exam exam) throws BadRequestAlertException { List<ExerciseGroup> exerciseGroups = exam.getExerciseGroups(); long numberOfExercises = exam.getNumberOfExercisesInExam() != null ? exam.getNumberOfExercisesInExam() : 0; long numberOfOptionalExercises = numberOfExercises - exerciseGroups.stream().filter(ExerciseGroup::getIsMandatory).count(); // Ensure that all exercise groups have at least one exercise for (ExerciseGroup exerciseGroup : exam.getExerciseGroups()) { if (exerciseGroup.getExercises().isEmpty()) { throw new BadRequestAlertException("All exercise groups must have at least one exercise", "Exam", "artemisApp.exam.validation.atLeastOneExercisePerExerciseGroup"); } } // Check that numberOfExercisesInExam is set if (exam.getNumberOfExercisesInExam() == null) { throw new BadRequestAlertException("The number of exercises in the exam is not set.", "Exam", "artemisApp.exam.validation.numberOfExercisesInExamNotSet"); } // Check that there are enough exercise groups if (exam.getExerciseGroups().size() < exam.getNumberOfExercisesInExam()) { throw new BadRequestAlertException("The number of exercise groups is too small", "Exam", "artemisApp.exam.validation.tooFewExerciseGroups"); } // Check that there are not too much mandatory exercise groups if (numberOfOptionalExercises < 0) { throw new BadRequestAlertException("The number of mandatory exercise groups is too large", "Exam", "artemisApp.exam.validation.tooManyMandatoryExerciseGroups"); } // Ensure that all exercises in an exercise group have the same meaning for the exam score calculation for (ExerciseGroup exerciseGroup : exam.getExerciseGroups()) { Set<IncludedInOverallScore> meaningsForScoreCalculation = exerciseGroup.getExercises().stream().map(Exercise::getIncludedInOverallScore).collect(Collectors.toSet()); if (meaningsForScoreCalculation.size() > 1) { throw new BadRequestAlertException("All exercises in an exercise group must have the same meaning for the exam score", "Exam", "artemisApp.exam.validation.allExercisesInExerciseGroupOfSameIncludedType"); } } // Check that the exam max points is set if (exam.getMaxPoints() == 0) { throw new BadRequestAlertException("The exam max points can not be 0.", "Exam", "artemisApp.exam.validation.maxPointsNotSet"); } // Ensure that all exercises in an exercise group have the same amount of max points and max bonus points for (ExerciseGroup exerciseGroup : exam.getExerciseGroups()) { Set<Double> allMaxPoints = exerciseGroup.getExercises().stream().map(Exercise::getMaxPoints).collect(Collectors.toSet()); Set<Double> allBonusPoints = exerciseGroup.getExercises().stream().map(Exercise::getBonusPoints).collect(Collectors.toSet()); if (allMaxPoints.size() > 1 || allBonusPoints.size() > 1) { throw new BadRequestAlertException("All exercises in an exercise group need to give the same amount of points", "Exam", "artemisApp.exam.validation.allExercisesInExerciseGroupGiveSameNumberOfPoints"); } } // Ensure that the sum of all max points of mandatory exercise groups is not bigger than the max points set in the exam // At this point we are already sure that each exercise group has at least one exercise, all exercises in the group have the same no of points // and all are of the same calculation type, therefore we can just use any as representation for the group here Double pointsReachableByMandatoryExercises = 0.0; Set<ExerciseGroup> mandatoryExerciseGroups = exam.getExerciseGroups().stream().filter(ExerciseGroup::getIsMandatory).collect(Collectors.toSet()); for (ExerciseGroup exerciseGroup : mandatoryExerciseGroups) { Exercise groupRepresentativeExercise = exerciseGroup.getExercises().stream().findAny().get(); if (groupRepresentativeExercise.getIncludedInOverallScore().equals(IncludedInOverallScore.INCLUDED_COMPLETELY)) { pointsReachableByMandatoryExercises += groupRepresentativeExercise.getMaxPoints(); } } if (pointsReachableByMandatoryExercises > exam.getMaxPoints()) { throw new BadRequestAlertException("Check that you set the exam max points correctly! The max points a student can earn in the mandatory exercise groups is too big", "Exam", "artemisApp.exam.validation.tooManyMaxPoints"); } // Ensure that the sum of all max points of all exercise groups is at least as big as the max points set in the exam Double pointsReachable = 0.0; for (ExerciseGroup exerciseGroup : exam.getExerciseGroups()) { Exercise groupRepresentativeExercise = exerciseGroup.getExercises().stream().findAny().get(); if (groupRepresentativeExercise.getIncludedInOverallScore().equals(IncludedInOverallScore.INCLUDED_COMPLETELY)) { pointsReachable += groupRepresentativeExercise.getMaxPoints(); } } if (pointsReachable < exam.getMaxPoints()) { throw new BadRequestAlertException("Check that you set the exam max points correctly! The max points a student can earn in the exercise groups is too low", "Exam", "artemisApp.exam.validation.tooFewMaxPoints"); } }
/** * Validates exercise settings. * * @param exam exam which is validated * @throws BadRequestAlertException an exception if the exam is not configured correctly */
Validates exercise settings. @param exam exam which is validated @throws BadRequestAlertException an exception if the exam is not configured correctly
[ "Validates", "exercise", "settings", ".", "@param", "exam", "exam", "which", "is", "validated", "@throws", "BadRequestAlertException", "an", "exception", "if", "the", "exam", "is", "not", "configured", "correctly" ]
public void validateForStudentExamGeneration(Exam exam) throws BadRequestAlertException { List<ExerciseGroup> exerciseGroups = exam.getExerciseGroups(); long numberOfExercises = exam.getNumberOfExercisesInExam() != null ? exam.getNumberOfExercisesInExam() : 0; long numberOfOptionalExercises = numberOfExercises - exerciseGroups.stream().filter(ExerciseGroup::getIsMandatory).count(); for (ExerciseGroup exerciseGroup : exam.getExerciseGroups()) { if (exerciseGroup.getExercises().isEmpty()) { throw new BadRequestAlertException("All exercise groups must have at least one exercise", "Exam", "artemisApp.exam.validation.atLeastOneExercisePerExerciseGroup"); } } if (exam.getNumberOfExercisesInExam() == null) { throw new BadRequestAlertException("The number of exercises in the exam is not set.", "Exam", "artemisApp.exam.validation.numberOfExercisesInExamNotSet"); } if (exam.getExerciseGroups().size() < exam.getNumberOfExercisesInExam()) { throw new BadRequestAlertException("The number of exercise groups is too small", "Exam", "artemisApp.exam.validation.tooFewExerciseGroups"); } if (numberOfOptionalExercises < 0) { throw new BadRequestAlertException("The number of mandatory exercise groups is too large", "Exam", "artemisApp.exam.validation.tooManyMandatoryExerciseGroups"); } for (ExerciseGroup exerciseGroup : exam.getExerciseGroups()) { Set<IncludedInOverallScore> meaningsForScoreCalculation = exerciseGroup.getExercises().stream().map(Exercise::getIncludedInOverallScore).collect(Collectors.toSet()); if (meaningsForScoreCalculation.size() > 1) { throw new BadRequestAlertException("All exercises in an exercise group must have the same meaning for the exam score", "Exam", "artemisApp.exam.validation.allExercisesInExerciseGroupOfSameIncludedType"); } } if (exam.getMaxPoints() == 0) { throw new BadRequestAlertException("The exam max points can not be 0.", "Exam", "artemisApp.exam.validation.maxPointsNotSet"); } for (ExerciseGroup exerciseGroup : exam.getExerciseGroups()) { Set<Double> allMaxPoints = exerciseGroup.getExercises().stream().map(Exercise::getMaxPoints).collect(Collectors.toSet()); Set<Double> allBonusPoints = exerciseGroup.getExercises().stream().map(Exercise::getBonusPoints).collect(Collectors.toSet()); if (allMaxPoints.size() > 1 || allBonusPoints.size() > 1) { throw new BadRequestAlertException("All exercises in an exercise group need to give the same amount of points", "Exam", "artemisApp.exam.validation.allExercisesInExerciseGroupGiveSameNumberOfPoints"); } } Double pointsReachableByMandatoryExercises = 0.0; Set<ExerciseGroup> mandatoryExerciseGroups = exam.getExerciseGroups().stream().filter(ExerciseGroup::getIsMandatory).collect(Collectors.toSet()); for (ExerciseGroup exerciseGroup : mandatoryExerciseGroups) { Exercise groupRepresentativeExercise = exerciseGroup.getExercises().stream().findAny().get(); if (groupRepresentativeExercise.getIncludedInOverallScore().equals(IncludedInOverallScore.INCLUDED_COMPLETELY)) { pointsReachableByMandatoryExercises += groupRepresentativeExercise.getMaxPoints(); } } if (pointsReachableByMandatoryExercises > exam.getMaxPoints()) { throw new BadRequestAlertException("Check that you set the exam max points correctly! The max points a student can earn in the mandatory exercise groups is too big", "Exam", "artemisApp.exam.validation.tooManyMaxPoints"); } Double pointsReachable = 0.0; for (ExerciseGroup exerciseGroup : exam.getExerciseGroups()) { Exercise groupRepresentativeExercise = exerciseGroup.getExercises().stream().findAny().get(); if (groupRepresentativeExercise.getIncludedInOverallScore().equals(IncludedInOverallScore.INCLUDED_COMPLETELY)) { pointsReachable += groupRepresentativeExercise.getMaxPoints(); } } if (pointsReachable < exam.getMaxPoints()) { throw new BadRequestAlertException("Check that you set the exam max points correctly! The max points a student can earn in the exercise groups is too low", "Exam", "artemisApp.exam.validation.tooFewMaxPoints"); } }
[ "public", "void", "validateForStudentExamGeneration", "(", "Exam", "exam", ")", "throws", "BadRequestAlertException", "{", "List", "<", "ExerciseGroup", ">", "exerciseGroups", "=", "exam", ".", "getExerciseGroups", "(", ")", ";", "long", "numberOfExercises", "=", "exam", ".", "getNumberOfExercisesInExam", "(", ")", "!=", "null", "?", "exam", ".", "getNumberOfExercisesInExam", "(", ")", ":", "0", ";", "long", "numberOfOptionalExercises", "=", "numberOfExercises", "-", "exerciseGroups", ".", "stream", "(", ")", ".", "filter", "(", "ExerciseGroup", "::", "getIsMandatory", ")", ".", "count", "(", ")", ";", "for", "(", "ExerciseGroup", "exerciseGroup", ":", "exam", ".", "getExerciseGroups", "(", ")", ")", "{", "if", "(", "exerciseGroup", ".", "getExercises", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "BadRequestAlertException", "(", "\"All exercise groups must have at least one exercise\"", ",", "\"Exam\"", ",", "\"artemisApp.exam.validation.atLeastOneExercisePerExerciseGroup\"", ")", ";", "}", "}", "if", "(", "exam", ".", "getNumberOfExercisesInExam", "(", ")", "==", "null", ")", "{", "throw", "new", "BadRequestAlertException", "(", "\"The number of exercises in the exam is not set.\"", ",", "\"Exam\"", ",", "\"artemisApp.exam.validation.numberOfExercisesInExamNotSet\"", ")", ";", "}", "if", "(", "exam", ".", "getExerciseGroups", "(", ")", ".", "size", "(", ")", "<", "exam", ".", "getNumberOfExercisesInExam", "(", ")", ")", "{", "throw", "new", "BadRequestAlertException", "(", "\"The number of exercise groups is too small\"", ",", "\"Exam\"", ",", "\"artemisApp.exam.validation.tooFewExerciseGroups\"", ")", ";", "}", "if", "(", "numberOfOptionalExercises", "<", "0", ")", "{", "throw", "new", "BadRequestAlertException", "(", "\"The number of mandatory exercise groups is too large\"", ",", "\"Exam\"", ",", "\"artemisApp.exam.validation.tooManyMandatoryExerciseGroups\"", ")", ";", "}", "for", "(", "ExerciseGroup", "exerciseGroup", ":", "exam", ".", "getExerciseGroups", "(", ")", ")", "{", "Set", "<", "IncludedInOverallScore", ">", "meaningsForScoreCalculation", "=", "exerciseGroup", ".", "getExercises", "(", ")", ".", "stream", "(", ")", ".", "map", "(", "Exercise", "::", "getIncludedInOverallScore", ")", ".", "collect", "(", "Collectors", ".", "toSet", "(", ")", ")", ";", "if", "(", "meaningsForScoreCalculation", ".", "size", "(", ")", ">", "1", ")", "{", "throw", "new", "BadRequestAlertException", "(", "\"All exercises in an exercise group must have the same meaning for the exam score\"", ",", "\"Exam\"", ",", "\"artemisApp.exam.validation.allExercisesInExerciseGroupOfSameIncludedType\"", ")", ";", "}", "}", "if", "(", "exam", ".", "getMaxPoints", "(", ")", "==", "0", ")", "{", "throw", "new", "BadRequestAlertException", "(", "\"The exam max points can not be 0.\"", ",", "\"Exam\"", ",", "\"artemisApp.exam.validation.maxPointsNotSet\"", ")", ";", "}", "for", "(", "ExerciseGroup", "exerciseGroup", ":", "exam", ".", "getExerciseGroups", "(", ")", ")", "{", "Set", "<", "Double", ">", "allMaxPoints", "=", "exerciseGroup", ".", "getExercises", "(", ")", ".", "stream", "(", ")", ".", "map", "(", "Exercise", "::", "getMaxPoints", ")", ".", "collect", "(", "Collectors", ".", "toSet", "(", ")", ")", ";", "Set", "<", "Double", ">", "allBonusPoints", "=", "exerciseGroup", ".", "getExercises", "(", ")", ".", "stream", "(", ")", ".", "map", "(", "Exercise", "::", "getBonusPoints", ")", ".", "collect", "(", "Collectors", ".", "toSet", "(", ")", ")", ";", "if", "(", "allMaxPoints", ".", "size", "(", ")", ">", "1", "||", "allBonusPoints", ".", "size", "(", ")", ">", "1", ")", "{", "throw", "new", "BadRequestAlertException", "(", "\"All exercises in an exercise group need to give the same amount of points\"", ",", "\"Exam\"", ",", "\"artemisApp.exam.validation.allExercisesInExerciseGroupGiveSameNumberOfPoints\"", ")", ";", "}", "}", "Double", "pointsReachableByMandatoryExercises", "=", "0.0", ";", "Set", "<", "ExerciseGroup", ">", "mandatoryExerciseGroups", "=", "exam", ".", "getExerciseGroups", "(", ")", ".", "stream", "(", ")", ".", "filter", "(", "ExerciseGroup", "::", "getIsMandatory", ")", ".", "collect", "(", "Collectors", ".", "toSet", "(", ")", ")", ";", "for", "(", "ExerciseGroup", "exerciseGroup", ":", "mandatoryExerciseGroups", ")", "{", "Exercise", "groupRepresentativeExercise", "=", "exerciseGroup", ".", "getExercises", "(", ")", ".", "stream", "(", ")", ".", "findAny", "(", ")", ".", "get", "(", ")", ";", "if", "(", "groupRepresentativeExercise", ".", "getIncludedInOverallScore", "(", ")", ".", "equals", "(", "IncludedInOverallScore", ".", "INCLUDED_COMPLETELY", ")", ")", "{", "pointsReachableByMandatoryExercises", "+=", "groupRepresentativeExercise", ".", "getMaxPoints", "(", ")", ";", "}", "}", "if", "(", "pointsReachableByMandatoryExercises", ">", "exam", ".", "getMaxPoints", "(", ")", ")", "{", "throw", "new", "BadRequestAlertException", "(", "\"Check that you set the exam max points correctly! The max points a student can earn in the mandatory exercise groups is too big\"", ",", "\"Exam\"", ",", "\"artemisApp.exam.validation.tooManyMaxPoints\"", ")", ";", "}", "Double", "pointsReachable", "=", "0.0", ";", "for", "(", "ExerciseGroup", "exerciseGroup", ":", "exam", ".", "getExerciseGroups", "(", ")", ")", "{", "Exercise", "groupRepresentativeExercise", "=", "exerciseGroup", ".", "getExercises", "(", ")", ".", "stream", "(", ")", ".", "findAny", "(", ")", ".", "get", "(", ")", ";", "if", "(", "groupRepresentativeExercise", ".", "getIncludedInOverallScore", "(", ")", ".", "equals", "(", "IncludedInOverallScore", ".", "INCLUDED_COMPLETELY", ")", ")", "{", "pointsReachable", "+=", "groupRepresentativeExercise", ".", "getMaxPoints", "(", ")", ";", "}", "}", "if", "(", "pointsReachable", "<", "exam", ".", "getMaxPoints", "(", ")", ")", "{", "throw", "new", "BadRequestAlertException", "(", "\"Check that you set the exam max points correctly! The max points a student can earn in the exercise groups is too low\"", ",", "\"Exam\"", ",", "\"artemisApp.exam.validation.tooFewMaxPoints\"", ")", ";", "}", "}" ]
Validates exercise settings.
[ "Validates", "exercise", "settings", "." ]
[ "// Ensure that all exercise groups have at least one exercise", "// Check that numberOfExercisesInExam is set", "// Check that there are enough exercise groups", "// Check that there are not too much mandatory exercise groups", "// Ensure that all exercises in an exercise group have the same meaning for the exam score calculation", "// Check that the exam max points is set", "// Ensure that all exercises in an exercise group have the same amount of max points and max bonus points", "// Ensure that the sum of all max points of mandatory exercise groups is not bigger than the max points set in the exam", "// At this point we are already sure that each exercise group has at least one exercise, all exercises in the group have the same no of points", "// and all are of the same calculation type, therefore we can just use any as representation for the group here", "// Ensure that the sum of all max points of all exercise groups is at least as big as the max points set in the exam" ]
[ { "param": "exam", "type": "Exam" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "exam", "type": "Exam", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 918, 1954, 1290, 19943, 319, 424, 301, 13842, 12, 424, 301, 19707, 13, 1216, 23223, 13298, 503, 288, 203, 3639, 987, 32, 424, 20603, 1114, 34, 24165, 3621, 273, 19707, 18, 588, 424, 20603, 3621, 5621, 203, 3639, 1525, 7922, 424, 12610, 6141, 273, 19707, 18, 588, 9226, 424, 12610, 6141, 382, 424, 301, 1435, 480, 446, 692, 19707, 18, 588, 9226, 424, 12610, 6141, 382, 424, 301, 1435, 294, 374, 31, 203, 3639, 1525, 7922, 6542, 424, 12610, 6141, 273, 7922, 424, 12610, 6141, 300, 24165, 3621, 18, 3256, 7675, 2188, 12, 424, 20603, 1114, 2866, 588, 2520, 49, 10018, 2934, 1883, 5621, 203, 203, 3639, 368, 7693, 716, 777, 24165, 3252, 1240, 622, 4520, 1245, 24165, 203, 3639, 364, 261, 424, 20603, 1114, 24165, 1114, 294, 19707, 18, 588, 424, 20603, 3621, 10756, 288, 203, 5411, 309, 261, 8913, 30708, 1114, 18, 588, 424, 12610, 6141, 7675, 291, 1921, 10756, 288, 203, 7734, 604, 394, 23223, 13298, 503, 2932, 1595, 24165, 3252, 1297, 1240, 622, 4520, 1245, 24165, 3113, 315, 424, 301, 3113, 315, 485, 351, 291, 3371, 18, 338, 301, 18, 8685, 18, 270, 17319, 3335, 424, 20603, 2173, 424, 20603, 1114, 8863, 203, 5411, 289, 203, 3639, 289, 203, 203, 3639, 368, 2073, 716, 7922, 424, 12610, 6141, 382, 424, 301, 353, 444, 203, 3639, 309, 261, 338, 301, 18, 588, 9226, 424, 12610, 6141, 382, 424, 301, 1435, 422, 446, 13, 288, 203, 5411, 604, 394, 23223, 13298, 503, 2932, 1986, 1300, 434, 431, 12610, 6141, 316, 326, 19707, 353, 486, 444, 1199, 16, 315, 424, 301, 3113, 315, 485, 351, 291, 3371, 18, 338, 301, 18, 8685, 18, 2696, 951, 424, 12610, 6141, 382, 424, 301, 1248, 694, 8863, 203, 3639, 289, 203, 203, 3639, 368, 2073, 716, 1915, 854, 7304, 24165, 3252, 203, 3639, 309, 261, 338, 301, 18, 588, 424, 20603, 3621, 7675, 1467, 1435, 411, 19707, 18, 588, 9226, 424, 12610, 6141, 382, 424, 301, 10756, 288, 203, 5411, 604, 394, 23223, 13298, 503, 2932, 1986, 1300, 434, 24165, 3252, 353, 4885, 5264, 3113, 315, 424, 301, 3113, 315, 485, 351, 291, 3371, 18, 338, 301, 18, 8685, 18, 16431, 42, 359, 424, 20603, 3621, 8863, 203, 3639, 289, 203, 203, 3639, 368, 2073, 716, 1915, 854, 486, 4885, 9816, 11791, 24165, 3252, 203, 3639, 309, 261, 2696, 951, 6542, 424, 12610, 6141, 411, 374, 13, 288, 203, 5411, 604, 394, 23223, 13298, 503, 2932, 1986, 1300, 434, 11791, 24165, 3252, 353, 4885, 7876, 3113, 315, 424, 301, 3113, 315, 485, 351, 291, 3371, 18, 338, 301, 18, 8685, 18, 16431, 5594, 49, 10018, 424, 20603, 3621, 8863, 203, 3639, 289, 203, 203, 3639, 368, 7693, 716, 777, 431, 12610, 6141, 316, 392, 24165, 1041, 1240, 326, 1967, 12256, 364, 326, 19707, 4462, 11096, 203, 3639, 364, 261, 424, 20603, 1114, 24165, 1114, 294, 19707, 18, 588, 424, 20603, 3621, 10756, 288, 203, 5411, 1000, 32, 19323, 382, 4851, 454, 7295, 34, 3722, 899, 1290, 7295, 13989, 273, 24165, 1114, 18, 588, 424, 12610, 6141, 7675, 2 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
[ 1, 26873, 203, 377, 380, 2364, 815, 24165, 1947, 18, 203, 377, 380, 203, 377, 380, 632, 891, 19707, 19707, 1492, 353, 10266, 203, 377, 380, 632, 15069, 23223, 13298, 503, 392, 1520, 309, 326, 19707, 353, 486, 4351, 8783, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
149ac9ebcbc48e7571ea3ff315cb4c11bbf8d26e
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/service/exam/ExamService.java
[ "MIT" ]
Java
evaluateQuizExercises
Integer
public Integer evaluateQuizExercises(Long examId) { var exam = examRepository.findWithExerciseGroupsAndExercisesById(examId).orElseThrow(() -> new EntityNotFoundException("Exam", examId)); // Collect all quiz exercises for the given exam Set<QuizExercise> quizExercises = new HashSet<>(); for (ExerciseGroup exerciseGroup : exam.getExerciseGroups()) { for (Exercise exercise : exerciseGroup.getExercises()) { if (exercise instanceof QuizExercise) { quizExercises.add((QuizExercise) exercise); } } } long start = System.nanoTime(); log.info("Evaluating {} quiz exercises in exam {}", quizExercises.size(), examId); // Evaluate all quizzes for that exercise quizExercises.forEach(quiz -> examQuizService.evaluateQuizAndUpdateStatistics(quiz.getId())); log.info("Evaluated {} quiz exercises in exam {} in {}", quizExercises.size(), examId, TimeLogUtil.formatDurationFrom(start)); return quizExercises.size(); }
/** * Evaluates all the quiz exercises of an exam * * @param examId id of the exam for which the quiz exercises should be evaluated * @return number of evaluated exercises */
Evaluates all the quiz exercises of an exam @param examId id of the exam for which the quiz exercises should be evaluated @return number of evaluated exercises
[ "Evaluates", "all", "the", "quiz", "exercises", "of", "an", "exam", "@param", "examId", "id", "of", "the", "exam", "for", "which", "the", "quiz", "exercises", "should", "be", "evaluated", "@return", "number", "of", "evaluated", "exercises" ]
public Integer evaluateQuizExercises(Long examId) { var exam = examRepository.findWithExerciseGroupsAndExercisesById(examId).orElseThrow(() -> new EntityNotFoundException("Exam", examId)); Set<QuizExercise> quizExercises = new HashSet<>(); for (ExerciseGroup exerciseGroup : exam.getExerciseGroups()) { for (Exercise exercise : exerciseGroup.getExercises()) { if (exercise instanceof QuizExercise) { quizExercises.add((QuizExercise) exercise); } } } long start = System.nanoTime(); log.info("Evaluating {} quiz exercises in exam {}", quizExercises.size(), examId); quizExercises.forEach(quiz -> examQuizService.evaluateQuizAndUpdateStatistics(quiz.getId())); log.info("Evaluated {} quiz exercises in exam {} in {}", quizExercises.size(), examId, TimeLogUtil.formatDurationFrom(start)); return quizExercises.size(); }
[ "public", "Integer", "evaluateQuizExercises", "(", "Long", "examId", ")", "{", "var", "exam", "=", "examRepository", ".", "findWithExerciseGroupsAndExercisesById", "(", "examId", ")", ".", "orElseThrow", "(", "(", ")", "->", "new", "EntityNotFoundException", "(", "\"Exam\"", ",", "examId", ")", ")", ";", "Set", "<", "QuizExercise", ">", "quizExercises", "=", "new", "HashSet", "<", ">", "(", ")", ";", "for", "(", "ExerciseGroup", "exerciseGroup", ":", "exam", ".", "getExerciseGroups", "(", ")", ")", "{", "for", "(", "Exercise", "exercise", ":", "exerciseGroup", ".", "getExercises", "(", ")", ")", "{", "if", "(", "exercise", "instanceof", "QuizExercise", ")", "{", "quizExercises", ".", "add", "(", "(", "QuizExercise", ")", "exercise", ")", ";", "}", "}", "}", "long", "start", "=", "System", ".", "nanoTime", "(", ")", ";", "log", ".", "info", "(", "\"Evaluating {} quiz exercises in exam {}\"", ",", "quizExercises", ".", "size", "(", ")", ",", "examId", ")", ";", "quizExercises", ".", "forEach", "(", "quiz", "->", "examQuizService", ".", "evaluateQuizAndUpdateStatistics", "(", "quiz", ".", "getId", "(", ")", ")", ")", ";", "log", ".", "info", "(", "\"Evaluated {} quiz exercises in exam {} in {}\"", ",", "quizExercises", ".", "size", "(", ")", ",", "examId", ",", "TimeLogUtil", ".", "formatDurationFrom", "(", "start", ")", ")", ";", "return", "quizExercises", ".", "size", "(", ")", ";", "}" ]
Evaluates all the quiz exercises of an exam @param examId id of the exam for which the quiz exercises should be evaluated @return number of evaluated exercises
[ "Evaluates", "all", "the", "quiz", "exercises", "of", "an", "exam", "@param", "examId", "id", "of", "the", "exam", "for", "which", "the", "quiz", "exercises", "should", "be", "evaluated", "@return", "number", "of", "evaluated", "exercises" ]
[ "// Collect all quiz exercises for the given exam", "// Evaluate all quizzes for that exercise" ]
[ { "param": "examId", "type": "Long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "examId", "type": "Long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 2144, 5956, 928, 452, 424, 12610, 6141, 12, 3708, 19707, 548, 13, 288, 203, 3639, 569, 19707, 273, 19707, 3305, 18, 4720, 1190, 424, 20603, 3621, 1876, 424, 12610, 6141, 5132, 12, 338, 301, 548, 2934, 280, 12427, 8282, 12, 1435, 317, 394, 3887, 3990, 2932, 424, 301, 3113, 19707, 548, 10019, 203, 203, 3639, 368, 9302, 777, 16479, 431, 12610, 6141, 364, 326, 864, 19707, 203, 3639, 1000, 32, 928, 452, 424, 20603, 34, 16479, 424, 12610, 6141, 273, 394, 6847, 29667, 5621, 203, 3639, 364, 261, 424, 20603, 1114, 24165, 1114, 294, 19707, 18, 588, 424, 20603, 3621, 10756, 288, 203, 5411, 364, 261, 424, 20603, 24165, 294, 24165, 1114, 18, 588, 424, 12610, 6141, 10756, 288, 203, 7734, 309, 261, 8913, 30708, 1276, 4783, 452, 424, 20603, 13, 288, 203, 10792, 16479, 424, 12610, 6141, 18, 1289, 12443, 928, 452, 424, 20603, 13, 24165, 1769, 203, 7734, 289, 203, 5411, 289, 203, 3639, 289, 203, 203, 3639, 1525, 787, 273, 2332, 18, 13569, 83, 950, 5621, 203, 3639, 613, 18, 1376, 2932, 6644, 1776, 2618, 16479, 431, 12610, 6141, 316, 19707, 3728, 16, 16479, 424, 12610, 6141, 18, 1467, 9334, 19707, 548, 1769, 203, 3639, 368, 18176, 777, 16479, 94, 281, 364, 716, 24165, 203, 3639, 16479, 424, 12610, 6141, 18, 1884, 3442, 12, 18345, 317, 19707, 928, 452, 1179, 18, 21024, 928, 452, 1876, 1891, 8569, 12, 18345, 18, 26321, 1435, 10019, 203, 3639, 613, 18, 1376, 2932, 6644, 690, 2618, 16479, 431, 12610, 6141, 316, 19707, 2618, 316, 3728, 16, 16479, 424, 12610, 6141, 18, 1467, 9334, 19707, 548, 16, 2647, 1343, 1304, 18, 2139, 5326, 1265, 12, 1937, 10019, 203, 203, 3639, 327, 16479, 424, 12610, 6141, 18, 1467, 5621, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 10271, 815, 777, 326, 16479, 431, 12610, 6141, 434, 392, 19707, 203, 377, 380, 203, 377, 380, 632, 891, 19707, 548, 612, 434, 326, 19707, 364, 1492, 326, 16479, 431, 12610, 6141, 1410, 506, 12697, 203, 377, 380, 632, 2463, 1300, 434, 12697, 431, 12610, 6141, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
149ac9ebcbc48e7571ea3ff315cb4c11bbf8d26e
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/service/exam/ExamService.java
[ "MIT" ]
Java
unlockAllRepositories
Integer
public Integer unlockAllRepositories(Long examId) { var exam = examRepository.findWithExerciseGroupsAndExercisesById(examId).orElseThrow(() -> new EntityNotFoundException("Exam", examId)); // Collect all programming exercises for the given exam Set<ProgrammingExercise> programmingExercises = new HashSet<>(); for (ExerciseGroup exerciseGroup : exam.getExerciseGroups()) { for (Exercise exercise : exerciseGroup.getExercises()) { if (exercise instanceof ProgrammingExercise) { programmingExercises.add((ProgrammingExercise) exercise); } } } for (ProgrammingExercise programmingExercise : programmingExercises) { // Run the runnable immediately so that the repositories are unlocked as fast as possible instanceMessageSendService.sendUnlockAllRepositories(programmingExercise.getId()); } return programmingExercises.size(); }
/** * Unlocks all repositories of an exam * * @param examId id of the exam for which the repositories should be unlocked * @return number of exercises for which the repositories are unlocked */
Unlocks all repositories of an exam @param examId id of the exam for which the repositories should be unlocked @return number of exercises for which the repositories are unlocked
[ "Unlocks", "all", "repositories", "of", "an", "exam", "@param", "examId", "id", "of", "the", "exam", "for", "which", "the", "repositories", "should", "be", "unlocked", "@return", "number", "of", "exercises", "for", "which", "the", "repositories", "are", "unlocked" ]
public Integer unlockAllRepositories(Long examId) { var exam = examRepository.findWithExerciseGroupsAndExercisesById(examId).orElseThrow(() -> new EntityNotFoundException("Exam", examId)); Set<ProgrammingExercise> programmingExercises = new HashSet<>(); for (ExerciseGroup exerciseGroup : exam.getExerciseGroups()) { for (Exercise exercise : exerciseGroup.getExercises()) { if (exercise instanceof ProgrammingExercise) { programmingExercises.add((ProgrammingExercise) exercise); } } } for (ProgrammingExercise programmingExercise : programmingExercises) { instanceMessageSendService.sendUnlockAllRepositories(programmingExercise.getId()); } return programmingExercises.size(); }
[ "public", "Integer", "unlockAllRepositories", "(", "Long", "examId", ")", "{", "var", "exam", "=", "examRepository", ".", "findWithExerciseGroupsAndExercisesById", "(", "examId", ")", ".", "orElseThrow", "(", "(", ")", "->", "new", "EntityNotFoundException", "(", "\"Exam\"", ",", "examId", ")", ")", ";", "Set", "<", "ProgrammingExercise", ">", "programmingExercises", "=", "new", "HashSet", "<", ">", "(", ")", ";", "for", "(", "ExerciseGroup", "exerciseGroup", ":", "exam", ".", "getExerciseGroups", "(", ")", ")", "{", "for", "(", "Exercise", "exercise", ":", "exerciseGroup", ".", "getExercises", "(", ")", ")", "{", "if", "(", "exercise", "instanceof", "ProgrammingExercise", ")", "{", "programmingExercises", ".", "add", "(", "(", "ProgrammingExercise", ")", "exercise", ")", ";", "}", "}", "}", "for", "(", "ProgrammingExercise", "programmingExercise", ":", "programmingExercises", ")", "{", "instanceMessageSendService", ".", "sendUnlockAllRepositories", "(", "programmingExercise", ".", "getId", "(", ")", ")", ";", "}", "return", "programmingExercises", ".", "size", "(", ")", ";", "}" ]
Unlocks all repositories of an exam @param examId id of the exam for which the repositories should be unlocked @return number of exercises for which the repositories are unlocked
[ "Unlocks", "all", "repositories", "of", "an", "exam", "@param", "examId", "id", "of", "the", "exam", "for", "which", "the", "repositories", "should", "be", "unlocked", "@return", "number", "of", "exercises", "for", "which", "the", "repositories", "are", "unlocked" ]
[ "// Collect all programming exercises for the given exam", "// Run the runnable immediately so that the repositories are unlocked as fast as possible" ]
[ { "param": "examId", "type": "Long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "examId", "type": "Long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 2144, 7186, 1595, 18429, 12, 3708, 19707, 548, 13, 288, 203, 3639, 569, 19707, 273, 19707, 3305, 18, 4720, 1190, 424, 20603, 3621, 1876, 424, 12610, 6141, 5132, 12, 338, 301, 548, 2934, 280, 12427, 8282, 12, 1435, 317, 394, 3887, 3990, 2932, 424, 301, 3113, 19707, 548, 10019, 203, 203, 3639, 368, 9302, 777, 5402, 11987, 431, 12610, 6141, 364, 326, 864, 19707, 203, 3639, 1000, 32, 9459, 11987, 424, 20603, 34, 5402, 11987, 424, 12610, 6141, 273, 394, 6847, 29667, 5621, 203, 3639, 364, 261, 424, 20603, 1114, 24165, 1114, 294, 19707, 18, 588, 424, 20603, 3621, 10756, 288, 203, 5411, 364, 261, 424, 20603, 24165, 294, 24165, 1114, 18, 588, 424, 12610, 6141, 10756, 288, 203, 7734, 309, 261, 8913, 30708, 1276, 13586, 11987, 424, 20603, 13, 288, 203, 10792, 5402, 11987, 424, 12610, 6141, 18, 1289, 12443, 9459, 11987, 424, 20603, 13, 24165, 1769, 203, 7734, 289, 203, 5411, 289, 203, 3639, 289, 203, 203, 3639, 364, 261, 9459, 11987, 424, 20603, 5402, 11987, 424, 20603, 294, 5402, 11987, 424, 12610, 6141, 13, 288, 203, 5411, 368, 1939, 326, 14685, 7636, 1427, 716, 326, 14531, 854, 25966, 487, 4797, 487, 3323, 203, 5411, 791, 1079, 3826, 1179, 18, 4661, 7087, 1595, 18429, 12, 12890, 11987, 424, 20603, 18, 26321, 10663, 203, 3639, 289, 203, 203, 3639, 327, 5402, 11987, 424, 12610, 6141, 18, 1467, 5621, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 392, 19707, 203, 377, 380, 203, 377, 380, 632, 891, 19707, 548, 612, 434, 326, 19707, 364, 1492, 326, 14531, 1410, 506, 25966, 203, 377, 380, 632, 2463, 1300, 434, 431, 12610, 6141, 364, 1492, 326, 14531, 854, 25966, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
149ac9ebcbc48e7571ea3ff315cb4c11bbf8d26e
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/service/exam/ExamService.java
[ "MIT" ]
Java
lockAllRepositories
Integer
public Integer lockAllRepositories(Long examId) { var exam = examRepository.findWithExerciseGroupsAndExercisesById(examId).orElseThrow(() -> new EntityNotFoundException("Exam", examId)); // Collect all programming exercises for the given exam Set<ProgrammingExercise> programmingExercises = new HashSet<>(); for (ExerciseGroup exerciseGroup : exam.getExerciseGroups()) { for (Exercise exercise : exerciseGroup.getExercises()) { if (exercise instanceof ProgrammingExercise) { programmingExercises.add((ProgrammingExercise) exercise); } } } for (ProgrammingExercise programmingExercise : programmingExercises) { // Run the runnable immediately so that the repositories are locked as fast as possible instanceMessageSendService.sendLockAllRepositories(programmingExercise.getId()); } return programmingExercises.size(); }
/** * Locks all repositories of an exam * * @param examId id of the exam for which the repositories should be locked * @return number of exercises for which the repositories are locked */
Locks all repositories of an exam @param examId id of the exam for which the repositories should be locked @return number of exercises for which the repositories are locked
[ "Locks", "all", "repositories", "of", "an", "exam", "@param", "examId", "id", "of", "the", "exam", "for", "which", "the", "repositories", "should", "be", "locked", "@return", "number", "of", "exercises", "for", "which", "the", "repositories", "are", "locked" ]
public Integer lockAllRepositories(Long examId) { var exam = examRepository.findWithExerciseGroupsAndExercisesById(examId).orElseThrow(() -> new EntityNotFoundException("Exam", examId)); Set<ProgrammingExercise> programmingExercises = new HashSet<>(); for (ExerciseGroup exerciseGroup : exam.getExerciseGroups()) { for (Exercise exercise : exerciseGroup.getExercises()) { if (exercise instanceof ProgrammingExercise) { programmingExercises.add((ProgrammingExercise) exercise); } } } for (ProgrammingExercise programmingExercise : programmingExercises) { instanceMessageSendService.sendLockAllRepositories(programmingExercise.getId()); } return programmingExercises.size(); }
[ "public", "Integer", "lockAllRepositories", "(", "Long", "examId", ")", "{", "var", "exam", "=", "examRepository", ".", "findWithExerciseGroupsAndExercisesById", "(", "examId", ")", ".", "orElseThrow", "(", "(", ")", "->", "new", "EntityNotFoundException", "(", "\"Exam\"", ",", "examId", ")", ")", ";", "Set", "<", "ProgrammingExercise", ">", "programmingExercises", "=", "new", "HashSet", "<", ">", "(", ")", ";", "for", "(", "ExerciseGroup", "exerciseGroup", ":", "exam", ".", "getExerciseGroups", "(", ")", ")", "{", "for", "(", "Exercise", "exercise", ":", "exerciseGroup", ".", "getExercises", "(", ")", ")", "{", "if", "(", "exercise", "instanceof", "ProgrammingExercise", ")", "{", "programmingExercises", ".", "add", "(", "(", "ProgrammingExercise", ")", "exercise", ")", ";", "}", "}", "}", "for", "(", "ProgrammingExercise", "programmingExercise", ":", "programmingExercises", ")", "{", "instanceMessageSendService", ".", "sendLockAllRepositories", "(", "programmingExercise", ".", "getId", "(", ")", ")", ";", "}", "return", "programmingExercises", ".", "size", "(", ")", ";", "}" ]
Locks all repositories of an exam @param examId id of the exam for which the repositories should be locked @return number of exercises for which the repositories are locked
[ "Locks", "all", "repositories", "of", "an", "exam", "@param", "examId", "id", "of", "the", "exam", "for", "which", "the", "repositories", "should", "be", "locked", "@return", "number", "of", "exercises", "for", "which", "the", "repositories", "are", "locked" ]
[ "// Collect all programming exercises for the given exam", "// Run the runnable immediately so that the repositories are locked as fast as possible" ]
[ { "param": "examId", "type": "Long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "examId", "type": "Long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 2144, 2176, 1595, 18429, 12, 3708, 19707, 548, 13, 288, 203, 3639, 569, 19707, 273, 19707, 3305, 18, 4720, 1190, 424, 20603, 3621, 1876, 424, 12610, 6141, 5132, 12, 338, 301, 548, 2934, 280, 12427, 8282, 12, 1435, 317, 394, 3887, 3990, 2932, 424, 301, 3113, 19707, 548, 10019, 203, 203, 3639, 368, 9302, 777, 5402, 11987, 431, 12610, 6141, 364, 326, 864, 19707, 203, 3639, 1000, 32, 9459, 11987, 424, 20603, 34, 5402, 11987, 424, 12610, 6141, 273, 394, 6847, 29667, 5621, 203, 3639, 364, 261, 424, 20603, 1114, 24165, 1114, 294, 19707, 18, 588, 424, 20603, 3621, 10756, 288, 203, 5411, 364, 261, 424, 20603, 24165, 294, 24165, 1114, 18, 588, 424, 12610, 6141, 10756, 288, 203, 7734, 309, 261, 8913, 30708, 1276, 13586, 11987, 424, 20603, 13, 288, 203, 10792, 5402, 11987, 424, 12610, 6141, 18, 1289, 12443, 9459, 11987, 424, 20603, 13, 24165, 1769, 203, 7734, 289, 203, 5411, 289, 203, 3639, 289, 203, 203, 3639, 364, 261, 9459, 11987, 424, 20603, 5402, 11987, 424, 20603, 294, 5402, 11987, 424, 12610, 6141, 13, 288, 203, 5411, 368, 1939, 326, 14685, 7636, 1427, 716, 326, 14531, 854, 8586, 487, 4797, 487, 3323, 203, 5411, 791, 1079, 3826, 1179, 18, 4661, 2531, 1595, 18429, 12, 12890, 11987, 424, 20603, 18, 26321, 10663, 203, 3639, 289, 203, 203, 3639, 327, 5402, 11987, 424, 12610, 6141, 18, 1467, 5621, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 3488, 87, 777, 14531, 434, 392, 19707, 203, 377, 380, 203, 377, 380, 632, 891, 19707, 548, 612, 434, 326, 19707, 364, 1492, 326, 14531, 1410, 506, 8586, 203, 377, 380, 632, 2463, 1300, 434, 431, 12610, 6141, 364, 1492, 326, 14531, 854, 8586, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
149ac9ebcbc48e7571ea3ff315cb4c11bbf8d26e
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/service/exam/ExamService.java
[ "MIT" ]
Java
archiveExam
null
@Async public void archiveExam(Exam exam) { SecurityUtils.setAuthorizationObject(); // Archiving a course is only possible after the exam is over if (ZonedDateTime.now().isBefore(exam.getEndDate())) { return; } // This contains possible errors encountered during the archive process ArrayList<String> exportErrors = new ArrayList<>(); groupNotificationService.notifyInstructorGroupAboutExamArchiveState(exam, NotificationType.EXAM_ARCHIVE_STARTED, exportErrors); try { // Create exam archives directory if it doesn't exist Files.createDirectories(Path.of(examArchivesDirPath)); log.info("Created the exam archives directory at {} because it didn't exist.", examArchivesDirPath); // Export the exam to the archives directory. var archivedExamPath = courseExamExportService.exportExam(exam, examArchivesDirPath, exportErrors); // Attach the path to the archive to the exam and save it in the database if (archivedExamPath.isPresent()) { exam.setExamArchivePath(archivedExamPath.get().getFileName().toString()); examRepository.save(exam); } else { groupNotificationService.notifyInstructorGroupAboutExamArchiveState(exam, NotificationType.EXAM_ARCHIVE_FAILED, exportErrors); return; } } catch (IOException e) { var error = "Failed to create exam archives directory " + examArchivesDirPath + ": " + e.getMessage(); exportErrors.add(error); log.info(error); } groupNotificationService.notifyInstructorGroupAboutExamArchiveState(exam, NotificationType.EXAM_ARCHIVE_FINISHED, exportErrors); }
/** * Archives the exam by creating a zip file with student submissions for * exercises of the exam. * * @param exam the exam to archive */
Archives the exam by creating a zip file with student submissions for exercises of the exam. @param exam the exam to archive
[ "Archives", "the", "exam", "by", "creating", "a", "zip", "file", "with", "student", "submissions", "for", "exercises", "of", "the", "exam", ".", "@param", "exam", "the", "exam", "to", "archive" ]
@Async public void archiveExam(Exam exam) { SecurityUtils.setAuthorizationObject(); if (ZonedDateTime.now().isBefore(exam.getEndDate())) { return; } ArrayList<String> exportErrors = new ArrayList<>(); groupNotificationService.notifyInstructorGroupAboutExamArchiveState(exam, NotificationType.EXAM_ARCHIVE_STARTED, exportErrors); try { Files.createDirectories(Path.of(examArchivesDirPath)); log.info("Created the exam archives directory at {} because it didn't exist.", examArchivesDirPath); var archivedExamPath = courseExamExportService.exportExam(exam, examArchivesDirPath, exportErrors); if (archivedExamPath.isPresent()) { exam.setExamArchivePath(archivedExamPath.get().getFileName().toString()); examRepository.save(exam); } else { groupNotificationService.notifyInstructorGroupAboutExamArchiveState(exam, NotificationType.EXAM_ARCHIVE_FAILED, exportErrors); return; } } catch (IOException e) { var error = "Failed to create exam archives directory " + examArchivesDirPath + ": " + e.getMessage(); exportErrors.add(error); log.info(error); } groupNotificationService.notifyInstructorGroupAboutExamArchiveState(exam, NotificationType.EXAM_ARCHIVE_FINISHED, exportErrors); }
[ "@", "Async", "public", "void", "archiveExam", "(", "Exam", "exam", ")", "{", "SecurityUtils", ".", "setAuthorizationObject", "(", ")", ";", "if", "(", "ZonedDateTime", ".", "now", "(", ")", ".", "isBefore", "(", "exam", ".", "getEndDate", "(", ")", ")", ")", "{", "return", ";", "}", "ArrayList", "<", "String", ">", "exportErrors", "=", "new", "ArrayList", "<", ">", "(", ")", ";", "groupNotificationService", ".", "notifyInstructorGroupAboutExamArchiveState", "(", "exam", ",", "NotificationType", ".", "EXAM_ARCHIVE_STARTED", ",", "exportErrors", ")", ";", "try", "{", "Files", ".", "createDirectories", "(", "Path", ".", "of", "(", "examArchivesDirPath", ")", ")", ";", "log", ".", "info", "(", "\"Created the exam archives directory at {} because it didn't exist.\"", ",", "examArchivesDirPath", ")", ";", "var", "archivedExamPath", "=", "courseExamExportService", ".", "exportExam", "(", "exam", ",", "examArchivesDirPath", ",", "exportErrors", ")", ";", "if", "(", "archivedExamPath", ".", "isPresent", "(", ")", ")", "{", "exam", ".", "setExamArchivePath", "(", "archivedExamPath", ".", "get", "(", ")", ".", "getFileName", "(", ")", ".", "toString", "(", ")", ")", ";", "examRepository", ".", "save", "(", "exam", ")", ";", "}", "else", "{", "groupNotificationService", ".", "notifyInstructorGroupAboutExamArchiveState", "(", "exam", ",", "NotificationType", ".", "EXAM_ARCHIVE_FAILED", ",", "exportErrors", ")", ";", "return", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "var", "error", "=", "\"Failed to create exam archives directory \"", "+", "examArchivesDirPath", "+", "\": \"", "+", "e", ".", "getMessage", "(", ")", ";", "exportErrors", ".", "add", "(", "error", ")", ";", "log", ".", "info", "(", "error", ")", ";", "}", "groupNotificationService", ".", "notifyInstructorGroupAboutExamArchiveState", "(", "exam", ",", "NotificationType", ".", "EXAM_ARCHIVE_FINISHED", ",", "exportErrors", ")", ";", "}" ]
Archives the exam by creating a zip file with student submissions for exercises of the exam.
[ "Archives", "the", "exam", "by", "creating", "a", "zip", "file", "with", "student", "submissions", "for", "exercises", "of", "the", "exam", "." ]
[ "// Archiving a course is only possible after the exam is over", "// This contains possible errors encountered during the archive process", "// Create exam archives directory if it doesn't exist", "// Export the exam to the archives directory.", "// Attach the path to the archive to the exam and save it in the database" ]
[ { "param": "exam", "type": "Exam" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "exam", "type": "Exam", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 2771, 203, 565, 1071, 918, 5052, 424, 301, 12, 424, 301, 19707, 13, 288, 203, 3639, 6036, 1989, 18, 542, 6063, 921, 5621, 203, 203, 3639, 368, 16959, 9288, 279, 4362, 353, 1338, 3323, 1839, 326, 19707, 353, 1879, 203, 3639, 309, 261, 62, 20461, 18, 3338, 7675, 291, 4649, 12, 338, 301, 18, 588, 24640, 1435, 3719, 288, 203, 5411, 327, 31, 203, 3639, 289, 203, 203, 3639, 368, 1220, 1914, 3323, 1334, 9919, 4982, 326, 5052, 1207, 203, 3639, 2407, 32, 780, 34, 3359, 4229, 273, 394, 2407, 29667, 5621, 203, 203, 3639, 1041, 4386, 1179, 18, 12336, 382, 2732, 1114, 24813, 424, 301, 7465, 1119, 12, 338, 301, 16, 8050, 559, 18, 2294, 2192, 67, 10586, 5354, 67, 20943, 6404, 16, 3359, 4229, 1769, 203, 203, 3639, 775, 288, 203, 5411, 368, 1788, 19707, 21997, 1867, 309, 518, 3302, 1404, 1005, 203, 5411, 6471, 18, 2640, 13071, 12, 743, 18, 792, 12, 338, 301, 12269, 3606, 20129, 10019, 203, 5411, 613, 18, 1376, 2932, 6119, 326, 19707, 21997, 1867, 622, 2618, 2724, 518, 10242, 1404, 1005, 1199, 16, 19707, 12269, 3606, 20129, 1769, 203, 203, 5411, 368, 11054, 326, 19707, 358, 326, 21997, 1867, 18, 203, 5411, 569, 23276, 424, 301, 743, 273, 4362, 424, 301, 6144, 1179, 18, 6530, 424, 301, 12, 338, 301, 16, 19707, 12269, 3606, 20129, 16, 3359, 4229, 1769, 203, 203, 5411, 368, 8659, 326, 589, 358, 326, 5052, 358, 326, 19707, 471, 1923, 518, 316, 326, 2063, 203, 5411, 309, 261, 991, 2950, 424, 301, 743, 18, 291, 6351, 10756, 288, 203, 7734, 19707, 18, 542, 424, 301, 7465, 743, 12, 991, 2950, 424, 301, 743, 18, 588, 7675, 588, 4771, 7675, 10492, 10663, 203, 7734, 19707, 3305, 18, 5688, 12, 338, 301, 1769, 203, 5411, 289, 203, 5411, 469, 288, 203, 7734, 1041, 4386, 1179, 18, 12336, 382, 2732, 1114, 24813, 424, 301, 7465, 1119, 12, 338, 301, 16, 8050, 559, 18, 2294, 2192, 67, 10586, 5354, 67, 11965, 16, 3359, 4229, 1769, 203, 7734, 327, 31, 203, 5411, 289, 203, 3639, 289, 203, 3639, 1044, 261, 14106, 425, 13, 288, 203, 5411, 569, 555, 273, 315, 2925, 358, 752, 19707, 21997, 1867, 315, 397, 19707, 12269, 3606, 20129, 397, 6398, 315, 397, 425, 18, 24906, 5621, 203, 5411, 3359, 4229, 18, 1289, 12, 1636, 1769, 203, 5411, 613, 18, 1376, 12, 1636, 1769, 203, 3639, 289, 203, 203, 3639, 1041, 4386, 1179, 18, 12336, 382, 2732, 1114, 24813, 424, 301, 7465, 1119, 12, 338, 301, 16, 8050, 559, 18, 2294, 2192, 67, 10586, 5354, 67, 23259, 2056, 16, 3359, 4229, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 16959, 3606, 326, 19707, 635, 4979, 279, 3144, 585, 598, 18110, 22071, 364, 203, 377, 380, 431, 12610, 6141, 434, 326, 19707, 18, 203, 377, 380, 203, 377, 380, 632, 891, 19707, 326, 19707, 358, 5052, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
149ac9ebcbc48e7571ea3ff315cb4c11bbf8d26e
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/service/exam/ExamService.java
[ "MIT" ]
Java
combineTemplateCommitsOfAllProgrammingExercisesInExam
null
public void combineTemplateCommitsOfAllProgrammingExercisesInExam(Exam exam) { exam.getExerciseGroups().forEach(group -> group.getExercises().stream().filter(exercise -> exercise instanceof ProgrammingExercise).forEach(exercise -> { try { ProgrammingExercise programmingExerciseWithTemplateParticipation = programmingExerciseRepository .findByIdWithTemplateAndSolutionParticipationElseThrow(exercise.getId()); gitService.combineAllCommitsOfRepositoryIntoOne(programmingExerciseWithTemplateParticipation.getTemplateParticipation().getVcsRepositoryUrl()); log.debug("Finished combination of template commits for programming exercise {}", programmingExerciseWithTemplateParticipation.toString()); } catch (InterruptedException | GitAPIException e) { log.error("An error occurred when trying to combine template commits for exam " + exam.getId() + ".", e); } })); }
/** * Combines the template commits of all programming exercises in the exam. * This is executed before the individual student exams are generated. * * @param exam - the exam which template commits should be combined */
Combines the template commits of all programming exercises in the exam. This is executed before the individual student exams are generated. @param exam - the exam which template commits should be combined
[ "Combines", "the", "template", "commits", "of", "all", "programming", "exercises", "in", "the", "exam", ".", "This", "is", "executed", "before", "the", "individual", "student", "exams", "are", "generated", ".", "@param", "exam", "-", "the", "exam", "which", "template", "commits", "should", "be", "combined" ]
public void combineTemplateCommitsOfAllProgrammingExercisesInExam(Exam exam) { exam.getExerciseGroups().forEach(group -> group.getExercises().stream().filter(exercise -> exercise instanceof ProgrammingExercise).forEach(exercise -> { try { ProgrammingExercise programmingExerciseWithTemplateParticipation = programmingExerciseRepository .findByIdWithTemplateAndSolutionParticipationElseThrow(exercise.getId()); gitService.combineAllCommitsOfRepositoryIntoOne(programmingExerciseWithTemplateParticipation.getTemplateParticipation().getVcsRepositoryUrl()); log.debug("Finished combination of template commits for programming exercise {}", programmingExerciseWithTemplateParticipation.toString()); } catch (InterruptedException | GitAPIException e) { log.error("An error occurred when trying to combine template commits for exam " + exam.getId() + ".", e); } })); }
[ "public", "void", "combineTemplateCommitsOfAllProgrammingExercisesInExam", "(", "Exam", "exam", ")", "{", "exam", ".", "getExerciseGroups", "(", ")", ".", "forEach", "(", "group", "->", "group", ".", "getExercises", "(", ")", ".", "stream", "(", ")", ".", "filter", "(", "exercise", "->", "exercise", "instanceof", "ProgrammingExercise", ")", ".", "forEach", "(", "exercise", "->", "{", "try", "{", "ProgrammingExercise", "programmingExerciseWithTemplateParticipation", "=", "programmingExerciseRepository", ".", "findByIdWithTemplateAndSolutionParticipationElseThrow", "(", "exercise", ".", "getId", "(", ")", ")", ";", "gitService", ".", "combineAllCommitsOfRepositoryIntoOne", "(", "programmingExerciseWithTemplateParticipation", ".", "getTemplateParticipation", "(", ")", ".", "getVcsRepositoryUrl", "(", ")", ")", ";", "log", ".", "debug", "(", "\"Finished combination of template commits for programming exercise {}\"", ",", "programmingExerciseWithTemplateParticipation", ".", "toString", "(", ")", ")", ";", "}", "catch", "(", "InterruptedException", "|", "GitAPIException", "e", ")", "{", "log", ".", "error", "(", "\"An error occurred when trying to combine template commits for exam \"", "+", "exam", ".", "getId", "(", ")", "+", "\".\"", ",", "e", ")", ";", "}", "}", ")", ")", ";", "}" ]
Combines the template commits of all programming exercises in the exam.
[ "Combines", "the", "template", "commits", "of", "all", "programming", "exercises", "in", "the", "exam", "." ]
[]
[ { "param": "exam", "type": "Exam" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "exam", "type": "Exam", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 918, 8661, 2283, 23072, 951, 1595, 9459, 11987, 424, 12610, 6141, 382, 424, 301, 12, 424, 301, 19707, 13, 288, 203, 3639, 19707, 18, 588, 424, 20603, 3621, 7675, 1884, 3442, 12, 1655, 317, 1041, 18, 588, 424, 12610, 6141, 7675, 3256, 7675, 2188, 12, 8913, 30708, 317, 24165, 1276, 13586, 11987, 424, 20603, 2934, 1884, 3442, 12, 8913, 30708, 317, 288, 203, 5411, 775, 288, 203, 7734, 13586, 11987, 424, 20603, 5402, 11987, 424, 20603, 1190, 2283, 1988, 24629, 367, 273, 5402, 11987, 424, 20603, 3305, 203, 13491, 263, 4720, 5132, 1190, 2283, 1876, 16135, 1988, 24629, 367, 12427, 8282, 12, 8913, 30708, 18, 26321, 10663, 203, 7734, 5071, 1179, 18, 14082, 1595, 23072, 951, 3305, 5952, 3335, 12, 12890, 11987, 424, 20603, 1190, 2283, 1988, 24629, 367, 18, 588, 2283, 1988, 24629, 367, 7675, 588, 58, 2143, 3305, 1489, 10663, 203, 7734, 613, 18, 4148, 2932, 10577, 10702, 434, 1542, 14335, 364, 5402, 11987, 24165, 3728, 16, 5402, 11987, 424, 20603, 1190, 2283, 1988, 24629, 367, 18, 10492, 10663, 203, 5411, 289, 203, 5411, 1044, 261, 24485, 503, 571, 6646, 2557, 503, 425, 13, 288, 203, 7734, 613, 18, 1636, 2932, 979, 555, 7841, 1347, 8374, 358, 8661, 1542, 14335, 364, 19707, 315, 397, 19707, 18, 26321, 1435, 397, 4585, 16, 425, 1769, 203, 5411, 289, 203, 3639, 289, 10019, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 15645, 1465, 326, 1542, 14335, 434, 777, 5402, 11987, 431, 12610, 6141, 316, 326, 19707, 18, 203, 377, 380, 1220, 353, 7120, 1865, 326, 7327, 18110, 19707, 87, 854, 4374, 18, 203, 377, 380, 203, 377, 380, 632, 891, 19707, 300, 326, 19707, 1492, 1542, 14335, 1410, 506, 8224, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
149ac9ebcbc48e7571ea3ff315cb4c11bbf8d26e
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/service/exam/ExamService.java
[ "MIT" ]
Java
scheduleModelingExercises
null
public void scheduleModelingExercises(Exam exam) { // for all modeling exercises in the exam, send their ids for scheduling exam.getExerciseGroups().stream().flatMap(group -> group.getExercises().stream()).filter(exercise -> exercise instanceof ModelingExercise).map(Exercise::getId) .forEach(instanceMessageSendService::sendModelingExerciseSchedule); }
/** * Schedules all modeling exercises * This is executed when exam is updated or individual working times are updated * * @param exam - the exam whose modeling exercises will be scheduled */
Schedules all modeling exercises This is executed when exam is updated or individual working times are updated @param exam - the exam whose modeling exercises will be scheduled
[ "Schedules", "all", "modeling", "exercises", "This", "is", "executed", "when", "exam", "is", "updated", "or", "individual", "working", "times", "are", "updated", "@param", "exam", "-", "the", "exam", "whose", "modeling", "exercises", "will", "be", "scheduled" ]
public void scheduleModelingExercises(Exam exam) { exam.getExerciseGroups().stream().flatMap(group -> group.getExercises().stream()).filter(exercise -> exercise instanceof ModelingExercise).map(Exercise::getId) .forEach(instanceMessageSendService::sendModelingExerciseSchedule); }
[ "public", "void", "scheduleModelingExercises", "(", "Exam", "exam", ")", "{", "exam", ".", "getExerciseGroups", "(", ")", ".", "stream", "(", ")", ".", "flatMap", "(", "group", "->", "group", ".", "getExercises", "(", ")", ".", "stream", "(", ")", ")", ".", "filter", "(", "exercise", "->", "exercise", "instanceof", "ModelingExercise", ")", ".", "map", "(", "Exercise", "::", "getId", ")", ".", "forEach", "(", "instanceMessageSendService", "::", "sendModelingExerciseSchedule", ")", ";", "}" ]
Schedules all modeling exercises This is executed when exam is updated or individual working times are updated
[ "Schedules", "all", "modeling", "exercises", "This", "is", "executed", "when", "exam", "is", "updated", "or", "individual", "working", "times", "are", "updated" ]
[ "// for all modeling exercises in the exam, send their ids for scheduling" ]
[ { "param": "exam", "type": "Exam" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "exam", "type": "Exam", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 918, 4788, 1488, 310, 424, 12610, 6141, 12, 424, 301, 19707, 13, 288, 203, 3639, 368, 364, 777, 938, 310, 431, 12610, 6141, 316, 326, 19707, 16, 1366, 3675, 3258, 364, 21895, 203, 3639, 19707, 18, 588, 424, 20603, 3621, 7675, 3256, 7675, 15401, 863, 12, 1655, 317, 1041, 18, 588, 424, 12610, 6141, 7675, 3256, 1435, 2934, 2188, 12, 8913, 30708, 317, 24165, 1276, 3164, 310, 424, 20603, 2934, 1458, 12, 424, 20603, 2866, 26321, 13, 203, 7734, 263, 1884, 3442, 12, 1336, 1079, 3826, 1179, 2866, 4661, 1488, 310, 424, 20603, 6061, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 348, 15511, 777, 938, 310, 431, 12610, 6141, 203, 377, 380, 1220, 353, 7120, 1347, 19707, 353, 3526, 578, 7327, 5960, 4124, 854, 3526, 203, 377, 380, 203, 377, 380, 632, 891, 19707, 300, 326, 19707, 8272, 938, 310, 431, 12610, 6141, 903, 506, 9755, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
23c5571246ea95db0314093aec47c813f62641c1
ls1intum/Artemis
src/test/java/de/tum/in/www1/artemis/AssessmentKnowledgeIntegrationTest.java
[ "MIT" ]
Java
testCreateTextAssessmentKnowledgeIfExerciseIsCreatedFromScratch
null
@Test @WithMockUser(value = "instructor1", roles = "INSTRUCTOR") public void testCreateTextAssessmentKnowledgeIfExerciseIsCreatedFromScratch() throws Exception { final Course course = database.addCourseWithOneReleasedTextExercise(); TextExercise textExercise = textExerciseRepository.findByCourseId(course.getId()).get(0); int count = textAssesmentKnowledgeRepository.findAll().size(); textExercise.setId(null); request.postWithResponseBody("/api/text-exercises/", textExercise, TextExercise.class, HttpStatus.CREATED); assertThat(count + 1).isEqualTo(textAssesmentKnowledgeRepository.findAll().size()); }
/** * Tests that a new TextAssessmentKnowledge is created when we create an exercise from scratch * * @throws Exception might be thrown from Network Call to Artemis API */
Tests that a new TextAssessmentKnowledge is created when we create an exercise from scratch @throws Exception might be thrown from Network Call to Artemis API
[ "Tests", "that", "a", "new", "TextAssessmentKnowledge", "is", "created", "when", "we", "create", "an", "exercise", "from", "scratch", "@throws", "Exception", "might", "be", "thrown", "from", "Network", "Call", "to", "Artemis", "API" ]
@Test @WithMockUser(value = "instructor1", roles = "INSTRUCTOR") public void testCreateTextAssessmentKnowledgeIfExerciseIsCreatedFromScratch() throws Exception { final Course course = database.addCourseWithOneReleasedTextExercise(); TextExercise textExercise = textExerciseRepository.findByCourseId(course.getId()).get(0); int count = textAssesmentKnowledgeRepository.findAll().size(); textExercise.setId(null); request.postWithResponseBody("/api/text-exercises/", textExercise, TextExercise.class, HttpStatus.CREATED); assertThat(count + 1).isEqualTo(textAssesmentKnowledgeRepository.findAll().size()); }
[ "@", "Test", "@", "WithMockUser", "(", "value", "=", "\"instructor1\"", ",", "roles", "=", "\"INSTRUCTOR\"", ")", "public", "void", "testCreateTextAssessmentKnowledgeIfExerciseIsCreatedFromScratch", "(", ")", "throws", "Exception", "{", "final", "Course", "course", "=", "database", ".", "addCourseWithOneReleasedTextExercise", "(", ")", ";", "TextExercise", "textExercise", "=", "textExerciseRepository", ".", "findByCourseId", "(", "course", ".", "getId", "(", ")", ")", ".", "get", "(", "0", ")", ";", "int", "count", "=", "textAssesmentKnowledgeRepository", ".", "findAll", "(", ")", ".", "size", "(", ")", ";", "textExercise", ".", "setId", "(", "null", ")", ";", "request", ".", "postWithResponseBody", "(", "\"/api/text-exercises/\"", ",", "textExercise", ",", "TextExercise", ".", "class", ",", "HttpStatus", ".", "CREATED", ")", ";", "assertThat", "(", "count", "+", "1", ")", ".", "isEqualTo", "(", "textAssesmentKnowledgeRepository", ".", "findAll", "(", ")", ".", "size", "(", ")", ")", ";", "}" ]
Tests that a new TextAssessmentKnowledge is created when we create an exercise from scratch @throws Exception might be thrown from Network Call to Artemis API
[ "Tests", "that", "a", "new", "TextAssessmentKnowledge", "is", "created", "when", "we", "create", "an", "exercise", "from", "scratch", "@throws", "Exception", "might", "be", "thrown", "from", "Network", "Call", "to", "Artemis", "API" ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 4709, 203, 565, 632, 1190, 9865, 1299, 12, 1132, 273, 315, 267, 2732, 21, 3113, 4900, 273, 315, 706, 13915, 916, 7923, 203, 565, 1071, 918, 1842, 1684, 1528, 15209, 47, 14390, 2047, 424, 20603, 2520, 6119, 1265, 1541, 86, 505, 1435, 1216, 1185, 288, 203, 3639, 727, 385, 3117, 4362, 273, 2063, 18, 1289, 39, 3117, 1190, 3335, 26363, 1528, 424, 20603, 5621, 203, 3639, 3867, 424, 20603, 977, 424, 20603, 273, 977, 424, 20603, 3305, 18, 4720, 858, 39, 3117, 548, 12, 5566, 18, 26321, 1435, 2934, 588, 12, 20, 1769, 203, 3639, 509, 1056, 273, 977, 2610, 281, 475, 47, 14390, 3305, 18, 4720, 1595, 7675, 1467, 5621, 203, 3639, 977, 424, 20603, 18, 542, 548, 12, 2011, 1769, 203, 3639, 590, 18, 2767, 1190, 23269, 2932, 19, 2425, 19, 955, 17, 8913, 71, 6141, 19, 3113, 977, 424, 20603, 16, 3867, 424, 20603, 18, 1106, 16, 21153, 18, 18546, 1769, 203, 3639, 1815, 18163, 12, 1883, 397, 404, 2934, 291, 5812, 774, 12, 955, 2610, 281, 475, 47, 14390, 3305, 18, 4720, 1595, 7675, 1467, 10663, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 7766, 87, 716, 279, 394, 3867, 15209, 47, 14390, 353, 2522, 1347, 732, 752, 392, 24165, 628, 15289, 203, 377, 380, 203, 377, 380, 632, 15069, 1185, 4825, 506, 6718, 628, 5128, 3049, 358, 1201, 874, 291, 1491, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
23c5571246ea95db0314093aec47c813f62641c1
ls1intum/Artemis
src/test/java/de/tum/in/www1/artemis/AssessmentKnowledgeIntegrationTest.java
[ "MIT" ]
Java
testReuseTextAssessmentKnowledgeIfExerciseIsImported
null
@Test @WithMockUser(value = "instructor1", roles = "INSTRUCTOR") public void testReuseTextAssessmentKnowledgeIfExerciseIsImported() throws Exception { final Course course = database.addCourseWithOneReleasedTextExercise(); TextExercise textExercise = textExerciseRepository.findByCourseId(course.getId()).get(0); int exerciseCount = textExerciseRepository.findAll().size(); int textAssessmentKnowledgeCount = textAssesmentKnowledgeRepository.findAll().size(); request.postWithResponseBody("/api/text-exercises/import/" + textExercise.getId(), textExercise, TextExercise.class, HttpStatus.CREATED); assertThat(textAssesmentKnowledgeRepository.findAll().size()).isEqualTo(textAssessmentKnowledgeCount); assertThat(textExerciseRepository.findAll().size()).isEqualTo(exerciseCount + 1); }
/** * Tests that TextAssessmentKnowledge is reused when we import an exercise * * @throws Exception might be thrown from Network Call to Artemis API */
Tests that TextAssessmentKnowledge is reused when we import an exercise @throws Exception might be thrown from Network Call to Artemis API
[ "Tests", "that", "TextAssessmentKnowledge", "is", "reused", "when", "we", "import", "an", "exercise", "@throws", "Exception", "might", "be", "thrown", "from", "Network", "Call", "to", "Artemis", "API" ]
@Test @WithMockUser(value = "instructor1", roles = "INSTRUCTOR") public void testReuseTextAssessmentKnowledgeIfExerciseIsImported() throws Exception { final Course course = database.addCourseWithOneReleasedTextExercise(); TextExercise textExercise = textExerciseRepository.findByCourseId(course.getId()).get(0); int exerciseCount = textExerciseRepository.findAll().size(); int textAssessmentKnowledgeCount = textAssesmentKnowledgeRepository.findAll().size(); request.postWithResponseBody("/api/text-exercises/import/" + textExercise.getId(), textExercise, TextExercise.class, HttpStatus.CREATED); assertThat(textAssesmentKnowledgeRepository.findAll().size()).isEqualTo(textAssessmentKnowledgeCount); assertThat(textExerciseRepository.findAll().size()).isEqualTo(exerciseCount + 1); }
[ "@", "Test", "@", "WithMockUser", "(", "value", "=", "\"instructor1\"", ",", "roles", "=", "\"INSTRUCTOR\"", ")", "public", "void", "testReuseTextAssessmentKnowledgeIfExerciseIsImported", "(", ")", "throws", "Exception", "{", "final", "Course", "course", "=", "database", ".", "addCourseWithOneReleasedTextExercise", "(", ")", ";", "TextExercise", "textExercise", "=", "textExerciseRepository", ".", "findByCourseId", "(", "course", ".", "getId", "(", ")", ")", ".", "get", "(", "0", ")", ";", "int", "exerciseCount", "=", "textExerciseRepository", ".", "findAll", "(", ")", ".", "size", "(", ")", ";", "int", "textAssessmentKnowledgeCount", "=", "textAssesmentKnowledgeRepository", ".", "findAll", "(", ")", ".", "size", "(", ")", ";", "request", ".", "postWithResponseBody", "(", "\"/api/text-exercises/import/\"", "+", "textExercise", ".", "getId", "(", ")", ",", "textExercise", ",", "TextExercise", ".", "class", ",", "HttpStatus", ".", "CREATED", ")", ";", "assertThat", "(", "textAssesmentKnowledgeRepository", ".", "findAll", "(", ")", ".", "size", "(", ")", ")", ".", "isEqualTo", "(", "textAssessmentKnowledgeCount", ")", ";", "assertThat", "(", "textExerciseRepository", ".", "findAll", "(", ")", ".", "size", "(", ")", ")", ".", "isEqualTo", "(", "exerciseCount", "+", "1", ")", ";", "}" ]
Tests that TextAssessmentKnowledge is reused when we import an exercise @throws Exception might be thrown from Network Call to Artemis API
[ "Tests", "that", "TextAssessmentKnowledge", "is", "reused", "when", "we", "import", "an", "exercise", "@throws", "Exception", "might", "be", "thrown", "from", "Network", "Call", "to", "Artemis", "API" ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 4709, 203, 565, 632, 1190, 9865, 1299, 12, 1132, 273, 315, 267, 2732, 21, 3113, 4900, 273, 315, 706, 13915, 916, 7923, 203, 565, 1071, 918, 1842, 31704, 1528, 15209, 47, 14390, 2047, 424, 20603, 2520, 24934, 1435, 1216, 1185, 288, 203, 3639, 727, 385, 3117, 4362, 273, 2063, 18, 1289, 39, 3117, 1190, 3335, 26363, 1528, 424, 20603, 5621, 203, 3639, 3867, 424, 20603, 977, 424, 20603, 273, 977, 424, 20603, 3305, 18, 4720, 858, 39, 3117, 548, 12, 5566, 18, 26321, 1435, 2934, 588, 12, 20, 1769, 203, 3639, 509, 24165, 1380, 273, 977, 424, 20603, 3305, 18, 4720, 1595, 7675, 1467, 5621, 203, 3639, 509, 977, 15209, 47, 14390, 1380, 273, 977, 2610, 281, 475, 47, 14390, 3305, 18, 4720, 1595, 7675, 1467, 5621, 203, 3639, 590, 18, 2767, 1190, 23269, 2932, 19, 2425, 19, 955, 17, 8913, 71, 6141, 19, 5666, 4898, 397, 977, 424, 20603, 18, 26321, 9334, 977, 424, 20603, 16, 3867, 424, 20603, 18, 1106, 16, 21153, 18, 18546, 1769, 203, 3639, 1815, 18163, 12, 955, 2610, 281, 475, 47, 14390, 3305, 18, 4720, 1595, 7675, 1467, 1435, 2934, 291, 5812, 774, 12, 955, 15209, 47, 14390, 1380, 1769, 203, 3639, 1815, 18163, 12, 955, 424, 20603, 3305, 18, 4720, 1595, 7675, 1467, 1435, 2934, 291, 5812, 774, 12, 8913, 30708, 1380, 397, 404, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 7766, 87, 716, 3867, 15209, 47, 14390, 353, 23312, 1347, 732, 1930, 392, 24165, 203, 377, 380, 203, 377, 380, 632, 15069, 1185, 4825, 506, 6718, 628, 5128, 3049, 358, 1201, 874, 291, 1491, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
23c5571246ea95db0314093aec47c813f62641c1
ls1intum/Artemis
src/test/java/de/tum/in/www1/artemis/AssessmentKnowledgeIntegrationTest.java
[ "MIT" ]
Java
testKeepKnowledgeWhenExerciseIsDeletedIfOtherExercisesUseIt
null
@Test @WithMockUser(value = "instructor1", roles = "INSTRUCTOR") public void testKeepKnowledgeWhenExerciseIsDeletedIfOtherExercisesUseIt() throws Exception { final Course course = database.addCourseWithOneReleasedTextExercise(); TextExercise textExercise = textExerciseRepository.findByCourseId(course.getId()).get(0); request.postWithResponseBody("/api/text-exercises/import/" + textExercise.getId(), textExercise, TextExercise.class, HttpStatus.CREATED); int exerciseCount = textExerciseRepository.findAll().size(); int textAssessmentKnowledgeCount = textAssesmentKnowledgeRepository.findAll().size(); request.delete("/api/text-exercises/" + textExercise.getId(), HttpStatus.OK); assertThat(textExerciseRepository.findAll().size()).isEqualTo(exerciseCount - 1); assertThat(textAssesmentKnowledgeRepository.findAll().size()).isEqualTo(textAssessmentKnowledgeCount); }
/** * Tests that TextAssessmentKnowledge is maintained on the DB even after deleting * the parent exercise if there are other exercises using it * * @throws Exception might be thrown from Network Call to Artemis API */
Tests that TextAssessmentKnowledge is maintained on the DB even after deleting the parent exercise if there are other exercises using it @throws Exception might be thrown from Network Call to Artemis API
[ "Tests", "that", "TextAssessmentKnowledge", "is", "maintained", "on", "the", "DB", "even", "after", "deleting", "the", "parent", "exercise", "if", "there", "are", "other", "exercises", "using", "it", "@throws", "Exception", "might", "be", "thrown", "from", "Network", "Call", "to", "Artemis", "API" ]
@Test @WithMockUser(value = "instructor1", roles = "INSTRUCTOR") public void testKeepKnowledgeWhenExerciseIsDeletedIfOtherExercisesUseIt() throws Exception { final Course course = database.addCourseWithOneReleasedTextExercise(); TextExercise textExercise = textExerciseRepository.findByCourseId(course.getId()).get(0); request.postWithResponseBody("/api/text-exercises/import/" + textExercise.getId(), textExercise, TextExercise.class, HttpStatus.CREATED); int exerciseCount = textExerciseRepository.findAll().size(); int textAssessmentKnowledgeCount = textAssesmentKnowledgeRepository.findAll().size(); request.delete("/api/text-exercises/" + textExercise.getId(), HttpStatus.OK); assertThat(textExerciseRepository.findAll().size()).isEqualTo(exerciseCount - 1); assertThat(textAssesmentKnowledgeRepository.findAll().size()).isEqualTo(textAssessmentKnowledgeCount); }
[ "@", "Test", "@", "WithMockUser", "(", "value", "=", "\"instructor1\"", ",", "roles", "=", "\"INSTRUCTOR\"", ")", "public", "void", "testKeepKnowledgeWhenExerciseIsDeletedIfOtherExercisesUseIt", "(", ")", "throws", "Exception", "{", "final", "Course", "course", "=", "database", ".", "addCourseWithOneReleasedTextExercise", "(", ")", ";", "TextExercise", "textExercise", "=", "textExerciseRepository", ".", "findByCourseId", "(", "course", ".", "getId", "(", ")", ")", ".", "get", "(", "0", ")", ";", "request", ".", "postWithResponseBody", "(", "\"/api/text-exercises/import/\"", "+", "textExercise", ".", "getId", "(", ")", ",", "textExercise", ",", "TextExercise", ".", "class", ",", "HttpStatus", ".", "CREATED", ")", ";", "int", "exerciseCount", "=", "textExerciseRepository", ".", "findAll", "(", ")", ".", "size", "(", ")", ";", "int", "textAssessmentKnowledgeCount", "=", "textAssesmentKnowledgeRepository", ".", "findAll", "(", ")", ".", "size", "(", ")", ";", "request", ".", "delete", "(", "\"/api/text-exercises/\"", "+", "textExercise", ".", "getId", "(", ")", ",", "HttpStatus", ".", "OK", ")", ";", "assertThat", "(", "textExerciseRepository", ".", "findAll", "(", ")", ".", "size", "(", ")", ")", ".", "isEqualTo", "(", "exerciseCount", "-", "1", ")", ";", "assertThat", "(", "textAssesmentKnowledgeRepository", ".", "findAll", "(", ")", ".", "size", "(", ")", ")", ".", "isEqualTo", "(", "textAssessmentKnowledgeCount", ")", ";", "}" ]
Tests that TextAssessmentKnowledge is maintained on the DB even after deleting the parent exercise if there are other exercises using it
[ "Tests", "that", "TextAssessmentKnowledge", "is", "maintained", "on", "the", "DB", "even", "after", "deleting", "the", "parent", "exercise", "if", "there", "are", "other", "exercises", "using", "it" ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 4709, 203, 565, 632, 1190, 9865, 1299, 12, 1132, 273, 315, 267, 2732, 21, 3113, 4900, 273, 315, 706, 13915, 916, 7923, 203, 565, 1071, 918, 1842, 11523, 47, 14390, 9434, 424, 20603, 2520, 7977, 2047, 8290, 424, 12610, 6141, 3727, 7193, 1435, 1216, 1185, 288, 203, 3639, 727, 385, 3117, 4362, 273, 2063, 18, 1289, 39, 3117, 1190, 3335, 26363, 1528, 424, 20603, 5621, 203, 3639, 3867, 424, 20603, 977, 424, 20603, 273, 977, 424, 20603, 3305, 18, 4720, 858, 39, 3117, 548, 12, 5566, 18, 26321, 1435, 2934, 588, 12, 20, 1769, 203, 3639, 590, 18, 2767, 1190, 23269, 2932, 19, 2425, 19, 955, 17, 8913, 71, 6141, 19, 5666, 4898, 397, 977, 424, 20603, 18, 26321, 9334, 977, 424, 20603, 16, 3867, 424, 20603, 18, 1106, 16, 21153, 18, 18546, 1769, 203, 3639, 509, 24165, 1380, 273, 977, 424, 20603, 3305, 18, 4720, 1595, 7675, 1467, 5621, 203, 3639, 509, 977, 15209, 47, 14390, 1380, 273, 977, 2610, 281, 475, 47, 14390, 3305, 18, 4720, 1595, 7675, 1467, 5621, 203, 3639, 590, 18, 3733, 2932, 19, 2425, 19, 955, 17, 8913, 71, 6141, 4898, 397, 977, 424, 20603, 18, 26321, 9334, 21153, 18, 3141, 1769, 203, 3639, 1815, 18163, 12, 955, 424, 20603, 3305, 18, 4720, 1595, 7675, 1467, 1435, 2934, 291, 5812, 774, 12, 8913, 30708, 1380, 300, 404, 1769, 203, 3639, 1815, 18163, 12, 955, 2610, 281, 475, 47, 14390, 3305, 18, 4720, 1595, 7675, 1467, 1435, 2934, 291, 5812, 774, 12, 955, 15209, 47, 14390, 1380, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 7766, 87, 716, 3867, 15209, 47, 14390, 353, 11566, 8707, 603, 326, 2383, 5456, 1839, 12993, 203, 377, 380, 326, 982, 24165, 309, 1915, 854, 1308, 431, 12610, 6141, 1450, 518, 203, 377, 380, 203, 377, 380, 632, 15069, 1185, 4825, 506, 6718, 628, 5128, 3049, 358, 1201, 874, 291, 1491, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
23c5571246ea95db0314093aec47c813f62641c1
ls1intum/Artemis
src/test/java/de/tum/in/www1/artemis/AssessmentKnowledgeIntegrationTest.java
[ "MIT" ]
Java
testDeleteKnowledgeWhenExerciseIsDeletedIfNoOtherExercisesUseIt
null
@Test @WithMockUser(value = "instructor1", roles = "INSTRUCTOR") public void testDeleteKnowledgeWhenExerciseIsDeletedIfNoOtherExercisesUseIt() throws Exception { final Course course = database.addCourseWithOneReleasedTextExercise(); TextExercise textExercise = textExerciseRepository.findByCourseId(course.getId()).get(0); TextExercise importedExercise = request.postWithResponseBody("/api/text-exercises/import/" + textExercise.getId(), textExercise, TextExercise.class, HttpStatus.CREATED); int exerciseCount = textExerciseRepository.findAll().size(); int textAssessmentKnowledgeCount = textAssesmentKnowledgeRepository.findAll().size(); request.delete("/api/text-exercises/" + textExercise.getId(), HttpStatus.OK); int exerciseCountAfterDeletion = textExerciseRepository.findAll().size(); int textAssessmentKnowledgeCountAfterDeletion = textAssesmentKnowledgeRepository.findAll().size(); request.delete("/api/text-exercises/" + importedExercise.getId(), HttpStatus.OK); assertThat(exerciseCountAfterDeletion).isEqualTo(exerciseCount - 1); assertThat(textAssessmentKnowledgeCountAfterDeletion).isEqualTo(textAssessmentKnowledgeCount); assertThat(textExerciseRepository.findAll().size()).isEqualTo(exerciseCount - 2); assertThat(textAssesmentKnowledgeRepository.findAll().size()).isEqualTo(textAssessmentKnowledgeCount - 1); }
/** * Tests that a TextAssessmentKnowledge is deleted when we delete an exercise and * no other exercises use it * * @throws Exception might be thrown from Network Call to Artemis API */
Tests that a TextAssessmentKnowledge is deleted when we delete an exercise and no other exercises use it @throws Exception might be thrown from Network Call to Artemis API
[ "Tests", "that", "a", "TextAssessmentKnowledge", "is", "deleted", "when", "we", "delete", "an", "exercise", "and", "no", "other", "exercises", "use", "it", "@throws", "Exception", "might", "be", "thrown", "from", "Network", "Call", "to", "Artemis", "API" ]
@Test @WithMockUser(value = "instructor1", roles = "INSTRUCTOR") public void testDeleteKnowledgeWhenExerciseIsDeletedIfNoOtherExercisesUseIt() throws Exception { final Course course = database.addCourseWithOneReleasedTextExercise(); TextExercise textExercise = textExerciseRepository.findByCourseId(course.getId()).get(0); TextExercise importedExercise = request.postWithResponseBody("/api/text-exercises/import/" + textExercise.getId(), textExercise, TextExercise.class, HttpStatus.CREATED); int exerciseCount = textExerciseRepository.findAll().size(); int textAssessmentKnowledgeCount = textAssesmentKnowledgeRepository.findAll().size(); request.delete("/api/text-exercises/" + textExercise.getId(), HttpStatus.OK); int exerciseCountAfterDeletion = textExerciseRepository.findAll().size(); int textAssessmentKnowledgeCountAfterDeletion = textAssesmentKnowledgeRepository.findAll().size(); request.delete("/api/text-exercises/" + importedExercise.getId(), HttpStatus.OK); assertThat(exerciseCountAfterDeletion).isEqualTo(exerciseCount - 1); assertThat(textAssessmentKnowledgeCountAfterDeletion).isEqualTo(textAssessmentKnowledgeCount); assertThat(textExerciseRepository.findAll().size()).isEqualTo(exerciseCount - 2); assertThat(textAssesmentKnowledgeRepository.findAll().size()).isEqualTo(textAssessmentKnowledgeCount - 1); }
[ "@", "Test", "@", "WithMockUser", "(", "value", "=", "\"instructor1\"", ",", "roles", "=", "\"INSTRUCTOR\"", ")", "public", "void", "testDeleteKnowledgeWhenExerciseIsDeletedIfNoOtherExercisesUseIt", "(", ")", "throws", "Exception", "{", "final", "Course", "course", "=", "database", ".", "addCourseWithOneReleasedTextExercise", "(", ")", ";", "TextExercise", "textExercise", "=", "textExerciseRepository", ".", "findByCourseId", "(", "course", ".", "getId", "(", ")", ")", ".", "get", "(", "0", ")", ";", "TextExercise", "importedExercise", "=", "request", ".", "postWithResponseBody", "(", "\"/api/text-exercises/import/\"", "+", "textExercise", ".", "getId", "(", ")", ",", "textExercise", ",", "TextExercise", ".", "class", ",", "HttpStatus", ".", "CREATED", ")", ";", "int", "exerciseCount", "=", "textExerciseRepository", ".", "findAll", "(", ")", ".", "size", "(", ")", ";", "int", "textAssessmentKnowledgeCount", "=", "textAssesmentKnowledgeRepository", ".", "findAll", "(", ")", ".", "size", "(", ")", ";", "request", ".", "delete", "(", "\"/api/text-exercises/\"", "+", "textExercise", ".", "getId", "(", ")", ",", "HttpStatus", ".", "OK", ")", ";", "int", "exerciseCountAfterDeletion", "=", "textExerciseRepository", ".", "findAll", "(", ")", ".", "size", "(", ")", ";", "int", "textAssessmentKnowledgeCountAfterDeletion", "=", "textAssesmentKnowledgeRepository", ".", "findAll", "(", ")", ".", "size", "(", ")", ";", "request", ".", "delete", "(", "\"/api/text-exercises/\"", "+", "importedExercise", ".", "getId", "(", ")", ",", "HttpStatus", ".", "OK", ")", ";", "assertThat", "(", "exerciseCountAfterDeletion", ")", ".", "isEqualTo", "(", "exerciseCount", "-", "1", ")", ";", "assertThat", "(", "textAssessmentKnowledgeCountAfterDeletion", ")", ".", "isEqualTo", "(", "textAssessmentKnowledgeCount", ")", ";", "assertThat", "(", "textExerciseRepository", ".", "findAll", "(", ")", ".", "size", "(", ")", ")", ".", "isEqualTo", "(", "exerciseCount", "-", "2", ")", ";", "assertThat", "(", "textAssesmentKnowledgeRepository", ".", "findAll", "(", ")", ".", "size", "(", ")", ")", ".", "isEqualTo", "(", "textAssessmentKnowledgeCount", "-", "1", ")", ";", "}" ]
Tests that a TextAssessmentKnowledge is deleted when we delete an exercise and no other exercises use it
[ "Tests", "that", "a", "TextAssessmentKnowledge", "is", "deleted", "when", "we", "delete", "an", "exercise", "and", "no", "other", "exercises", "use", "it" ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 4709, 203, 565, 632, 1190, 9865, 1299, 12, 1132, 273, 315, 267, 2732, 21, 3113, 4900, 273, 315, 706, 13915, 916, 7923, 203, 565, 1071, 918, 1842, 2613, 47, 14390, 9434, 424, 20603, 2520, 7977, 2047, 2279, 8290, 424, 12610, 6141, 3727, 7193, 1435, 1216, 1185, 288, 203, 3639, 727, 385, 3117, 4362, 273, 2063, 18, 1289, 39, 3117, 1190, 3335, 26363, 1528, 424, 20603, 5621, 203, 3639, 3867, 424, 20603, 977, 424, 20603, 273, 977, 424, 20603, 3305, 18, 4720, 858, 39, 3117, 548, 12, 5566, 18, 26321, 1435, 2934, 588, 12, 20, 1769, 203, 3639, 3867, 424, 20603, 9101, 424, 20603, 273, 590, 18, 2767, 1190, 23269, 2932, 19, 2425, 19, 955, 17, 8913, 71, 6141, 19, 5666, 4898, 397, 977, 424, 20603, 18, 26321, 9334, 977, 424, 20603, 16, 3867, 424, 20603, 18, 1106, 16, 21153, 18, 18546, 1769, 203, 3639, 509, 24165, 1380, 273, 977, 424, 20603, 3305, 18, 4720, 1595, 7675, 1467, 5621, 203, 3639, 509, 977, 15209, 47, 14390, 1380, 273, 977, 2610, 281, 475, 47, 14390, 3305, 18, 4720, 1595, 7675, 1467, 5621, 203, 3639, 590, 18, 3733, 2932, 19, 2425, 19, 955, 17, 8913, 71, 6141, 4898, 397, 977, 424, 20603, 18, 26321, 9334, 21153, 18, 3141, 1769, 203, 3639, 509, 24165, 1380, 4436, 13064, 273, 977, 424, 20603, 3305, 18, 4720, 1595, 7675, 1467, 5621, 203, 3639, 509, 977, 15209, 47, 14390, 1380, 4436, 13064, 273, 977, 2610, 281, 475, 47, 14390, 3305, 18, 4720, 1595, 7675, 1467, 5621, 203, 3639, 590, 18, 3733, 2932, 19, 2425, 19, 955, 17, 8913, 71, 6141, 4898, 397, 9101, 424, 20603, 18, 26321, 9334, 21153, 18, 3141, 1769, 203, 3639, 1815, 18163, 12, 8913, 30708, 1380, 4436, 13064, 2934, 291, 5812, 774, 12, 8913, 30708, 1380, 300, 404, 1769, 203, 3639, 1815, 18163, 12, 955, 15209, 47, 14390, 1380, 4436, 13064, 2934, 291, 5812, 774, 12, 955, 15209, 47, 14390, 1380, 1769, 203, 3639, 1815, 18163, 12, 955, 424, 20603, 3305, 18, 4720, 1595, 7675, 1467, 1435, 2934, 291, 5812, 774, 12, 8913, 30708, 1380, 300, 576, 1769, 203, 3639, 1815, 18163, 12, 955, 2610, 281, 475, 47, 14390, 3305, 18, 4720, 1595, 7675, 1467, 1435, 2934, 291, 5812, 774, 12, 955, 15209, 47, 14390, 1380, 300, 404, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 7766, 87, 716, 279, 3867, 15209, 47, 14390, 353, 4282, 1347, 732, 1430, 392, 24165, 471, 203, 377, 380, 1158, 1308, 431, 12610, 6141, 999, 518, 203, 377, 380, 203, 377, 380, 632, 15069, 1185, 4825, 506, 6718, 628, 5128, 3049, 358, 1201, 874, 291, 1491, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
23c5571246ea95db0314093aec47c813f62641c1
ls1intum/Artemis
src/test/java/de/tum/in/www1/artemis/AssessmentKnowledgeIntegrationTest.java
[ "MIT" ]
Java
testCreateModelAssessmentKnowledgeIfExerciseIsCreatedFromScratch
null
@Test @WithMockUser(value = "instructor1", roles = "INSTRUCTOR") public void testCreateModelAssessmentKnowledgeIfExerciseIsCreatedFromScratch() throws Exception { Course course = database.addEmptyCourse(); ModelingExercise modelingExercise = modelingExerciseUtilService.createModelingExercise(course.getId()); int count = modelAssesmentKnowledgeRepository.findAll().size(); request.postWithResponseBody("/api/modeling-exercises", modelingExercise, ModelingExercise.class, HttpStatus.CREATED); assertThat(modelAssesmentKnowledgeRepository.findAll().size()).isEqualTo(count + 1); }
/** * Tests that a new ModelAssessmentKnowledge is created when we create an exercise from scratch * * @throws Exception might be thrown from Network Call to Artemis API */
Tests that a new ModelAssessmentKnowledge is created when we create an exercise from scratch @throws Exception might be thrown from Network Call to Artemis API
[ "Tests", "that", "a", "new", "ModelAssessmentKnowledge", "is", "created", "when", "we", "create", "an", "exercise", "from", "scratch", "@throws", "Exception", "might", "be", "thrown", "from", "Network", "Call", "to", "Artemis", "API" ]
@Test @WithMockUser(value = "instructor1", roles = "INSTRUCTOR") public void testCreateModelAssessmentKnowledgeIfExerciseIsCreatedFromScratch() throws Exception { Course course = database.addEmptyCourse(); ModelingExercise modelingExercise = modelingExerciseUtilService.createModelingExercise(course.getId()); int count = modelAssesmentKnowledgeRepository.findAll().size(); request.postWithResponseBody("/api/modeling-exercises", modelingExercise, ModelingExercise.class, HttpStatus.CREATED); assertThat(modelAssesmentKnowledgeRepository.findAll().size()).isEqualTo(count + 1); }
[ "@", "Test", "@", "WithMockUser", "(", "value", "=", "\"instructor1\"", ",", "roles", "=", "\"INSTRUCTOR\"", ")", "public", "void", "testCreateModelAssessmentKnowledgeIfExerciseIsCreatedFromScratch", "(", ")", "throws", "Exception", "{", "Course", "course", "=", "database", ".", "addEmptyCourse", "(", ")", ";", "ModelingExercise", "modelingExercise", "=", "modelingExerciseUtilService", ".", "createModelingExercise", "(", "course", ".", "getId", "(", ")", ")", ";", "int", "count", "=", "modelAssesmentKnowledgeRepository", ".", "findAll", "(", ")", ".", "size", "(", ")", ";", "request", ".", "postWithResponseBody", "(", "\"/api/modeling-exercises\"", ",", "modelingExercise", ",", "ModelingExercise", ".", "class", ",", "HttpStatus", ".", "CREATED", ")", ";", "assertThat", "(", "modelAssesmentKnowledgeRepository", ".", "findAll", "(", ")", ".", "size", "(", ")", ")", ".", "isEqualTo", "(", "count", "+", "1", ")", ";", "}" ]
Tests that a new ModelAssessmentKnowledge is created when we create an exercise from scratch @throws Exception might be thrown from Network Call to Artemis API
[ "Tests", "that", "a", "new", "ModelAssessmentKnowledge", "is", "created", "when", "we", "create", "an", "exercise", "from", "scratch", "@throws", "Exception", "might", "be", "thrown", "from", "Network", "Call", "to", "Artemis", "API" ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 4709, 203, 565, 632, 1190, 9865, 1299, 12, 1132, 273, 315, 267, 2732, 21, 3113, 4900, 273, 315, 706, 13915, 916, 7923, 203, 565, 1071, 918, 1842, 1684, 1488, 15209, 47, 14390, 2047, 424, 20603, 2520, 6119, 1265, 1541, 86, 505, 1435, 1216, 1185, 288, 203, 3639, 385, 3117, 4362, 273, 2063, 18, 1289, 1921, 39, 3117, 5621, 203, 3639, 3164, 310, 424, 20603, 938, 310, 424, 20603, 273, 938, 310, 424, 20603, 1304, 1179, 18, 2640, 1488, 310, 424, 20603, 12, 5566, 18, 26321, 10663, 203, 3639, 509, 1056, 273, 938, 2610, 281, 475, 47, 14390, 3305, 18, 4720, 1595, 7675, 1467, 5621, 203, 3639, 590, 18, 2767, 1190, 23269, 2932, 19, 2425, 19, 2284, 310, 17, 8913, 71, 6141, 3113, 938, 310, 424, 20603, 16, 3164, 310, 424, 20603, 18, 1106, 16, 21153, 18, 18546, 1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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 7766, 87, 716, 279, 394, 3164, 15209, 47, 14390, 353, 2522, 1347, 732, 752, 392, 24165, 628, 15289, 203, 377, 380, 203, 377, 380, 632, 15069, 1185, 4825, 506, 6718, 628, 5128, 3049, 358, 1201, 874, 291, 1491, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
23c5571246ea95db0314093aec47c813f62641c1
ls1intum/Artemis
src/test/java/de/tum/in/www1/artemis/AssessmentKnowledgeIntegrationTest.java
[ "MIT" ]
Java
testReuseModelAssessmentKnowledgeIfExerciseIsImported
null
@Test @WithMockUser(value = "instructor1", roles = "INSTRUCTOR") public void testReuseModelAssessmentKnowledgeIfExerciseIsImported() throws Exception { final Course course = database.addCourseWithOneReleasedModelExerciseWithKnowledge(); ModelingExercise modelingExercise = modelingExerciseRepository.findByCourseId(course.getId()).get(0); int exerciseCount = modelingExerciseRepository.findAll().size(); int modelAssessmentKnowledgeCount = modelAssesmentKnowledgeRepository.findAll().size(); request.postWithResponseBody("/api/modeling-exercises/import/" + modelingExercise.getId(), modelingExercise, ModelingExercise.class, HttpStatus.CREATED); assertThat(modelAssesmentKnowledgeRepository.findAll().size()).isEqualTo(modelAssessmentKnowledgeCount); assertThat(modelingExerciseRepository.findAll().size()).isEqualTo(exerciseCount + 1); }
/** * Tests that ModelAssessmentKnowledge is reused when we import an exercise * * @throws Exception might be thrown from Network Call to Artemis API */
Tests that ModelAssessmentKnowledge is reused when we import an exercise @throws Exception might be thrown from Network Call to Artemis API
[ "Tests", "that", "ModelAssessmentKnowledge", "is", "reused", "when", "we", "import", "an", "exercise", "@throws", "Exception", "might", "be", "thrown", "from", "Network", "Call", "to", "Artemis", "API" ]
@Test @WithMockUser(value = "instructor1", roles = "INSTRUCTOR") public void testReuseModelAssessmentKnowledgeIfExerciseIsImported() throws Exception { final Course course = database.addCourseWithOneReleasedModelExerciseWithKnowledge(); ModelingExercise modelingExercise = modelingExerciseRepository.findByCourseId(course.getId()).get(0); int exerciseCount = modelingExerciseRepository.findAll().size(); int modelAssessmentKnowledgeCount = modelAssesmentKnowledgeRepository.findAll().size(); request.postWithResponseBody("/api/modeling-exercises/import/" + modelingExercise.getId(), modelingExercise, ModelingExercise.class, HttpStatus.CREATED); assertThat(modelAssesmentKnowledgeRepository.findAll().size()).isEqualTo(modelAssessmentKnowledgeCount); assertThat(modelingExerciseRepository.findAll().size()).isEqualTo(exerciseCount + 1); }
[ "@", "Test", "@", "WithMockUser", "(", "value", "=", "\"instructor1\"", ",", "roles", "=", "\"INSTRUCTOR\"", ")", "public", "void", "testReuseModelAssessmentKnowledgeIfExerciseIsImported", "(", ")", "throws", "Exception", "{", "final", "Course", "course", "=", "database", ".", "addCourseWithOneReleasedModelExerciseWithKnowledge", "(", ")", ";", "ModelingExercise", "modelingExercise", "=", "modelingExerciseRepository", ".", "findByCourseId", "(", "course", ".", "getId", "(", ")", ")", ".", "get", "(", "0", ")", ";", "int", "exerciseCount", "=", "modelingExerciseRepository", ".", "findAll", "(", ")", ".", "size", "(", ")", ";", "int", "modelAssessmentKnowledgeCount", "=", "modelAssesmentKnowledgeRepository", ".", "findAll", "(", ")", ".", "size", "(", ")", ";", "request", ".", "postWithResponseBody", "(", "\"/api/modeling-exercises/import/\"", "+", "modelingExercise", ".", "getId", "(", ")", ",", "modelingExercise", ",", "ModelingExercise", ".", "class", ",", "HttpStatus", ".", "CREATED", ")", ";", "assertThat", "(", "modelAssesmentKnowledgeRepository", ".", "findAll", "(", ")", ".", "size", "(", ")", ")", ".", "isEqualTo", "(", "modelAssessmentKnowledgeCount", ")", ";", "assertThat", "(", "modelingExerciseRepository", ".", "findAll", "(", ")", ".", "size", "(", ")", ")", ".", "isEqualTo", "(", "exerciseCount", "+", "1", ")", ";", "}" ]
Tests that ModelAssessmentKnowledge is reused when we import an exercise @throws Exception might be thrown from Network Call to Artemis API
[ "Tests", "that", "ModelAssessmentKnowledge", "is", "reused", "when", "we", "import", "an", "exercise", "@throws", "Exception", "might", "be", "thrown", "from", "Network", "Call", "to", "Artemis", "API" ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 4709, 203, 565, 632, 1190, 9865, 1299, 12, 1132, 273, 315, 267, 2732, 21, 3113, 4900, 273, 315, 706, 13915, 916, 7923, 203, 565, 1071, 918, 1842, 31704, 1488, 15209, 47, 14390, 2047, 424, 20603, 2520, 24934, 1435, 1216, 1185, 288, 203, 3639, 727, 385, 3117, 4362, 273, 2063, 18, 1289, 39, 3117, 1190, 3335, 26363, 1488, 424, 20603, 1190, 47, 14390, 5621, 203, 3639, 3164, 310, 424, 20603, 938, 310, 424, 20603, 273, 938, 310, 424, 20603, 3305, 18, 4720, 858, 39, 3117, 548, 12, 5566, 18, 26321, 1435, 2934, 588, 12, 20, 1769, 203, 3639, 509, 24165, 1380, 273, 938, 310, 424, 20603, 3305, 18, 4720, 1595, 7675, 1467, 5621, 203, 3639, 509, 938, 15209, 47, 14390, 1380, 273, 938, 2610, 281, 475, 47, 14390, 3305, 18, 4720, 1595, 7675, 1467, 5621, 203, 3639, 590, 18, 2767, 1190, 23269, 2932, 19, 2425, 19, 2284, 310, 17, 8913, 71, 6141, 19, 5666, 4898, 397, 938, 310, 424, 20603, 18, 26321, 9334, 938, 310, 424, 20603, 16, 3164, 310, 424, 20603, 18, 1106, 16, 21153, 18, 18546, 1769, 203, 3639, 1815, 18163, 12, 2284, 2610, 281, 475, 47, 14390, 3305, 18, 4720, 1595, 7675, 1467, 1435, 2934, 291, 5812, 774, 12, 2284, 15209, 47, 14390, 1380, 1769, 203, 3639, 1815, 18163, 12, 2284, 310, 424, 20603, 3305, 18, 4720, 1595, 7675, 1467, 1435, 2934, 291, 5812, 774, 12, 8913, 30708, 1380, 397, 404, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 7766, 87, 716, 3164, 15209, 47, 14390, 353, 23312, 1347, 732, 1930, 392, 24165, 203, 377, 380, 203, 377, 380, 632, 15069, 1185, 4825, 506, 6718, 628, 5128, 3049, 358, 1201, 874, 291, 1491, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
23c5571246ea95db0314093aec47c813f62641c1
ls1intum/Artemis
src/test/java/de/tum/in/www1/artemis/AssessmentKnowledgeIntegrationTest.java
[ "MIT" ]
Java
testKeepModelAssessmentKnowledgeWhenExerciseIsDeletedIfOtherExercisesUseIt
null
@Test @WithMockUser(value = "instructor1", roles = "INSTRUCTOR") public void testKeepModelAssessmentKnowledgeWhenExerciseIsDeletedIfOtherExercisesUseIt() throws Exception { final Course course = database.addCourseWithOneReleasedModelExerciseWithKnowledge(); ModelingExercise modelingExercise = modelingExerciseRepository.findByCourseId(course.getId()).get(0); request.postWithResponseBody("/api/modeling-exercises/import/" + modelingExercise.getId(), modelingExercise, ModelingExercise.class, HttpStatus.CREATED); int exerciseCount = modelingExerciseRepository.findAll().size(); int modelAssessmentKnowledgeCount = modelAssesmentKnowledgeRepository.findAll().size(); request.delete("/api/modeling-exercises/" + modelingExercise.getId(), HttpStatus.OK); assertThat(modelingExerciseRepository.findAll().size()).isEqualTo(exerciseCount - 1); assertThat(modelAssesmentKnowledgeRepository.findAll().size()).isEqualTo(modelAssessmentKnowledgeCount); }
/** * Tests that ModelAssessmentKnowledge is not removed from the DB even after deleting * the parent exercise if there are other exercises using it * * @throws Exception might be thrown from Network Call to Artemis API */
Tests that ModelAssessmentKnowledge is not removed from the DB even after deleting the parent exercise if there are other exercises using it @throws Exception might be thrown from Network Call to Artemis API
[ "Tests", "that", "ModelAssessmentKnowledge", "is", "not", "removed", "from", "the", "DB", "even", "after", "deleting", "the", "parent", "exercise", "if", "there", "are", "other", "exercises", "using", "it", "@throws", "Exception", "might", "be", "thrown", "from", "Network", "Call", "to", "Artemis", "API" ]
@Test @WithMockUser(value = "instructor1", roles = "INSTRUCTOR") public void testKeepModelAssessmentKnowledgeWhenExerciseIsDeletedIfOtherExercisesUseIt() throws Exception { final Course course = database.addCourseWithOneReleasedModelExerciseWithKnowledge(); ModelingExercise modelingExercise = modelingExerciseRepository.findByCourseId(course.getId()).get(0); request.postWithResponseBody("/api/modeling-exercises/import/" + modelingExercise.getId(), modelingExercise, ModelingExercise.class, HttpStatus.CREATED); int exerciseCount = modelingExerciseRepository.findAll().size(); int modelAssessmentKnowledgeCount = modelAssesmentKnowledgeRepository.findAll().size(); request.delete("/api/modeling-exercises/" + modelingExercise.getId(), HttpStatus.OK); assertThat(modelingExerciseRepository.findAll().size()).isEqualTo(exerciseCount - 1); assertThat(modelAssesmentKnowledgeRepository.findAll().size()).isEqualTo(modelAssessmentKnowledgeCount); }
[ "@", "Test", "@", "WithMockUser", "(", "value", "=", "\"instructor1\"", ",", "roles", "=", "\"INSTRUCTOR\"", ")", "public", "void", "testKeepModelAssessmentKnowledgeWhenExerciseIsDeletedIfOtherExercisesUseIt", "(", ")", "throws", "Exception", "{", "final", "Course", "course", "=", "database", ".", "addCourseWithOneReleasedModelExerciseWithKnowledge", "(", ")", ";", "ModelingExercise", "modelingExercise", "=", "modelingExerciseRepository", ".", "findByCourseId", "(", "course", ".", "getId", "(", ")", ")", ".", "get", "(", "0", ")", ";", "request", ".", "postWithResponseBody", "(", "\"/api/modeling-exercises/import/\"", "+", "modelingExercise", ".", "getId", "(", ")", ",", "modelingExercise", ",", "ModelingExercise", ".", "class", ",", "HttpStatus", ".", "CREATED", ")", ";", "int", "exerciseCount", "=", "modelingExerciseRepository", ".", "findAll", "(", ")", ".", "size", "(", ")", ";", "int", "modelAssessmentKnowledgeCount", "=", "modelAssesmentKnowledgeRepository", ".", "findAll", "(", ")", ".", "size", "(", ")", ";", "request", ".", "delete", "(", "\"/api/modeling-exercises/\"", "+", "modelingExercise", ".", "getId", "(", ")", ",", "HttpStatus", ".", "OK", ")", ";", "assertThat", "(", "modelingExerciseRepository", ".", "findAll", "(", ")", ".", "size", "(", ")", ")", ".", "isEqualTo", "(", "exerciseCount", "-", "1", ")", ";", "assertThat", "(", "modelAssesmentKnowledgeRepository", ".", "findAll", "(", ")", ".", "size", "(", ")", ")", ".", "isEqualTo", "(", "modelAssessmentKnowledgeCount", ")", ";", "}" ]
Tests that ModelAssessmentKnowledge is not removed from the DB even after deleting the parent exercise if there are other exercises using it
[ "Tests", "that", "ModelAssessmentKnowledge", "is", "not", "removed", "from", "the", "DB", "even", "after", "deleting", "the", "parent", "exercise", "if", "there", "are", "other", "exercises", "using", "it" ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 4709, 203, 565, 632, 1190, 9865, 1299, 12, 1132, 273, 315, 267, 2732, 21, 3113, 4900, 273, 315, 706, 13915, 916, 7923, 203, 565, 1071, 918, 1842, 11523, 1488, 15209, 47, 14390, 9434, 424, 20603, 2520, 7977, 2047, 8290, 424, 12610, 6141, 3727, 7193, 1435, 1216, 1185, 288, 203, 3639, 727, 385, 3117, 4362, 273, 2063, 18, 1289, 39, 3117, 1190, 3335, 26363, 1488, 424, 20603, 1190, 47, 14390, 5621, 203, 3639, 3164, 310, 424, 20603, 938, 310, 424, 20603, 273, 938, 310, 424, 20603, 3305, 18, 4720, 858, 39, 3117, 548, 12, 5566, 18, 26321, 1435, 2934, 588, 12, 20, 1769, 203, 3639, 590, 18, 2767, 1190, 23269, 2932, 19, 2425, 19, 2284, 310, 17, 8913, 71, 6141, 19, 5666, 4898, 397, 938, 310, 424, 20603, 18, 26321, 9334, 938, 310, 424, 20603, 16, 3164, 310, 424, 20603, 18, 1106, 16, 21153, 18, 18546, 1769, 203, 3639, 509, 24165, 1380, 273, 938, 310, 424, 20603, 3305, 18, 4720, 1595, 7675, 1467, 5621, 203, 3639, 509, 938, 15209, 47, 14390, 1380, 273, 938, 2610, 281, 475, 47, 14390, 3305, 18, 4720, 1595, 7675, 1467, 5621, 203, 3639, 590, 18, 3733, 2932, 19, 2425, 19, 2284, 310, 17, 8913, 71, 6141, 4898, 397, 938, 310, 424, 20603, 18, 26321, 9334, 21153, 18, 3141, 1769, 203, 3639, 1815, 18163, 12, 2284, 310, 424, 20603, 3305, 18, 4720, 1595, 7675, 1467, 1435, 2934, 291, 5812, 774, 12, 8913, 30708, 1380, 300, 404, 1769, 203, 3639, 1815, 18163, 12, 2284, 2610, 281, 475, 47, 14390, 3305, 18, 4720, 1595, 7675, 1467, 1435, 2934, 291, 5812, 774, 12, 2284, 15209, 47, 14390, 1380, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 7766, 87, 716, 3164, 15209, 47, 14390, 353, 486, 3723, 628, 326, 2383, 5456, 1839, 12993, 203, 377, 380, 326, 982, 24165, 309, 1915, 854, 1308, 431, 12610, 6141, 1450, 518, 203, 377, 380, 203, 377, 380, 632, 15069, 1185, 4825, 506, 6718, 628, 5128, 3049, 358, 1201, 874, 291, 1491, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
23c5571246ea95db0314093aec47c813f62641c1
ls1intum/Artemis
src/test/java/de/tum/in/www1/artemis/AssessmentKnowledgeIntegrationTest.java
[ "MIT" ]
Java
testDeleteModelAssessmentKnowledgeWhenExerciseIsDeletedIfNoOtherExercisesUseIt
null
@Test @WithMockUser(value = "instructor1", roles = "INSTRUCTOR") public void testDeleteModelAssessmentKnowledgeWhenExerciseIsDeletedIfNoOtherExercisesUseIt() throws Exception { final Course course = database.addCourseWithOneReleasedModelExerciseWithKnowledge(); ModelingExercise modelingExercise = modelingExerciseRepository.findByCourseId(course.getId()).get(0); ModelingExercise importedExercise = request.postWithResponseBody("/api/modeling-exercises/import/" + modelingExercise.getId(), modelingExercise, ModelingExercise.class, HttpStatus.CREATED); int exerciseCount = modelingExerciseRepository.findAll().size(); int modelAssessmentKnowledgeCount = modelAssesmentKnowledgeRepository.findAll().size(); request.delete("/api/modeling-exercises/" + modelingExercise.getId(), HttpStatus.OK); int exerciseCountAfterDeletion = modelingExerciseRepository.findAll().size(); int modelAssessmentKnowledgeCountAfterDeletion = modelAssesmentKnowledgeRepository.findAll().size(); request.delete("/api/modeling-exercises/" + importedExercise.getId(), HttpStatus.OK); assertThat(exerciseCountAfterDeletion).isEqualTo(exerciseCount - 1); assertThat(modelAssessmentKnowledgeCountAfterDeletion).isEqualTo(modelAssessmentKnowledgeCount); assertThat(modelingExerciseRepository.findAll().size()).isEqualTo(exerciseCount - 2); assertThat(modelAssesmentKnowledgeRepository.findAll().size()).isEqualTo(modelAssessmentKnowledgeCount - 1); }
/** * Tests that a ModelAssessmentKnowledge is deleted when we delete an exercise and * no other exercises use it * * @throws Exception might be thrown from Network Call to Artemis API */
Tests that a ModelAssessmentKnowledge is deleted when we delete an exercise and no other exercises use it @throws Exception might be thrown from Network Call to Artemis API
[ "Tests", "that", "a", "ModelAssessmentKnowledge", "is", "deleted", "when", "we", "delete", "an", "exercise", "and", "no", "other", "exercises", "use", "it", "@throws", "Exception", "might", "be", "thrown", "from", "Network", "Call", "to", "Artemis", "API" ]
@Test @WithMockUser(value = "instructor1", roles = "INSTRUCTOR") public void testDeleteModelAssessmentKnowledgeWhenExerciseIsDeletedIfNoOtherExercisesUseIt() throws Exception { final Course course = database.addCourseWithOneReleasedModelExerciseWithKnowledge(); ModelingExercise modelingExercise = modelingExerciseRepository.findByCourseId(course.getId()).get(0); ModelingExercise importedExercise = request.postWithResponseBody("/api/modeling-exercises/import/" + modelingExercise.getId(), modelingExercise, ModelingExercise.class, HttpStatus.CREATED); int exerciseCount = modelingExerciseRepository.findAll().size(); int modelAssessmentKnowledgeCount = modelAssesmentKnowledgeRepository.findAll().size(); request.delete("/api/modeling-exercises/" + modelingExercise.getId(), HttpStatus.OK); int exerciseCountAfterDeletion = modelingExerciseRepository.findAll().size(); int modelAssessmentKnowledgeCountAfterDeletion = modelAssesmentKnowledgeRepository.findAll().size(); request.delete("/api/modeling-exercises/" + importedExercise.getId(), HttpStatus.OK); assertThat(exerciseCountAfterDeletion).isEqualTo(exerciseCount - 1); assertThat(modelAssessmentKnowledgeCountAfterDeletion).isEqualTo(modelAssessmentKnowledgeCount); assertThat(modelingExerciseRepository.findAll().size()).isEqualTo(exerciseCount - 2); assertThat(modelAssesmentKnowledgeRepository.findAll().size()).isEqualTo(modelAssessmentKnowledgeCount - 1); }
[ "@", "Test", "@", "WithMockUser", "(", "value", "=", "\"instructor1\"", ",", "roles", "=", "\"INSTRUCTOR\"", ")", "public", "void", "testDeleteModelAssessmentKnowledgeWhenExerciseIsDeletedIfNoOtherExercisesUseIt", "(", ")", "throws", "Exception", "{", "final", "Course", "course", "=", "database", ".", "addCourseWithOneReleasedModelExerciseWithKnowledge", "(", ")", ";", "ModelingExercise", "modelingExercise", "=", "modelingExerciseRepository", ".", "findByCourseId", "(", "course", ".", "getId", "(", ")", ")", ".", "get", "(", "0", ")", ";", "ModelingExercise", "importedExercise", "=", "request", ".", "postWithResponseBody", "(", "\"/api/modeling-exercises/import/\"", "+", "modelingExercise", ".", "getId", "(", ")", ",", "modelingExercise", ",", "ModelingExercise", ".", "class", ",", "HttpStatus", ".", "CREATED", ")", ";", "int", "exerciseCount", "=", "modelingExerciseRepository", ".", "findAll", "(", ")", ".", "size", "(", ")", ";", "int", "modelAssessmentKnowledgeCount", "=", "modelAssesmentKnowledgeRepository", ".", "findAll", "(", ")", ".", "size", "(", ")", ";", "request", ".", "delete", "(", "\"/api/modeling-exercises/\"", "+", "modelingExercise", ".", "getId", "(", ")", ",", "HttpStatus", ".", "OK", ")", ";", "int", "exerciseCountAfterDeletion", "=", "modelingExerciseRepository", ".", "findAll", "(", ")", ".", "size", "(", ")", ";", "int", "modelAssessmentKnowledgeCountAfterDeletion", "=", "modelAssesmentKnowledgeRepository", ".", "findAll", "(", ")", ".", "size", "(", ")", ";", "request", ".", "delete", "(", "\"/api/modeling-exercises/\"", "+", "importedExercise", ".", "getId", "(", ")", ",", "HttpStatus", ".", "OK", ")", ";", "assertThat", "(", "exerciseCountAfterDeletion", ")", ".", "isEqualTo", "(", "exerciseCount", "-", "1", ")", ";", "assertThat", "(", "modelAssessmentKnowledgeCountAfterDeletion", ")", ".", "isEqualTo", "(", "modelAssessmentKnowledgeCount", ")", ";", "assertThat", "(", "modelingExerciseRepository", ".", "findAll", "(", ")", ".", "size", "(", ")", ")", ".", "isEqualTo", "(", "exerciseCount", "-", "2", ")", ";", "assertThat", "(", "modelAssesmentKnowledgeRepository", ".", "findAll", "(", ")", ".", "size", "(", ")", ")", ".", "isEqualTo", "(", "modelAssessmentKnowledgeCount", "-", "1", ")", ";", "}" ]
Tests that a ModelAssessmentKnowledge is deleted when we delete an exercise and no other exercises use it
[ "Tests", "that", "a", "ModelAssessmentKnowledge", "is", "deleted", "when", "we", "delete", "an", "exercise", "and", "no", "other", "exercises", "use", "it" ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 4709, 203, 565, 632, 1190, 9865, 1299, 12, 1132, 273, 315, 267, 2732, 21, 3113, 4900, 273, 315, 706, 13915, 916, 7923, 203, 565, 1071, 918, 1842, 2613, 1488, 15209, 47, 14390, 9434, 424, 20603, 2520, 7977, 2047, 2279, 8290, 424, 12610, 6141, 3727, 7193, 1435, 1216, 1185, 288, 203, 3639, 727, 385, 3117, 4362, 273, 2063, 18, 1289, 39, 3117, 1190, 3335, 26363, 1488, 424, 20603, 1190, 47, 14390, 5621, 203, 3639, 3164, 310, 424, 20603, 938, 310, 424, 20603, 273, 938, 310, 424, 20603, 3305, 18, 4720, 858, 39, 3117, 548, 12, 5566, 18, 26321, 1435, 2934, 588, 12, 20, 1769, 203, 3639, 3164, 310, 424, 20603, 9101, 424, 20603, 273, 590, 18, 2767, 1190, 23269, 2932, 19, 2425, 19, 2284, 310, 17, 8913, 71, 6141, 19, 5666, 4898, 397, 938, 310, 424, 20603, 18, 26321, 9334, 938, 310, 424, 20603, 16, 3164, 310, 424, 20603, 18, 1106, 16, 203, 7734, 21153, 18, 18546, 1769, 203, 3639, 509, 24165, 1380, 273, 938, 310, 424, 20603, 3305, 18, 4720, 1595, 7675, 1467, 5621, 203, 3639, 509, 938, 15209, 47, 14390, 1380, 273, 938, 2610, 281, 475, 47, 14390, 3305, 18, 4720, 1595, 7675, 1467, 5621, 203, 3639, 590, 18, 3733, 2932, 19, 2425, 19, 2284, 310, 17, 8913, 71, 6141, 4898, 397, 938, 310, 424, 20603, 18, 26321, 9334, 21153, 18, 3141, 1769, 203, 3639, 509, 24165, 1380, 4436, 13064, 273, 938, 310, 424, 20603, 3305, 18, 4720, 1595, 7675, 1467, 5621, 203, 3639, 509, 938, 15209, 47, 14390, 1380, 4436, 13064, 273, 938, 2610, 281, 475, 47, 14390, 3305, 18, 4720, 1595, 7675, 1467, 5621, 203, 3639, 590, 18, 3733, 2932, 19, 2425, 19, 2284, 310, 17, 8913, 71, 6141, 4898, 397, 9101, 424, 20603, 18, 26321, 9334, 21153, 18, 3141, 1769, 203, 3639, 1815, 18163, 12, 8913, 30708, 1380, 4436, 13064, 2934, 291, 5812, 774, 12, 8913, 30708, 1380, 300, 404, 1769, 203, 3639, 1815, 18163, 12, 2284, 15209, 47, 14390, 1380, 4436, 13064, 2934, 291, 5812, 774, 12, 2284, 15209, 47, 14390, 1380, 1769, 203, 3639, 1815, 18163, 12, 2284, 310, 424, 20603, 3305, 18, 4720, 1595, 7675, 1467, 1435, 2934, 291, 5812, 774, 12, 8913, 30708, 1380, 300, 576, 1769, 203, 3639, 1815, 18163, 12, 2284, 2610, 281, 475, 47, 14390, 3305, 18, 4720, 1595, 7675, 1467, 1435, 2934, 291, 5812, 774, 12, 2284, 15209, 47, 14390, 1380, 300, 404, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 7766, 87, 716, 279, 3164, 15209, 47, 14390, 353, 4282, 1347, 732, 1430, 392, 24165, 471, 203, 377, 380, 1158, 1308, 431, 12610, 6141, 999, 518, 203, 377, 380, 203, 377, 380, 632, 15069, 1185, 4825, 506, 6718, 628, 5128, 3049, 358, 1201, 874, 291, 1491, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
ff8b35aeca0a5d2e85583244c44b1d7e395d04f7
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/repository/StatisticsRepository.java
[ "MIT" ]
Java
mergeResultsIntoArrayForYear
null
default Integer[] mergeResultsIntoArrayForYear(List<StatisticsEntry> outcome, Integer[] result, ZonedDateTime startDate) { for (StatisticsEntry map : outcome) { ZonedDateTime date = (ZonedDateTime) map.getDay(); int amount = (int) map.getAmount(); int monthOfDate = date.getMonth().getValue(); int monthOfStartDate = startDate.getMonth().getValue(); if (monthOfDate >= monthOfStartDate) { // Date is in same year as startDate result[monthOfDate - monthOfStartDate] += amount; } else { // Date is in different year as startDate result[12 - monthOfStartDate + monthOfDate] += amount; } } return result; }
/** * Gets a List<StatisticsData> each containing a date and an amount of entries. We take the amount of entries and * map it into a the results array based on the date of the entry. This method handles the spanType YEAR * * @param outcome A List<StatisticsData>, each StatisticsData containing a date and the amount of entries for one timeslot * @param result the array in which the converted outcome should be inserted * @param startDate the startDate of the result array * @return an array, containing the values for each bar in the graph */
Gets a List each containing a date and an amount of entries. We take the amount of entries and map it into a the results array based on the date of the entry. This method handles the spanType YEAR @param outcome A List, each StatisticsData containing a date and the amount of entries for one timeslot @param result the array in which the converted outcome should be inserted @param startDate the startDate of the result array @return an array, containing the values for each bar in the graph
[ "Gets", "a", "List", "each", "containing", "a", "date", "and", "an", "amount", "of", "entries", ".", "We", "take", "the", "amount", "of", "entries", "and", "map", "it", "into", "a", "the", "results", "array", "based", "on", "the", "date", "of", "the", "entry", ".", "This", "method", "handles", "the", "spanType", "YEAR", "@param", "outcome", "A", "List", "each", "StatisticsData", "containing", "a", "date", "and", "the", "amount", "of", "entries", "for", "one", "timeslot", "@param", "result", "the", "array", "in", "which", "the", "converted", "outcome", "should", "be", "inserted", "@param", "startDate", "the", "startDate", "of", "the", "result", "array", "@return", "an", "array", "containing", "the", "values", "for", "each", "bar", "in", "the", "graph" ]
default Integer[] mergeResultsIntoArrayForYear(List<StatisticsEntry> outcome, Integer[] result, ZonedDateTime startDate) { for (StatisticsEntry map : outcome) { ZonedDateTime date = (ZonedDateTime) map.getDay(); int amount = (int) map.getAmount(); int monthOfDate = date.getMonth().getValue(); int monthOfStartDate = startDate.getMonth().getValue(); if (monthOfDate >= monthOfStartDate) { result[monthOfDate - monthOfStartDate] += amount; } else { result[12 - monthOfStartDate + monthOfDate] += amount; } } return result; }
[ "default", "Integer", "[", "]", "mergeResultsIntoArrayForYear", "(", "List", "<", "StatisticsEntry", ">", "outcome", ",", "Integer", "[", "]", "result", ",", "ZonedDateTime", "startDate", ")", "{", "for", "(", "StatisticsEntry", "map", ":", "outcome", ")", "{", "ZonedDateTime", "date", "=", "(", "ZonedDateTime", ")", "map", ".", "getDay", "(", ")", ";", "int", "amount", "=", "(", "int", ")", "map", ".", "getAmount", "(", ")", ";", "int", "monthOfDate", "=", "date", ".", "getMonth", "(", ")", ".", "getValue", "(", ")", ";", "int", "monthOfStartDate", "=", "startDate", ".", "getMonth", "(", ")", ".", "getValue", "(", ")", ";", "if", "(", "monthOfDate", ">=", "monthOfStartDate", ")", "{", "result", "[", "monthOfDate", "-", "monthOfStartDate", "]", "+=", "amount", ";", "}", "else", "{", "result", "[", "12", "-", "monthOfStartDate", "+", "monthOfDate", "]", "+=", "amount", ";", "}", "}", "return", "result", ";", "}" ]
Gets a List<StatisticsData> each containing a date and an amount of entries.
[ "Gets", "a", "List<StatisticsData", ">", "each", "containing", "a", "date", "and", "an", "amount", "of", "entries", "." ]
[ "// Date is in same year as startDate", "// Date is in different year as startDate" ]
[ { "param": "outcome", "type": "List<StatisticsEntry>" }, { "param": "result", "type": "Integer[]" }, { "param": "startDate", "type": "ZonedDateTime" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "outcome", "type": "List<StatisticsEntry>", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "result", "type": "Integer[]", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "startDate", "type": "ZonedDateTime", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 805, 2144, 8526, 2691, 3447, 5952, 1076, 1290, 5593, 12, 682, 32, 8569, 1622, 34, 12884, 16, 2144, 8526, 563, 16, 24869, 12572, 13, 288, 203, 3639, 364, 261, 8569, 1622, 852, 294, 12884, 13, 288, 203, 5411, 24869, 1509, 273, 261, 62, 20461, 13, 852, 18, 588, 4245, 5621, 203, 5411, 509, 3844, 273, 261, 474, 13, 852, 18, 588, 6275, 5621, 203, 5411, 509, 3138, 951, 1626, 273, 1509, 18, 588, 5445, 7675, 24805, 5621, 203, 5411, 509, 3138, 951, 22635, 273, 12572, 18, 588, 5445, 7675, 24805, 5621, 203, 5411, 309, 261, 7496, 951, 1626, 1545, 3138, 951, 22635, 13, 288, 203, 7734, 368, 2167, 353, 316, 1967, 3286, 487, 12572, 203, 7734, 563, 63, 7496, 951, 1626, 300, 3138, 951, 22635, 65, 1011, 3844, 31, 203, 5411, 289, 203, 5411, 469, 288, 203, 7734, 368, 2167, 353, 316, 3775, 3286, 487, 12572, 203, 7734, 563, 63, 2138, 300, 3138, 951, 22635, 397, 3138, 951, 1626, 65, 1011, 3844, 31, 203, 5411, 289, 203, 3639, 289, 203, 3639, 327, 563, 31, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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 326, 1509, 434, 326, 1241, 18, 1220, 707, 7372, 326, 4548, 559, 16145, 203, 377, 380, 203, 377, 380, 632, 891, 12884, 432, 987, 32, 8569, 751, 20401, 1517, 22964, 751, 4191, 279, 1509, 471, 326, 3844, 434, 3222, 364, 1245, 4124, 23372, 203, 377, 380, 632, 891, 563, 326, 526, 316, 1492, 326, 5970, 12884, 1410, 506, 9564, 203, 377, 380, 632, 891, 12572, 326, 12572, 434, 326, 563, 526, 203, 377, 380, 632, 2463, 392, 526, 16, 4191, 326, 924, 364, 1517, 4653, 316, 2 ]
e9691380fa07fc59e04740d9a14ff19157081551
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/service/ExerciseService.java
[ "MIT" ]
Java
populateCommonStatistics
StatsForDashboardDTO
public StatsForDashboardDTO populateCommonStatistics(Exercise exercise, boolean examMode) { final Long exerciseId = exercise.getId(); StatsForDashboardDTO stats = new StatsForDashboardDTO(); Course course = exercise.getCourseViaExerciseGroupOrCourseMember(); DueDateStat numberOfSubmissions; DueDateStat totalNumberOfAssessments; if (exercise instanceof ProgrammingExercise) { numberOfSubmissions = new DueDateStat(programmingExerciseRepository.countLegalSubmissionsByExerciseIdSubmitted(exerciseId, examMode), 0L); totalNumberOfAssessments = new DueDateStat(programmingExerciseRepository.countAssessmentsByExerciseIdSubmitted(exerciseId, examMode), 0L); } else { numberOfSubmissions = submissionRepository.countSubmissionsForExercise(exerciseId, examMode); totalNumberOfAssessments = resultRepository.countNumberOfFinishedAssessmentsForExercise(exerciseId, examMode); } stats.setNumberOfSubmissions(numberOfSubmissions); stats.setTotalNumberOfAssessments(totalNumberOfAssessments); final DueDateStat[] numberOfAssessmentsOfCorrectionRounds; int numberOfCorrectionRounds = 1; if (examMode) { // set number of corrections specific to each correction round numberOfCorrectionRounds = exercise.getExerciseGroup().getExam().getNumberOfCorrectionRoundsInExam(); numberOfAssessmentsOfCorrectionRounds = resultRepository.countNumberOfFinishedAssessmentsForExamExerciseForCorrectionRounds(exercise, numberOfCorrectionRounds); } else { // no examMode here, so correction rounds defaults to 1 and is the same as totalNumberOfAssessments numberOfAssessmentsOfCorrectionRounds = new DueDateStat[] { totalNumberOfAssessments }; } stats.setNumberOfAssessmentsOfCorrectionRounds(numberOfAssessmentsOfCorrectionRounds); final DueDateStat[] numberOfLockedAssessmentByOtherTutorsOfCorrectionRound; numberOfLockedAssessmentByOtherTutorsOfCorrectionRound = resultRepository.countNumberOfLockedAssessmentsByOtherTutorsForExamExerciseForCorrectionRounds(exercise, numberOfCorrectionRounds, userRepository.getUserWithGroupsAndAuthorities()); stats.setNumberOfLockedAssessmentByOtherTutorsOfCorrectionRound(numberOfLockedAssessmentByOtherTutorsOfCorrectionRound); final DueDateStat numberOfAutomaticAssistedAssessments = resultRepository.countNumberOfAutomaticAssistedAssessmentsForExercise(exerciseId); stats.setNumberOfAutomaticAssistedAssessments(numberOfAutomaticAssistedAssessments); final long numberOfMoreFeedbackRequests = complaintRepository.countComplaintsByExerciseIdAndComplaintType(exerciseId, ComplaintType.MORE_FEEDBACK); stats.setNumberOfMoreFeedbackRequests(numberOfMoreFeedbackRequests); long numberOfComplaints; if (examMode) { numberOfComplaints = complaintRepository.countByResultParticipationExerciseIdAndComplaintTypeIgnoreTestRuns(exerciseId, ComplaintType.COMPLAINT); } else { numberOfComplaints = complaintRepository.countComplaintsByExerciseIdAndComplaintType(exerciseId, ComplaintType.COMPLAINT); } stats.setNumberOfComplaints(numberOfComplaints); long numberOfComplaintResponses = complaintResponseRepository.countComplaintResponseByExerciseIdAndComplaintTypeAndSubmittedTimeIsNotNull(exerciseId, ComplaintType.COMPLAINT); stats.setNumberOfOpenComplaints(numberOfComplaints - numberOfComplaintResponses); long numberOfMoreFeedbackComplaintResponses = complaintResponseRepository.countComplaintResponseByExerciseIdAndComplaintTypeAndSubmittedTimeIsNotNull(exerciseId, ComplaintType.MORE_FEEDBACK); stats.setNumberOfOpenMoreFeedbackRequests(numberOfMoreFeedbackRequests - numberOfMoreFeedbackComplaintResponses); List<TutorLeaderboardDTO> leaderboardEntries = tutorLeaderboardService.getExerciseLeaderboard(exercise); stats.setTutorLeaderboardEntries(leaderboardEntries); final long totalNumberOfAssessmentLocks = submissionRepository.countLockedSubmissionsByExerciseId(exerciseId); stats.setTotalNumberOfAssessmentLocks(totalNumberOfAssessmentLocks); stats.setFeedbackRequestEnabled(course.getComplaintsEnabled()); stats.setFeedbackRequestEnabled(course.getRequestMoreFeedbackEnabled()); return stats; }
/** * Given an exercise exerciseId, it creates an object node with numberOfSubmissions, totalNumberOfAssessments, numberOfComplaints and numberOfMoreFeedbackRequests, that are used by both * stats for assessment dashboard and for instructor dashboard * TODO: refactor and improve this method * * @param exercise - the exercise we are interested in * @param examMode - flag to determine if test run submissions should be deducted from the statistics * @return a object node with the stats */
Given an exercise exerciseId, it creates an object node with numberOfSubmissions, totalNumberOfAssessments, numberOfComplaints and numberOfMoreFeedbackRequests, that are used by both stats for assessment dashboard and for instructor dashboard TODO: refactor and improve this method @param exercise - the exercise we are interested in @param examMode - flag to determine if test run submissions should be deducted from the statistics @return a object node with the stats
[ "Given", "an", "exercise", "exerciseId", "it", "creates", "an", "object", "node", "with", "numberOfSubmissions", "totalNumberOfAssessments", "numberOfComplaints", "and", "numberOfMoreFeedbackRequests", "that", "are", "used", "by", "both", "stats", "for", "assessment", "dashboard", "and", "for", "instructor", "dashboard", "TODO", ":", "refactor", "and", "improve", "this", "method", "@param", "exercise", "-", "the", "exercise", "we", "are", "interested", "in", "@param", "examMode", "-", "flag", "to", "determine", "if", "test", "run", "submissions", "should", "be", "deducted", "from", "the", "statistics", "@return", "a", "object", "node", "with", "the", "stats" ]
public StatsForDashboardDTO populateCommonStatistics(Exercise exercise, boolean examMode) { final Long exerciseId = exercise.getId(); StatsForDashboardDTO stats = new StatsForDashboardDTO(); Course course = exercise.getCourseViaExerciseGroupOrCourseMember(); DueDateStat numberOfSubmissions; DueDateStat totalNumberOfAssessments; if (exercise instanceof ProgrammingExercise) { numberOfSubmissions = new DueDateStat(programmingExerciseRepository.countLegalSubmissionsByExerciseIdSubmitted(exerciseId, examMode), 0L); totalNumberOfAssessments = new DueDateStat(programmingExerciseRepository.countAssessmentsByExerciseIdSubmitted(exerciseId, examMode), 0L); } else { numberOfSubmissions = submissionRepository.countSubmissionsForExercise(exerciseId, examMode); totalNumberOfAssessments = resultRepository.countNumberOfFinishedAssessmentsForExercise(exerciseId, examMode); } stats.setNumberOfSubmissions(numberOfSubmissions); stats.setTotalNumberOfAssessments(totalNumberOfAssessments); final DueDateStat[] numberOfAssessmentsOfCorrectionRounds; int numberOfCorrectionRounds = 1; if (examMode) { numberOfCorrectionRounds = exercise.getExerciseGroup().getExam().getNumberOfCorrectionRoundsInExam(); numberOfAssessmentsOfCorrectionRounds = resultRepository.countNumberOfFinishedAssessmentsForExamExerciseForCorrectionRounds(exercise, numberOfCorrectionRounds); } else { numberOfAssessmentsOfCorrectionRounds = new DueDateStat[] { totalNumberOfAssessments }; } stats.setNumberOfAssessmentsOfCorrectionRounds(numberOfAssessmentsOfCorrectionRounds); final DueDateStat[] numberOfLockedAssessmentByOtherTutorsOfCorrectionRound; numberOfLockedAssessmentByOtherTutorsOfCorrectionRound = resultRepository.countNumberOfLockedAssessmentsByOtherTutorsForExamExerciseForCorrectionRounds(exercise, numberOfCorrectionRounds, userRepository.getUserWithGroupsAndAuthorities()); stats.setNumberOfLockedAssessmentByOtherTutorsOfCorrectionRound(numberOfLockedAssessmentByOtherTutorsOfCorrectionRound); final DueDateStat numberOfAutomaticAssistedAssessments = resultRepository.countNumberOfAutomaticAssistedAssessmentsForExercise(exerciseId); stats.setNumberOfAutomaticAssistedAssessments(numberOfAutomaticAssistedAssessments); final long numberOfMoreFeedbackRequests = complaintRepository.countComplaintsByExerciseIdAndComplaintType(exerciseId, ComplaintType.MORE_FEEDBACK); stats.setNumberOfMoreFeedbackRequests(numberOfMoreFeedbackRequests); long numberOfComplaints; if (examMode) { numberOfComplaints = complaintRepository.countByResultParticipationExerciseIdAndComplaintTypeIgnoreTestRuns(exerciseId, ComplaintType.COMPLAINT); } else { numberOfComplaints = complaintRepository.countComplaintsByExerciseIdAndComplaintType(exerciseId, ComplaintType.COMPLAINT); } stats.setNumberOfComplaints(numberOfComplaints); long numberOfComplaintResponses = complaintResponseRepository.countComplaintResponseByExerciseIdAndComplaintTypeAndSubmittedTimeIsNotNull(exerciseId, ComplaintType.COMPLAINT); stats.setNumberOfOpenComplaints(numberOfComplaints - numberOfComplaintResponses); long numberOfMoreFeedbackComplaintResponses = complaintResponseRepository.countComplaintResponseByExerciseIdAndComplaintTypeAndSubmittedTimeIsNotNull(exerciseId, ComplaintType.MORE_FEEDBACK); stats.setNumberOfOpenMoreFeedbackRequests(numberOfMoreFeedbackRequests - numberOfMoreFeedbackComplaintResponses); List<TutorLeaderboardDTO> leaderboardEntries = tutorLeaderboardService.getExerciseLeaderboard(exercise); stats.setTutorLeaderboardEntries(leaderboardEntries); final long totalNumberOfAssessmentLocks = submissionRepository.countLockedSubmissionsByExerciseId(exerciseId); stats.setTotalNumberOfAssessmentLocks(totalNumberOfAssessmentLocks); stats.setFeedbackRequestEnabled(course.getComplaintsEnabled()); stats.setFeedbackRequestEnabled(course.getRequestMoreFeedbackEnabled()); return stats; }
[ "public", "StatsForDashboardDTO", "populateCommonStatistics", "(", "Exercise", "exercise", ",", "boolean", "examMode", ")", "{", "final", "Long", "exerciseId", "=", "exercise", ".", "getId", "(", ")", ";", "StatsForDashboardDTO", "stats", "=", "new", "StatsForDashboardDTO", "(", ")", ";", "Course", "course", "=", "exercise", ".", "getCourseViaExerciseGroupOrCourseMember", "(", ")", ";", "DueDateStat", "numberOfSubmissions", ";", "DueDateStat", "totalNumberOfAssessments", ";", "if", "(", "exercise", "instanceof", "ProgrammingExercise", ")", "{", "numberOfSubmissions", "=", "new", "DueDateStat", "(", "programmingExerciseRepository", ".", "countLegalSubmissionsByExerciseIdSubmitted", "(", "exerciseId", ",", "examMode", ")", ",", "0L", ")", ";", "totalNumberOfAssessments", "=", "new", "DueDateStat", "(", "programmingExerciseRepository", ".", "countAssessmentsByExerciseIdSubmitted", "(", "exerciseId", ",", "examMode", ")", ",", "0L", ")", ";", "}", "else", "{", "numberOfSubmissions", "=", "submissionRepository", ".", "countSubmissionsForExercise", "(", "exerciseId", ",", "examMode", ")", ";", "totalNumberOfAssessments", "=", "resultRepository", ".", "countNumberOfFinishedAssessmentsForExercise", "(", "exerciseId", ",", "examMode", ")", ";", "}", "stats", ".", "setNumberOfSubmissions", "(", "numberOfSubmissions", ")", ";", "stats", ".", "setTotalNumberOfAssessments", "(", "totalNumberOfAssessments", ")", ";", "final", "DueDateStat", "[", "]", "numberOfAssessmentsOfCorrectionRounds", ";", "int", "numberOfCorrectionRounds", "=", "1", ";", "if", "(", "examMode", ")", "{", "numberOfCorrectionRounds", "=", "exercise", ".", "getExerciseGroup", "(", ")", ".", "getExam", "(", ")", ".", "getNumberOfCorrectionRoundsInExam", "(", ")", ";", "numberOfAssessmentsOfCorrectionRounds", "=", "resultRepository", ".", "countNumberOfFinishedAssessmentsForExamExerciseForCorrectionRounds", "(", "exercise", ",", "numberOfCorrectionRounds", ")", ";", "}", "else", "{", "numberOfAssessmentsOfCorrectionRounds", "=", "new", "DueDateStat", "[", "]", "{", "totalNumberOfAssessments", "}", ";", "}", "stats", ".", "setNumberOfAssessmentsOfCorrectionRounds", "(", "numberOfAssessmentsOfCorrectionRounds", ")", ";", "final", "DueDateStat", "[", "]", "numberOfLockedAssessmentByOtherTutorsOfCorrectionRound", ";", "numberOfLockedAssessmentByOtherTutorsOfCorrectionRound", "=", "resultRepository", ".", "countNumberOfLockedAssessmentsByOtherTutorsForExamExerciseForCorrectionRounds", "(", "exercise", ",", "numberOfCorrectionRounds", ",", "userRepository", ".", "getUserWithGroupsAndAuthorities", "(", ")", ")", ";", "stats", ".", "setNumberOfLockedAssessmentByOtherTutorsOfCorrectionRound", "(", "numberOfLockedAssessmentByOtherTutorsOfCorrectionRound", ")", ";", "final", "DueDateStat", "numberOfAutomaticAssistedAssessments", "=", "resultRepository", ".", "countNumberOfAutomaticAssistedAssessmentsForExercise", "(", "exerciseId", ")", ";", "stats", ".", "setNumberOfAutomaticAssistedAssessments", "(", "numberOfAutomaticAssistedAssessments", ")", ";", "final", "long", "numberOfMoreFeedbackRequests", "=", "complaintRepository", ".", "countComplaintsByExerciseIdAndComplaintType", "(", "exerciseId", ",", "ComplaintType", ".", "MORE_FEEDBACK", ")", ";", "stats", ".", "setNumberOfMoreFeedbackRequests", "(", "numberOfMoreFeedbackRequests", ")", ";", "long", "numberOfComplaints", ";", "if", "(", "examMode", ")", "{", "numberOfComplaints", "=", "complaintRepository", ".", "countByResultParticipationExerciseIdAndComplaintTypeIgnoreTestRuns", "(", "exerciseId", ",", "ComplaintType", ".", "COMPLAINT", ")", ";", "}", "else", "{", "numberOfComplaints", "=", "complaintRepository", ".", "countComplaintsByExerciseIdAndComplaintType", "(", "exerciseId", ",", "ComplaintType", ".", "COMPLAINT", ")", ";", "}", "stats", ".", "setNumberOfComplaints", "(", "numberOfComplaints", ")", ";", "long", "numberOfComplaintResponses", "=", "complaintResponseRepository", ".", "countComplaintResponseByExerciseIdAndComplaintTypeAndSubmittedTimeIsNotNull", "(", "exerciseId", ",", "ComplaintType", ".", "COMPLAINT", ")", ";", "stats", ".", "setNumberOfOpenComplaints", "(", "numberOfComplaints", "-", "numberOfComplaintResponses", ")", ";", "long", "numberOfMoreFeedbackComplaintResponses", "=", "complaintResponseRepository", ".", "countComplaintResponseByExerciseIdAndComplaintTypeAndSubmittedTimeIsNotNull", "(", "exerciseId", ",", "ComplaintType", ".", "MORE_FEEDBACK", ")", ";", "stats", ".", "setNumberOfOpenMoreFeedbackRequests", "(", "numberOfMoreFeedbackRequests", "-", "numberOfMoreFeedbackComplaintResponses", ")", ";", "List", "<", "TutorLeaderboardDTO", ">", "leaderboardEntries", "=", "tutorLeaderboardService", ".", "getExerciseLeaderboard", "(", "exercise", ")", ";", "stats", ".", "setTutorLeaderboardEntries", "(", "leaderboardEntries", ")", ";", "final", "long", "totalNumberOfAssessmentLocks", "=", "submissionRepository", ".", "countLockedSubmissionsByExerciseId", "(", "exerciseId", ")", ";", "stats", ".", "setTotalNumberOfAssessmentLocks", "(", "totalNumberOfAssessmentLocks", ")", ";", "stats", ".", "setFeedbackRequestEnabled", "(", "course", ".", "getComplaintsEnabled", "(", ")", ")", ";", "stats", ".", "setFeedbackRequestEnabled", "(", "course", ".", "getRequestMoreFeedbackEnabled", "(", ")", ")", ";", "return", "stats", ";", "}" ]
Given an exercise exerciseId, it creates an object node with numberOfSubmissions, totalNumberOfAssessments, numberOfComplaints and numberOfMoreFeedbackRequests, that are used by both stats for assessment dashboard and for instructor dashboard TODO: refactor and improve this method
[ "Given", "an", "exercise", "exerciseId", "it", "creates", "an", "object", "node", "with", "numberOfSubmissions", "totalNumberOfAssessments", "numberOfComplaints", "and", "numberOfMoreFeedbackRequests", "that", "are", "used", "by", "both", "stats", "for", "assessment", "dashboard", "and", "for", "instructor", "dashboard", "TODO", ":", "refactor", "and", "improve", "this", "method" ]
[ "// set number of corrections specific to each correction round", "// no examMode here, so correction rounds defaults to 1 and is the same as totalNumberOfAssessments" ]
[ { "param": "exercise", "type": "Exercise" }, { "param": "examMode", "type": "boolean" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "exercise", "type": "Exercise", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "examMode", "type": "boolean", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 11486, 1290, 14830, 19792, 6490, 6517, 8569, 12, 424, 20603, 24165, 16, 1250, 19707, 2309, 13, 288, 203, 3639, 727, 3407, 24165, 548, 273, 24165, 18, 26321, 5621, 203, 3639, 11486, 1290, 14830, 19792, 3177, 273, 394, 11486, 1290, 14830, 19792, 5621, 203, 203, 3639, 385, 3117, 4362, 273, 24165, 18, 588, 39, 3117, 21246, 424, 20603, 1114, 1162, 39, 3117, 4419, 5621, 203, 203, 3639, 463, 344, 1626, 5000, 7922, 1676, 7300, 31, 203, 3639, 463, 344, 1626, 5000, 2078, 9226, 2610, 403, 1346, 31, 203, 203, 3639, 309, 261, 8913, 30708, 1276, 13586, 11987, 424, 20603, 13, 288, 203, 5411, 7922, 1676, 7300, 273, 394, 463, 344, 1626, 5000, 12, 12890, 11987, 424, 20603, 3305, 18, 1883, 30697, 1676, 7300, 858, 424, 20603, 548, 28882, 12, 8913, 30708, 548, 16, 19707, 2309, 3631, 374, 48, 1769, 203, 5411, 2078, 9226, 2610, 403, 1346, 273, 394, 463, 344, 1626, 5000, 12, 12890, 11987, 424, 20603, 3305, 18, 1883, 2610, 403, 1346, 858, 424, 20603, 548, 28882, 12, 8913, 30708, 548, 16, 19707, 2309, 3631, 374, 48, 1769, 203, 3639, 289, 203, 3639, 469, 288, 203, 5411, 7922, 1676, 7300, 273, 8515, 3305, 18, 1883, 1676, 7300, 1290, 424, 20603, 12, 8913, 30708, 548, 16, 19707, 2309, 1769, 203, 5411, 2078, 9226, 2610, 403, 1346, 273, 563, 3305, 18, 1883, 9226, 10577, 2610, 403, 1346, 1290, 424, 20603, 12, 8913, 30708, 548, 16, 19707, 2309, 1769, 203, 3639, 289, 203, 203, 3639, 3177, 18, 542, 9226, 1676, 7300, 12, 2696, 951, 1676, 7300, 1769, 203, 3639, 3177, 18, 542, 5269, 9226, 2610, 403, 1346, 12, 4963, 9226, 2610, 403, 1346, 1769, 203, 203, 3639, 727, 463, 344, 1626, 5000, 8526, 7922, 2610, 403, 1346, 951, 20884, 54, 9284, 31, 203, 3639, 509, 7922, 20884, 54, 9284, 273, 404, 31, 203, 3639, 309, 261, 338, 301, 2309, 13, 288, 203, 5411, 368, 444, 1300, 434, 15104, 87, 2923, 358, 1517, 15104, 3643, 203, 5411, 7922, 20884, 54, 9284, 273, 24165, 18, 588, 424, 20603, 1114, 7675, 588, 424, 301, 7675, 588, 9226, 20884, 54, 9284, 382, 424, 301, 5621, 203, 5411, 7922, 2610, 403, 1346, 951, 20884, 54, 9284, 273, 563, 3305, 18, 1883, 9226, 10577, 2610, 403, 1346, 1290, 424, 301, 424, 20603, 1290, 20884, 54, 9284, 12, 8913, 30708, 16, 7922, 20884, 54, 9284, 1769, 203, 3639, 289, 203, 3639, 469, 288, 203, 5411, 368, 1158, 19707, 2309, 2674, 16, 1427, 15104, 21196, 3467, 358, 404, 471, 353, 326, 1967, 487, 2078, 9226, 2610, 403, 1346, 203, 5411, 7922, 2610, 403, 1346, 951, 20884, 54, 9284, 273, 394, 463, 344, 1626, 5000, 8526, 288, 2078, 9226, 2610, 403, 1346, 289, 31, 203, 3639, 289, 203, 203, 3639, 3177, 18, 542, 9226, 2610, 403, 1346, 951, 20884, 54, 9284, 12, 2696, 951, 2610, 403, 1346, 951, 20884, 54, 9284, 1769, 203, 203, 3639, 727, 463, 344, 1626, 5000, 8526, 7922, 8966, 15209, 858, 8290, 56, 13595, 951, 20884, 11066, 31, 203, 3639, 7922, 8966, 15209, 858, 8290, 56, 13595, 951, 20884, 11066, 273, 563, 3305, 2 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
[ 1, 26873, 203, 377, 380, 16803, 392, 24165, 24165, 548, 16, 518, 3414, 392, 733, 756, 598, 7922, 1676, 7300, 16, 2078, 9226, 2610, 403, 1346, 16, 7922, 799, 412, 1598, 87, 471, 7922, 7417, 15888, 6421, 16, 716, 854, 1399, 635, 3937, 203, 377, 380, 3177, 364, 14158, 11825, 471, 364, 316, 2732, 11825, 203, 377, 380, 2660, 30, 26627, 471, 21171, 333, 707, 203, 377, 380, 203, 377, 380, 632, 891, 24165, 300, 326, 24165, 732, 854, 20506, 316, 203, 377, 380, 632, 891, 19707, 2309, 300, 2982, 358, 4199, 309, 1842, 1086, 22071, 1410, 506, 11140, 853, 329, 628, 326, 7691, 203, 377, 380, 632, 2463, 279, 733, 756, 598, 326, 3177, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
e9691380fa07fc59e04740d9a14ff19157081551
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/service/ExerciseService.java
[ "MIT" ]
Java
delete
null
@Transactional // ok public void delete(long exerciseId, boolean deleteStudentReposBuildPlans, boolean deleteBaseReposBuildPlans) { // Delete has a transactional mechanism. Therefore, all lazy objects that are deleted below, should be fetched when needed. final var exercise = exerciseRepository.findByIdElseThrow(exerciseId); log.info("Checking if exercise is modeling exercise", exercise.getId()); if (exercise instanceof ModelingExercise) { log.info("Deleting clusters, elements and cancel scheduled operations", exercise.getId()); modelingExerciseService.deleteClustersAndElements((ModelingExercise) exercise); modelingExerciseService.cancelScheduledOperations(exerciseId); } participantScoreRepository.deleteAllByExerciseIdTransactional(exerciseId); // delete all exercise units linking to the exercise List<ExerciseUnit> exerciseUnits = this.exerciseUnitRepository.findByIdWithLearningGoalsBidirectional(exerciseId); for (ExerciseUnit exerciseUnit : exerciseUnits) { this.lectureUnitService.removeLectureUnit(exerciseUnit); } // delete all plagiarism results belonging to this exercise plagiarismResultRepository.deletePlagiarismResultsByExerciseId(exerciseId); // delete all participations belonging to this quiz participationService.deleteAllByExerciseId(exercise.getId(), deleteStudentReposBuildPlans, deleteStudentReposBuildPlans); // clean up the many to many relationship to avoid problems when deleting the entities but not the relationship table // to avoid a ConcurrentModificationException, we need to use a copy of the set var exampleSubmissions = new HashSet<>(exercise.getExampleSubmissions()); for (ExampleSubmission exampleSubmission : exampleSubmissions) { exampleSubmissionService.deleteById(exampleSubmission.getId()); } // make sure tutor participations are deleted before the exercise is deleted tutorParticipationRepository.deleteAllByAssessedExerciseId(exercise.getId()); if (exercise.isExamExercise()) { Exam exam = examRepository.findOneWithEagerExercisesGroupsAndStudentExams(exercise.getExerciseGroup().getExam().getId()); for (StudentExam studentExam : exam.getStudentExams()) { if (studentExam.getExercises().contains(exercise)) { // remove exercise reference from student exam List<Exercise> exerciseList = studentExam.getExercises(); exerciseList.remove(exercise); studentExam.setExercises(exerciseList); studentExamRepository.save(studentExam); } } } // Programming exercises have some special stuff that needs to be cleaned up (solution/template participation, build plans, etc.). if (exercise instanceof ProgrammingExercise) { // TODO: delete all schedules related to this programming exercise programmingExerciseService.delete(exercise.getId(), deleteBaseReposBuildPlans); } else { exerciseRepository.delete(exercise); // delete text assessment knowledge if exercise is of type TextExercise and if no other exercise uses same knowledge if (exercise instanceof TextExercise) { textAssessmentKnowledgeService.deleteKnowledge(((TextExercise) exercise).getKnowledge().getId()); } // delete model assessment knowledge if exercise is of type ModelExercise and if no other exercise uses same knowledge else if (exercise instanceof ModelingExercise) { modelAssessmentKnowledgeService.deleteKnowledge(((ModelingExercise) exercise).getKnowledge().getId()); } } }
/** * Delete the exercise by id and all its participations. * * @param exerciseId the exercise to be deleted * @param deleteStudentReposBuildPlans whether the student repos and build plans should be deleted (can be true for programming exercises and should be false for all other exercise types) * @param deleteBaseReposBuildPlans whether the template and solution repos and build plans should be deleted (can be true for programming exercises and should be false for all other exercise types) */
Delete the exercise by id and all its participations. @param exerciseId the exercise to be deleted @param deleteStudentReposBuildPlans whether the student repos and build plans should be deleted (can be true for programming exercises and should be false for all other exercise types) @param deleteBaseReposBuildPlans whether the template and solution repos and build plans should be deleted (can be true for programming exercises and should be false for all other exercise types)
[ "Delete", "the", "exercise", "by", "id", "and", "all", "its", "participations", ".", "@param", "exerciseId", "the", "exercise", "to", "be", "deleted", "@param", "deleteStudentReposBuildPlans", "whether", "the", "student", "repos", "and", "build", "plans", "should", "be", "deleted", "(", "can", "be", "true", "for", "programming", "exercises", "and", "should", "be", "false", "for", "all", "other", "exercise", "types", ")", "@param", "deleteBaseReposBuildPlans", "whether", "the", "template", "and", "solution", "repos", "and", "build", "plans", "should", "be", "deleted", "(", "can", "be", "true", "for", "programming", "exercises", "and", "should", "be", "false", "for", "all", "other", "exercise", "types", ")" ]
@Transactional public void delete(long exerciseId, boolean deleteStudentReposBuildPlans, boolean deleteBaseReposBuildPlans) { final var exercise = exerciseRepository.findByIdElseThrow(exerciseId); log.info("Checking if exercise is modeling exercise", exercise.getId()); if (exercise instanceof ModelingExercise) { log.info("Deleting clusters, elements and cancel scheduled operations", exercise.getId()); modelingExerciseService.deleteClustersAndElements((ModelingExercise) exercise); modelingExerciseService.cancelScheduledOperations(exerciseId); } participantScoreRepository.deleteAllByExerciseIdTransactional(exerciseId); List<ExerciseUnit> exerciseUnits = this.exerciseUnitRepository.findByIdWithLearningGoalsBidirectional(exerciseId); for (ExerciseUnit exerciseUnit : exerciseUnits) { this.lectureUnitService.removeLectureUnit(exerciseUnit); } plagiarismResultRepository.deletePlagiarismResultsByExerciseId(exerciseId); participationService.deleteAllByExerciseId(exercise.getId(), deleteStudentReposBuildPlans, deleteStudentReposBuildPlans); var exampleSubmissions = new HashSet<>(exercise.getExampleSubmissions()); for (ExampleSubmission exampleSubmission : exampleSubmissions) { exampleSubmissionService.deleteById(exampleSubmission.getId()); } tutorParticipationRepository.deleteAllByAssessedExerciseId(exercise.getId()); if (exercise.isExamExercise()) { Exam exam = examRepository.findOneWithEagerExercisesGroupsAndStudentExams(exercise.getExerciseGroup().getExam().getId()); for (StudentExam studentExam : exam.getStudentExams()) { if (studentExam.getExercises().contains(exercise)) { List<Exercise> exerciseList = studentExam.getExercises(); exerciseList.remove(exercise); studentExam.setExercises(exerciseList); studentExamRepository.save(studentExam); } } } if (exercise instanceof ProgrammingExercise) { programmingExerciseService.delete(exercise.getId(), deleteBaseReposBuildPlans); } else { exerciseRepository.delete(exercise); if (exercise instanceof TextExercise) { textAssessmentKnowledgeService.deleteKnowledge(((TextExercise) exercise).getKnowledge().getId()); } else if (exercise instanceof ModelingExercise) { modelAssessmentKnowledgeService.deleteKnowledge(((ModelingExercise) exercise).getKnowledge().getId()); } } }
[ "@", "Transactional", "public", "void", "delete", "(", "long", "exerciseId", ",", "boolean", "deleteStudentReposBuildPlans", ",", "boolean", "deleteBaseReposBuildPlans", ")", "{", "final", "var", "exercise", "=", "exerciseRepository", ".", "findByIdElseThrow", "(", "exerciseId", ")", ";", "log", ".", "info", "(", "\"Checking if exercise is modeling exercise\"", ",", "exercise", ".", "getId", "(", ")", ")", ";", "if", "(", "exercise", "instanceof", "ModelingExercise", ")", "{", "log", ".", "info", "(", "\"Deleting clusters, elements and cancel scheduled operations\"", ",", "exercise", ".", "getId", "(", ")", ")", ";", "modelingExerciseService", ".", "deleteClustersAndElements", "(", "(", "ModelingExercise", ")", "exercise", ")", ";", "modelingExerciseService", ".", "cancelScheduledOperations", "(", "exerciseId", ")", ";", "}", "participantScoreRepository", ".", "deleteAllByExerciseIdTransactional", "(", "exerciseId", ")", ";", "List", "<", "ExerciseUnit", ">", "exerciseUnits", "=", "this", ".", "exerciseUnitRepository", ".", "findByIdWithLearningGoalsBidirectional", "(", "exerciseId", ")", ";", "for", "(", "ExerciseUnit", "exerciseUnit", ":", "exerciseUnits", ")", "{", "this", ".", "lectureUnitService", ".", "removeLectureUnit", "(", "exerciseUnit", ")", ";", "}", "plagiarismResultRepository", ".", "deletePlagiarismResultsByExerciseId", "(", "exerciseId", ")", ";", "participationService", ".", "deleteAllByExerciseId", "(", "exercise", ".", "getId", "(", ")", ",", "deleteStudentReposBuildPlans", ",", "deleteStudentReposBuildPlans", ")", ";", "var", "exampleSubmissions", "=", "new", "HashSet", "<", ">", "(", "exercise", ".", "getExampleSubmissions", "(", ")", ")", ";", "for", "(", "ExampleSubmission", "exampleSubmission", ":", "exampleSubmissions", ")", "{", "exampleSubmissionService", ".", "deleteById", "(", "exampleSubmission", ".", "getId", "(", ")", ")", ";", "}", "tutorParticipationRepository", ".", "deleteAllByAssessedExerciseId", "(", "exercise", ".", "getId", "(", ")", ")", ";", "if", "(", "exercise", ".", "isExamExercise", "(", ")", ")", "{", "Exam", "exam", "=", "examRepository", ".", "findOneWithEagerExercisesGroupsAndStudentExams", "(", "exercise", ".", "getExerciseGroup", "(", ")", ".", "getExam", "(", ")", ".", "getId", "(", ")", ")", ";", "for", "(", "StudentExam", "studentExam", ":", "exam", ".", "getStudentExams", "(", ")", ")", "{", "if", "(", "studentExam", ".", "getExercises", "(", ")", ".", "contains", "(", "exercise", ")", ")", "{", "List", "<", "Exercise", ">", "exerciseList", "=", "studentExam", ".", "getExercises", "(", ")", ";", "exerciseList", ".", "remove", "(", "exercise", ")", ";", "studentExam", ".", "setExercises", "(", "exerciseList", ")", ";", "studentExamRepository", ".", "save", "(", "studentExam", ")", ";", "}", "}", "}", "if", "(", "exercise", "instanceof", "ProgrammingExercise", ")", "{", "programmingExerciseService", ".", "delete", "(", "exercise", ".", "getId", "(", ")", ",", "deleteBaseReposBuildPlans", ")", ";", "}", "else", "{", "exerciseRepository", ".", "delete", "(", "exercise", ")", ";", "if", "(", "exercise", "instanceof", "TextExercise", ")", "{", "textAssessmentKnowledgeService", ".", "deleteKnowledge", "(", "(", "(", "TextExercise", ")", "exercise", ")", ".", "getKnowledge", "(", ")", ".", "getId", "(", ")", ")", ";", "}", "else", "if", "(", "exercise", "instanceof", "ModelingExercise", ")", "{", "modelAssessmentKnowledgeService", ".", "deleteKnowledge", "(", "(", "(", "ModelingExercise", ")", "exercise", ")", ".", "getKnowledge", "(", ")", ".", "getId", "(", ")", ")", ";", "}", "}", "}" ]
Delete the exercise by id and all its participations.
[ "Delete", "the", "exercise", "by", "id", "and", "all", "its", "participations", "." ]
[ "// ok", "// Delete has a transactional mechanism. Therefore, all lazy objects that are deleted below, should be fetched when needed.", "// delete all exercise units linking to the exercise", "// delete all plagiarism results belonging to this exercise", "// delete all participations belonging to this quiz", "// clean up the many to many relationship to avoid problems when deleting the entities but not the relationship table", "// to avoid a ConcurrentModificationException, we need to use a copy of the set", "// make sure tutor participations are deleted before the exercise is deleted", "// remove exercise reference from student exam", "// Programming exercises have some special stuff that needs to be cleaned up (solution/template participation, build plans, etc.).", "// TODO: delete all schedules related to this programming exercise", "// delete text assessment knowledge if exercise is of type TextExercise and if no other exercise uses same knowledge", "// delete model assessment knowledge if exercise is of type ModelExercise and if no other exercise uses same knowledge" ]
[ { "param": "exerciseId", "type": "long" }, { "param": "deleteStudentReposBuildPlans", "type": "boolean" }, { "param": "deleteBaseReposBuildPlans", "type": "boolean" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "exerciseId", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "deleteStudentReposBuildPlans", "type": "boolean", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "deleteBaseReposBuildPlans", "type": "boolean", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 3342, 287, 368, 1529, 203, 565, 1071, 918, 1430, 12, 5748, 24165, 548, 16, 1250, 1430, 19943, 319, 28453, 3116, 22846, 16, 1250, 1430, 2171, 28453, 3116, 22846, 13, 288, 203, 3639, 368, 2504, 711, 279, 25078, 12860, 18, 17189, 16, 777, 7962, 2184, 716, 854, 4282, 5712, 16, 1410, 506, 12807, 1347, 3577, 18, 203, 3639, 727, 569, 24165, 273, 24165, 3305, 18, 4720, 5132, 12427, 8282, 12, 8913, 30708, 548, 1769, 203, 203, 3639, 613, 18, 1376, 2932, 14294, 309, 24165, 353, 938, 310, 24165, 3113, 24165, 18, 26321, 10663, 203, 3639, 309, 261, 8913, 30708, 1276, 3164, 310, 424, 20603, 13, 288, 203, 5411, 613, 18, 1376, 2932, 20433, 9566, 16, 2186, 471, 3755, 9755, 5295, 3113, 24165, 18, 26321, 10663, 203, 203, 5411, 938, 310, 424, 20603, 1179, 18, 3733, 13698, 1876, 3471, 12443, 1488, 310, 424, 20603, 13, 24165, 1769, 203, 5411, 938, 310, 424, 20603, 1179, 18, 10996, 10660, 9343, 12, 8913, 30708, 548, 1769, 203, 3639, 289, 203, 203, 3639, 14188, 7295, 3305, 18, 3733, 1595, 858, 424, 20603, 548, 3342, 287, 12, 8913, 30708, 548, 1769, 203, 3639, 368, 1430, 777, 24165, 4971, 27651, 358, 326, 24165, 203, 3639, 987, 32, 424, 20603, 2802, 34, 24165, 7537, 273, 333, 18, 8913, 30708, 2802, 3305, 18, 4720, 5132, 1190, 27548, 5741, 1031, 17763, 24699, 12, 8913, 30708, 548, 1769, 203, 3639, 364, 261, 424, 20603, 2802, 24165, 2802, 294, 24165, 7537, 13, 288, 203, 5411, 333, 18, 1582, 594, 2802, 1179, 18, 4479, 48, 386, 594, 2802, 12, 8913, 30708, 2802, 1769, 203, 3639, 289, 203, 203, 3639, 368, 1430, 777, 886, 346, 77, 297, 6228, 1686, 17622, 358, 333, 24165, 203, 3639, 886, 346, 77, 297, 6228, 1253, 3305, 18, 3733, 1749, 346, 77, 297, 6228, 3447, 858, 424, 20603, 548, 12, 8913, 30708, 548, 1769, 203, 203, 3639, 368, 1430, 777, 30891, 1012, 17622, 358, 333, 16479, 203, 3639, 30891, 367, 1179, 18, 3733, 1595, 858, 424, 20603, 548, 12, 8913, 30708, 18, 26321, 9334, 1430, 19943, 319, 28453, 3116, 22846, 16, 1430, 19943, 319, 28453, 3116, 22846, 1769, 203, 3639, 368, 2721, 731, 326, 4906, 358, 4906, 5232, 358, 4543, 9688, 1347, 12993, 326, 5140, 1496, 486, 326, 5232, 1014, 203, 3639, 368, 358, 4543, 279, 15242, 13467, 503, 16, 732, 1608, 358, 999, 279, 1610, 434, 326, 444, 203, 3639, 569, 3454, 1676, 7300, 273, 394, 6847, 29667, 12, 8913, 30708, 18, 588, 10908, 1676, 7300, 10663, 203, 3639, 364, 261, 10908, 17865, 3454, 17865, 294, 3454, 1676, 7300, 13, 288, 203, 5411, 3454, 17865, 1179, 18, 3733, 5132, 12, 8236, 17865, 18, 26321, 10663, 203, 3639, 289, 203, 3639, 368, 1221, 3071, 268, 3408, 30891, 1012, 854, 4282, 1865, 326, 24165, 353, 4282, 203, 3639, 268, 3408, 1988, 24629, 367, 3305, 18, 3733, 1595, 858, 2610, 281, 730, 424, 20603, 548, 12, 8913, 30708, 18, 26321, 10663, 203, 203, 3639, 309, 261, 8913, 30708, 18, 291, 424, 301, 424, 20603, 10756, 288, 203, 5411, 1312, 301, 19707, 273, 19707, 3305, 18, 4720, 3335, 2 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
[ 1, 26873, 203, 377, 380, 2504, 326, 24165, 635, 612, 471, 777, 2097, 30891, 1012, 18, 203, 377, 380, 203, 377, 380, 632, 891, 24165, 548, 10402, 326, 24165, 358, 506, 4282, 203, 377, 380, 632, 891, 1430, 19943, 319, 28453, 3116, 22846, 2856, 326, 18110, 13686, 471, 1361, 21440, 1410, 506, 4282, 261, 4169, 506, 638, 364, 5402, 11987, 431, 12610, 6141, 471, 1410, 506, 629, 364, 777, 1308, 24165, 1953, 13, 203, 377, 380, 632, 891, 1430, 2171, 28453, 3116, 22846, 565, 2856, 326, 1542, 471, 6959, 13686, 471, 1361, 21440, 1410, 506, 4282, 261, 4169, 506, 638, 364, 5402, 11987, 431, 12610, 6141, 471, 1410, 506, 629, 364, 777, 1308, 24165, 1953, 13, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100 ]
e9691380fa07fc59e04740d9a14ff19157081551
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/service/ExerciseService.java
[ "MIT" ]
Java
reEvaluateExercise
null
public void reEvaluateExercise(Exercise exercise, boolean deleteFeedbackAfterGradingInstructionUpdate) { List<GradingCriterion> gradingCriteria = exercise.getGradingCriteria(); // retrieve the feedback associated with the structured grading instructions List<Feedback> feedbackToBeUpdated = feedbackRepository.findFeedbackByExerciseGradingCriteria(gradingCriteria); // collect all structured grading instructions into the list List<GradingInstruction> gradingInstructions = gradingCriteria.stream().flatMap(gradingCriterion -> gradingCriterion.getStructuredGradingInstructions().stream()).toList(); // update the related fields for feedback for (GradingInstruction instruction : gradingInstructions) { for (Feedback feedback : feedbackToBeUpdated) { if (feedback.getGradingInstruction().getId().equals(instruction.getId())) { feedback.setCredits(instruction.getCredits()); feedback.setPositive(feedback.getCredits() >= 0); feedback.setDetailText(instruction.getFeedback()); } } } feedbackRepository.saveAll(feedbackToBeUpdated); List<Feedback> feedbackToBeDeleted = getFeedbackToBeDeletedAfterGradingInstructionUpdate(deleteFeedbackAfterGradingInstructionUpdate, gradingInstructions, exercise); List<Result> results = resultRepository.findWithEagerSubmissionAndFeedbackByParticipationExerciseId(exercise.getId()); // add example submission results that belong exercise if (!exercise.getExampleSubmissions().isEmpty()) { results.addAll(resultRepository.getResultForExampleSubmissions(exercise.getExampleSubmissions())); } // re-calculate the results after updating the feedback for (Result result : results) { if (!feedbackToBeDeleted.isEmpty()) { List<Feedback> existingFeedback = result.getFeedbacks(); if (!existingFeedback.isEmpty()) { existingFeedback.removeAll(feedbackToBeDeleted); } // first save the feedback (that is not yet in the database) to prevent null index exception List<Feedback> savedFeedback = feedbackRepository.saveFeedbacks(existingFeedback); result.updateAllFeedbackItems(savedFeedback, exercise instanceof ProgrammingExercise); } if (!(exercise instanceof ProgrammingExercise)) { resultRepository.submitResult(result, exercise); } else { double totalScore = programmingAssessmentService.calculateTotalScore(result); result.setScore(totalScore, exercise.getMaxPoints()); /* * Result string has following structure e.g: "1 of 13 passed, 2 issues, 10 of 100 points" The last part of the result string has to be updated, as the points the * student has achieved have changed */ String[] resultStringParts = result.getResultString().split(", "); resultStringParts[resultStringParts.length - 1] = result.createResultString(totalScore, exercise.getMaxPoints()); result.setResultString(String.join(", ", resultStringParts)); resultRepository.save(result); } } }
/** * Re-evaluates the exercise before saving * 1. The feedback associated with the exercise grading instruction needs to be updated * 2. After updating feedback, result needs to be re-calculated * * @param exercise exercise to re-evaluate * @param deleteFeedbackAfterGradingInstructionUpdate boolean flag that indicates whether the associated feedback should be deleted or not * */
Re-evaluates the exercise before saving 1. The feedback associated with the exercise grading instruction needs to be updated 2. After updating feedback, result needs to be re-calculated @param exercise exercise to re-evaluate @param deleteFeedbackAfterGradingInstructionUpdate boolean flag that indicates whether the associated feedback should be deleted or not
[ "Re", "-", "evaluates", "the", "exercise", "before", "saving", "1", ".", "The", "feedback", "associated", "with", "the", "exercise", "grading", "instruction", "needs", "to", "be", "updated", "2", ".", "After", "updating", "feedback", "result", "needs", "to", "be", "re", "-", "calculated", "@param", "exercise", "exercise", "to", "re", "-", "evaluate", "@param", "deleteFeedbackAfterGradingInstructionUpdate", "boolean", "flag", "that", "indicates", "whether", "the", "associated", "feedback", "should", "be", "deleted", "or", "not" ]
public void reEvaluateExercise(Exercise exercise, boolean deleteFeedbackAfterGradingInstructionUpdate) { List<GradingCriterion> gradingCriteria = exercise.getGradingCriteria(); List<Feedback> feedbackToBeUpdated = feedbackRepository.findFeedbackByExerciseGradingCriteria(gradingCriteria); List<GradingInstruction> gradingInstructions = gradingCriteria.stream().flatMap(gradingCriterion -> gradingCriterion.getStructuredGradingInstructions().stream()).toList(); for (GradingInstruction instruction : gradingInstructions) { for (Feedback feedback : feedbackToBeUpdated) { if (feedback.getGradingInstruction().getId().equals(instruction.getId())) { feedback.setCredits(instruction.getCredits()); feedback.setPositive(feedback.getCredits() >= 0); feedback.setDetailText(instruction.getFeedback()); } } } feedbackRepository.saveAll(feedbackToBeUpdated); List<Feedback> feedbackToBeDeleted = getFeedbackToBeDeletedAfterGradingInstructionUpdate(deleteFeedbackAfterGradingInstructionUpdate, gradingInstructions, exercise); List<Result> results = resultRepository.findWithEagerSubmissionAndFeedbackByParticipationExerciseId(exercise.getId()); if (!exercise.getExampleSubmissions().isEmpty()) { results.addAll(resultRepository.getResultForExampleSubmissions(exercise.getExampleSubmissions())); } for (Result result : results) { if (!feedbackToBeDeleted.isEmpty()) { List<Feedback> existingFeedback = result.getFeedbacks(); if (!existingFeedback.isEmpty()) { existingFeedback.removeAll(feedbackToBeDeleted); } List<Feedback> savedFeedback = feedbackRepository.saveFeedbacks(existingFeedback); result.updateAllFeedbackItems(savedFeedback, exercise instanceof ProgrammingExercise); } if (!(exercise instanceof ProgrammingExercise)) { resultRepository.submitResult(result, exercise); } else { double totalScore = programmingAssessmentService.calculateTotalScore(result); result.setScore(totalScore, exercise.getMaxPoints()); /* * Result string has following structure e.g: "1 of 13 passed, 2 issues, 10 of 100 points" The last part of the result string has to be updated, as the points the * student has achieved have changed */ String[] resultStringParts = result.getResultString().split(", "); resultStringParts[resultStringParts.length - 1] = result.createResultString(totalScore, exercise.getMaxPoints()); result.setResultString(String.join(", ", resultStringParts)); resultRepository.save(result); } } }
[ "public", "void", "reEvaluateExercise", "(", "Exercise", "exercise", ",", "boolean", "deleteFeedbackAfterGradingInstructionUpdate", ")", "{", "List", "<", "GradingCriterion", ">", "gradingCriteria", "=", "exercise", ".", "getGradingCriteria", "(", ")", ";", "List", "<", "Feedback", ">", "feedbackToBeUpdated", "=", "feedbackRepository", ".", "findFeedbackByExerciseGradingCriteria", "(", "gradingCriteria", ")", ";", "List", "<", "GradingInstruction", ">", "gradingInstructions", "=", "gradingCriteria", ".", "stream", "(", ")", ".", "flatMap", "(", "gradingCriterion", "->", "gradingCriterion", ".", "getStructuredGradingInstructions", "(", ")", ".", "stream", "(", ")", ")", ".", "toList", "(", ")", ";", "for", "(", "GradingInstruction", "instruction", ":", "gradingInstructions", ")", "{", "for", "(", "Feedback", "feedback", ":", "feedbackToBeUpdated", ")", "{", "if", "(", "feedback", ".", "getGradingInstruction", "(", ")", ".", "getId", "(", ")", ".", "equals", "(", "instruction", ".", "getId", "(", ")", ")", ")", "{", "feedback", ".", "setCredits", "(", "instruction", ".", "getCredits", "(", ")", ")", ";", "feedback", ".", "setPositive", "(", "feedback", ".", "getCredits", "(", ")", ">=", "0", ")", ";", "feedback", ".", "setDetailText", "(", "instruction", ".", "getFeedback", "(", ")", ")", ";", "}", "}", "}", "feedbackRepository", ".", "saveAll", "(", "feedbackToBeUpdated", ")", ";", "List", "<", "Feedback", ">", "feedbackToBeDeleted", "=", "getFeedbackToBeDeletedAfterGradingInstructionUpdate", "(", "deleteFeedbackAfterGradingInstructionUpdate", ",", "gradingInstructions", ",", "exercise", ")", ";", "List", "<", "Result", ">", "results", "=", "resultRepository", ".", "findWithEagerSubmissionAndFeedbackByParticipationExerciseId", "(", "exercise", ".", "getId", "(", ")", ")", ";", "if", "(", "!", "exercise", ".", "getExampleSubmissions", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "results", ".", "addAll", "(", "resultRepository", ".", "getResultForExampleSubmissions", "(", "exercise", ".", "getExampleSubmissions", "(", ")", ")", ")", ";", "}", "for", "(", "Result", "result", ":", "results", ")", "{", "if", "(", "!", "feedbackToBeDeleted", ".", "isEmpty", "(", ")", ")", "{", "List", "<", "Feedback", ">", "existingFeedback", "=", "result", ".", "getFeedbacks", "(", ")", ";", "if", "(", "!", "existingFeedback", ".", "isEmpty", "(", ")", ")", "{", "existingFeedback", ".", "removeAll", "(", "feedbackToBeDeleted", ")", ";", "}", "List", "<", "Feedback", ">", "savedFeedback", "=", "feedbackRepository", ".", "saveFeedbacks", "(", "existingFeedback", ")", ";", "result", ".", "updateAllFeedbackItems", "(", "savedFeedback", ",", "exercise", "instanceof", "ProgrammingExercise", ")", ";", "}", "if", "(", "!", "(", "exercise", "instanceof", "ProgrammingExercise", ")", ")", "{", "resultRepository", ".", "submitResult", "(", "result", ",", "exercise", ")", ";", "}", "else", "{", "double", "totalScore", "=", "programmingAssessmentService", ".", "calculateTotalScore", "(", "result", ")", ";", "result", ".", "setScore", "(", "totalScore", ",", "exercise", ".", "getMaxPoints", "(", ")", ")", ";", "/*\n * Result string has following structure e.g: \"1 of 13 passed, 2 issues, 10 of 100 points\" The last part of the result string has to be updated, as the points the\n * student has achieved have changed\n */", "String", "[", "]", "resultStringParts", "=", "result", ".", "getResultString", "(", ")", ".", "split", "(", "\", \"", ")", ";", "resultStringParts", "[", "resultStringParts", ".", "length", "-", "1", "]", "=", "result", ".", "createResultString", "(", "totalScore", ",", "exercise", ".", "getMaxPoints", "(", ")", ")", ";", "result", ".", "setResultString", "(", "String", ".", "join", "(", "\", \"", ",", "resultStringParts", ")", ")", ";", "resultRepository", ".", "save", "(", "result", ")", ";", "}", "}", "}" ]
Re-evaluates the exercise before saving 1.
[ "Re", "-", "evaluates", "the", "exercise", "before", "saving", "1", "." ]
[ "// retrieve the feedback associated with the structured grading instructions", "// collect all structured grading instructions into the list", "// update the related fields for feedback", "// add example submission results that belong exercise", "// re-calculate the results after updating the feedback", "// first save the feedback (that is not yet in the database) to prevent null index exception" ]
[ { "param": "exercise", "type": "Exercise" }, { "param": "deleteFeedbackAfterGradingInstructionUpdate", "type": "boolean" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "exercise", "type": "Exercise", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "deleteFeedbackAfterGradingInstructionUpdate", "type": "boolean", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 918, 283, 15369, 424, 20603, 12, 424, 20603, 24165, 16, 1250, 1430, 15888, 4436, 30420, 310, 11983, 1891, 13, 288, 203, 203, 3639, 987, 32, 30420, 310, 13210, 34, 21717, 7231, 273, 24165, 18, 588, 30420, 310, 7231, 5621, 203, 3639, 368, 4614, 326, 10762, 3627, 598, 326, 19788, 21717, 12509, 203, 3639, 987, 32, 15888, 34, 10762, 15360, 7381, 273, 10762, 3305, 18, 4720, 15888, 858, 424, 20603, 30420, 310, 7231, 12, 15210, 7231, 1769, 203, 203, 3639, 368, 3274, 777, 19788, 21717, 12509, 1368, 326, 666, 203, 3639, 987, 32, 30420, 310, 11983, 34, 21717, 26712, 273, 21717, 7231, 18, 3256, 7675, 15401, 863, 12, 15210, 13210, 317, 21717, 13210, 18, 588, 30733, 30420, 310, 26712, 7675, 3256, 1435, 2934, 869, 682, 5621, 203, 203, 3639, 368, 1089, 326, 3746, 1466, 364, 10762, 203, 3639, 364, 261, 30420, 310, 11983, 7592, 294, 21717, 26712, 13, 288, 203, 5411, 364, 261, 15888, 10762, 294, 10762, 15360, 7381, 13, 288, 203, 7734, 309, 261, 12571, 18, 588, 30420, 310, 11983, 7675, 26321, 7675, 14963, 12, 19116, 18, 26321, 1435, 3719, 288, 203, 10792, 10762, 18, 542, 24201, 1282, 12, 19116, 18, 588, 24201, 1282, 10663, 203, 10792, 10762, 18, 542, 14900, 12, 12571, 18, 588, 24201, 1282, 1435, 1545, 374, 1769, 203, 10792, 10762, 18, 542, 6109, 1528, 12, 19116, 18, 588, 15888, 10663, 203, 7734, 289, 203, 5411, 289, 203, 3639, 289, 203, 3639, 10762, 3305, 18, 5688, 1595, 12, 12571, 15360, 7381, 1769, 203, 203, 3639, 987, 32, 15888, 34, 10762, 15360, 7977, 273, 13683, 329, 823, 15360, 7977, 4436, 30420, 310, 11983, 1891, 12, 3733, 15888, 4436, 30420, 310, 11983, 1891, 16, 21717, 26712, 16, 24165, 1769, 203, 203, 3639, 987, 32, 1253, 34, 1686, 273, 563, 3305, 18, 4720, 1190, 41, 6817, 17865, 1876, 15888, 858, 1988, 24629, 367, 424, 20603, 548, 12, 8913, 30708, 18, 26321, 10663, 203, 203, 3639, 368, 527, 3454, 8515, 1686, 716, 10957, 24165, 203, 3639, 309, 16051, 8913, 30708, 18, 588, 10908, 1676, 7300, 7675, 291, 1921, 10756, 288, 203, 5411, 1686, 18, 1289, 1595, 12, 2088, 3305, 18, 588, 1253, 1290, 10908, 1676, 7300, 12, 8913, 30708, 18, 588, 10908, 1676, 7300, 1435, 10019, 203, 3639, 289, 203, 203, 3639, 368, 283, 17, 11162, 326, 1686, 1839, 9702, 326, 10762, 203, 3639, 364, 261, 1253, 563, 294, 1686, 13, 288, 203, 5411, 309, 16051, 12571, 15360, 7977, 18, 291, 1921, 10756, 288, 203, 7734, 987, 32, 15888, 34, 2062, 15888, 273, 563, 18, 588, 15888, 87, 5621, 203, 7734, 309, 16051, 11711, 15888, 18, 291, 1921, 10756, 288, 203, 10792, 2062, 15888, 18, 4479, 1595, 12, 12571, 15360, 7977, 1769, 203, 7734, 289, 203, 7734, 368, 1122, 1923, 326, 10762, 261, 19056, 353, 486, 4671, 316, 326, 2063, 13, 358, 5309, 446, 770, 1520, 203, 7734, 987, 32, 15888, 34, 5198, 15888, 273, 10762, 3305, 18, 5688, 15888, 87, 12, 11711, 15888, 1769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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
[ 1, 26873, 203, 377, 380, 868, 17, 14168, 815, 326, 24165, 1865, 12392, 203, 377, 380, 404, 18, 1021, 10762, 3627, 598, 326, 24165, 21717, 7592, 4260, 358, 506, 3526, 203, 377, 380, 576, 18, 7360, 9702, 10762, 16, 563, 4260, 358, 506, 283, 17, 22113, 203, 377, 380, 203, 377, 380, 632, 891, 24165, 24165, 358, 283, 17, 21024, 203, 377, 380, 632, 891, 1430, 15888, 4436, 30420, 310, 11983, 1891, 225, 1250, 2982, 716, 8527, 2856, 326, 3627, 10762, 1410, 506, 4282, 578, 486, 377, 380, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
5f31549e8a3a6797740c0b0410e8025f54354ab3
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/web/rest/NotificationResource.java
[ "MIT" ]
Java
createNotification
null
@PostMapping("notifications") @PreAuthorize("hasRole('INSTRUCTOR')") public ResponseEntity<Notification> createNotification(@RequestBody Notification notification) throws URISyntaxException { log.debug("REST request to save Notification : {}", notification); if (notification.getId() != null) { throw new BadRequestAlertException("A new notification cannot already have an ID", ENTITY_NAME, "idexists"); } restrictSystemNotificationsToAdmin(null, notification); Notification result = notificationRepository.save(notification); return ResponseEntity.created(new URI("/api/notifications/" + result.getId())) .headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString())).body(result); }
/** * POST notifications : Create a new notification. * * @param notification the notification to create * @return the ResponseEntity with status 201 (Created) and with body the new notification, or with status 400 (Bad Request) if the notification has already an ID * @throws URISyntaxException if the Location URI syntax is incorrect */
POST notifications : Create a new notification. @param notification the notification to create @return the ResponseEntity with status 201 (Created) and with body the new notification, or with status 400 (Bad Request) if the notification has already an ID @throws URISyntaxException if the Location URI syntax is incorrect
[ "POST", "notifications", ":", "Create", "a", "new", "notification", ".", "@param", "notification", "the", "notification", "to", "create", "@return", "the", "ResponseEntity", "with", "status", "201", "(", "Created", ")", "and", "with", "body", "the", "new", "notification", "or", "with", "status", "400", "(", "Bad", "Request", ")", "if", "the", "notification", "has", "already", "an", "ID", "@throws", "URISyntaxException", "if", "the", "Location", "URI", "syntax", "is", "incorrect" ]
@PostMapping("notifications") @PreAuthorize("hasRole('INSTRUCTOR')") public ResponseEntity<Notification> createNotification(@RequestBody Notification notification) throws URISyntaxException { log.debug("REST request to save Notification : {}", notification); if (notification.getId() != null) { throw new BadRequestAlertException("A new notification cannot already have an ID", ENTITY_NAME, "idexists"); } restrictSystemNotificationsToAdmin(null, notification); Notification result = notificationRepository.save(notification); return ResponseEntity.created(new URI("/api/notifications/" + result.getId())) .headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString())).body(result); }
[ "@", "PostMapping", "(", "\"notifications\"", ")", "@", "PreAuthorize", "(", "\"hasRole('INSTRUCTOR')\"", ")", "public", "ResponseEntity", "<", "Notification", ">", "createNotification", "(", "@", "RequestBody", "Notification", "notification", ")", "throws", "URISyntaxException", "{", "log", ".", "debug", "(", "\"REST request to save Notification : {}\"", ",", "notification", ")", ";", "if", "(", "notification", ".", "getId", "(", ")", "!=", "null", ")", "{", "throw", "new", "BadRequestAlertException", "(", "\"A new notification cannot already have an ID\"", ",", "ENTITY_NAME", ",", "\"idexists\"", ")", ";", "}", "restrictSystemNotificationsToAdmin", "(", "null", ",", "notification", ")", ";", "Notification", "result", "=", "notificationRepository", ".", "save", "(", "notification", ")", ";", "return", "ResponseEntity", ".", "created", "(", "new", "URI", "(", "\"/api/notifications/\"", "+", "result", ".", "getId", "(", ")", ")", ")", ".", "headers", "(", "HeaderUtil", ".", "createEntityCreationAlert", "(", "applicationName", ",", "true", ",", "ENTITY_NAME", ",", "result", ".", "getId", "(", ")", ".", "toString", "(", ")", ")", ")", ".", "body", "(", "result", ")", ";", "}" ]
POST notifications : Create a new notification.
[ "POST", "notifications", ":", "Create", "a", "new", "notification", "." ]
[]
[ { "param": "notification", "type": "Notification" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "notification", "type": "Notification", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 3349, 3233, 2932, 15286, 7923, 203, 565, 632, 1386, 18987, 2932, 5332, 2996, 2668, 706, 13915, 916, 23291, 13, 203, 565, 1071, 2306, 1943, 32, 4386, 34, 752, 4386, 26964, 28843, 8050, 3851, 13, 1216, 19883, 288, 203, 3639, 613, 18, 4148, 2932, 12030, 590, 358, 1923, 8050, 294, 3728, 16, 3851, 1769, 203, 3639, 309, 261, 9927, 18, 26321, 1435, 480, 446, 13, 288, 203, 5411, 604, 394, 23223, 13298, 503, 2932, 37, 394, 3851, 2780, 1818, 1240, 392, 1599, 3113, 17020, 67, 1985, 16, 315, 77, 561, 1486, 8863, 203, 3639, 289, 203, 3639, 13108, 3163, 4386, 11634, 4446, 12, 2011, 16, 3851, 1769, 203, 3639, 8050, 563, 273, 3851, 3305, 18, 5688, 12, 9927, 1769, 203, 3639, 327, 2306, 1943, 18, 4824, 12, 2704, 3699, 2932, 19, 2425, 19, 15286, 4898, 397, 563, 18, 26321, 1435, 3719, 203, 7734, 263, 2485, 12, 1864, 1304, 18, 2640, 1943, 9906, 13298, 12, 3685, 461, 16, 638, 16, 17020, 67, 1985, 16, 563, 18, 26321, 7675, 10492, 10756, 2934, 3432, 12, 2088, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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, 6434, 1567, 13, 309, 326, 3851, 711, 1818, 392, 1599, 203, 377, 380, 632, 15069, 19883, 309, 326, 7050, 3699, 6279, 353, 11332, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
5f31549e8a3a6797740c0b0410e8025f54354ab3
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/web/rest/NotificationResource.java
[ "MIT" ]
Java
updateNotification
null
@PutMapping("notifications") @PreAuthorize("hasRole('INSTRUCTOR')") public ResponseEntity<Notification> updateNotification(@RequestBody Notification notification) throws URISyntaxException { log.debug("REST request to update Notification : {}", notification); if (notification.getId() == null) { throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull"); } restrictSystemNotificationsToAdmin(null, notification); Notification result = notificationRepository.save(notification); return ResponseEntity.ok().headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, notification.getId().toString())).body(result); }
/** * PUT notifications : Updates an existing notification. * * @param notification the notification to update * @return the ResponseEntity with status 200 (OK) and with body the updated notification, or with status 400 (Bad Request) if the notification is not valid, or with status 500 * (Internal Server Error) if the notification couldn't be updated * @throws URISyntaxException if the Location URI syntax is incorrect */
PUT notifications : Updates an existing notification. @param notification the notification to update @return the ResponseEntity with status 200 (OK) and with body the updated notification, or with status 400 (Bad Request) if the notification is not valid, or with status 500 (Internal Server Error) if the notification couldn't be updated @throws URISyntaxException if the Location URI syntax is incorrect
[ "PUT", "notifications", ":", "Updates", "an", "existing", "notification", ".", "@param", "notification", "the", "notification", "to", "update", "@return", "the", "ResponseEntity", "with", "status", "200", "(", "OK", ")", "and", "with", "body", "the", "updated", "notification", "or", "with", "status", "400", "(", "Bad", "Request", ")", "if", "the", "notification", "is", "not", "valid", "or", "with", "status", "500", "(", "Internal", "Server", "Error", ")", "if", "the", "notification", "couldn", "'", "t", "be", "updated", "@throws", "URISyntaxException", "if", "the", "Location", "URI", "syntax", "is", "incorrect" ]
@PutMapping("notifications") @PreAuthorize("hasRole('INSTRUCTOR')") public ResponseEntity<Notification> updateNotification(@RequestBody Notification notification) throws URISyntaxException { log.debug("REST request to update Notification : {}", notification); if (notification.getId() == null) { throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull"); } restrictSystemNotificationsToAdmin(null, notification); Notification result = notificationRepository.save(notification); return ResponseEntity.ok().headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, notification.getId().toString())).body(result); }
[ "@", "PutMapping", "(", "\"notifications\"", ")", "@", "PreAuthorize", "(", "\"hasRole('INSTRUCTOR')\"", ")", "public", "ResponseEntity", "<", "Notification", ">", "updateNotification", "(", "@", "RequestBody", "Notification", "notification", ")", "throws", "URISyntaxException", "{", "log", ".", "debug", "(", "\"REST request to update Notification : {}\"", ",", "notification", ")", ";", "if", "(", "notification", ".", "getId", "(", ")", "==", "null", ")", "{", "throw", "new", "BadRequestAlertException", "(", "\"Invalid id\"", ",", "ENTITY_NAME", ",", "\"idnull\"", ")", ";", "}", "restrictSystemNotificationsToAdmin", "(", "null", ",", "notification", ")", ";", "Notification", "result", "=", "notificationRepository", ".", "save", "(", "notification", ")", ";", "return", "ResponseEntity", ".", "ok", "(", ")", ".", "headers", "(", "HeaderUtil", ".", "createEntityUpdateAlert", "(", "applicationName", ",", "true", ",", "ENTITY_NAME", ",", "notification", ".", "getId", "(", ")", ".", "toString", "(", ")", ")", ")", ".", "body", "(", "result", ")", ";", "}" ]
PUT notifications : Updates an existing notification.
[ "PUT", "notifications", ":", "Updates", "an", "existing", "notification", "." ]
[]
[ { "param": "notification", "type": "Notification" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "notification", "type": "Notification", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 6426, 3233, 2932, 15286, 7923, 203, 565, 632, 1386, 18987, 2932, 5332, 2996, 2668, 706, 13915, 916, 23291, 13, 203, 565, 1071, 2306, 1943, 32, 4386, 34, 1089, 4386, 26964, 28843, 8050, 3851, 13, 1216, 19883, 288, 203, 3639, 613, 18, 4148, 2932, 12030, 590, 358, 1089, 8050, 294, 3728, 16, 3851, 1769, 203, 3639, 309, 261, 9927, 18, 26321, 1435, 422, 446, 13, 288, 203, 5411, 604, 394, 23223, 13298, 503, 2932, 1941, 612, 3113, 17020, 67, 1985, 16, 315, 350, 2011, 8863, 203, 3639, 289, 203, 3639, 13108, 3163, 4386, 11634, 4446, 12, 2011, 16, 3851, 1769, 203, 3639, 8050, 563, 273, 3851, 3305, 18, 5688, 12, 9927, 1769, 203, 3639, 327, 2306, 1943, 18, 601, 7675, 2485, 12, 1864, 1304, 18, 2640, 1943, 1891, 13298, 12, 3685, 461, 16, 638, 16, 17020, 67, 1985, 16, 3851, 18, 26321, 7675, 10492, 10756, 2934, 3432, 12, 2088, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 11443, 9208, 294, 15419, 392, 2062, 3851, 18, 203, 377, 380, 203, 377, 380, 632, 891, 3851, 326, 3851, 358, 1089, 203, 377, 380, 632, 2463, 326, 2306, 1943, 598, 1267, 4044, 261, 3141, 13, 471, 598, 1417, 326, 3526, 3851, 16, 578, 598, 1267, 7409, 261, 6434, 1567, 13, 309, 326, 3851, 353, 486, 923, 16, 578, 598, 1267, 6604, 203, 377, 380, 540, 261, 3061, 3224, 1068, 13, 309, 326, 3851, 17991, 1404, 506, 3526, 203, 377, 380, 632, 15069, 19883, 309, 326, 7050, 3699, 6279, 353, 11332, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
5f31549e8a3a6797740c0b0410e8025f54354ab3
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/web/rest/NotificationResource.java
[ "MIT" ]
Java
deleteNotification
null
@DeleteMapping("notifications/{id}") @PreAuthorize("hasRole('INSTRUCTOR')") public ResponseEntity<Void> deleteNotification(@PathVariable Long id) { log.debug("REST request to delete Notification : {}", id); restrictSystemNotificationsToAdmin(id, null); notificationRepository.deleteById(id); return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, id.toString())).build(); }
/** * DELETE notifications/:id : delete the "id" notification. * * @param id the id of the notification to delete * @return the ResponseEntity with status 200 (OK) */
DELETE notifications/:id : delete the "id" notification. @param id the id of the notification to delete @return the ResponseEntity with status 200 (OK)
[ "DELETE", "notifications", "/", ":", "id", ":", "delete", "the", "\"", "id", "\"", "notification", ".", "@param", "id", "the", "id", "of", "the", "notification", "to", "delete", "@return", "the", "ResponseEntity", "with", "status", "200", "(", "OK", ")" ]
@DeleteMapping("notifications/{id}") @PreAuthorize("hasRole('INSTRUCTOR')") public ResponseEntity<Void> deleteNotification(@PathVariable Long id) { log.debug("REST request to delete Notification : {}", id); restrictSystemNotificationsToAdmin(id, null); notificationRepository.deleteById(id); return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, id.toString())).build(); }
[ "@", "DeleteMapping", "(", "\"notifications/{id}\"", ")", "@", "PreAuthorize", "(", "\"hasRole('INSTRUCTOR')\"", ")", "public", "ResponseEntity", "<", "Void", ">", "deleteNotification", "(", "@", "PathVariable", "Long", "id", ")", "{", "log", ".", "debug", "(", "\"REST request to delete Notification : {}\"", ",", "id", ")", ";", "restrictSystemNotificationsToAdmin", "(", "id", ",", "null", ")", ";", "notificationRepository", ".", "deleteById", "(", "id", ")", ";", "return", "ResponseEntity", ".", "ok", "(", ")", ".", "headers", "(", "HeaderUtil", ".", "createEntityDeletionAlert", "(", "applicationName", ",", "true", ",", "ENTITY_NAME", ",", "id", ".", "toString", "(", ")", ")", ")", ".", "build", "(", ")", ";", "}" ]
DELETE notifications/:id : delete the "id" notification.
[ "DELETE", "notifications", "/", ":", "id", ":", "delete", "the", "\"", "id", "\"", "notification", "." ]
[]
[ { "param": "id", "type": "Long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "id", "type": "Long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 2613, 3233, 2932, 15286, 4938, 350, 1532, 13, 203, 565, 632, 1386, 18987, 2932, 5332, 2996, 2668, 706, 13915, 916, 23291, 13, 203, 565, 1071, 2306, 1943, 32, 19038, 34, 1430, 4386, 26964, 743, 3092, 3407, 612, 13, 288, 203, 3639, 613, 18, 4148, 2932, 12030, 590, 358, 1430, 8050, 294, 3728, 16, 612, 1769, 203, 3639, 13108, 3163, 4386, 11634, 4446, 12, 350, 16, 446, 1769, 203, 3639, 3851, 3305,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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 8568, 9208, 16880, 350, 294, 1430, 326, 315, 350, 6, 3851, 18, 203, 377, 380, 203, 377, 380, 632, 891, 612, 326, 612, 434, 326, 3851, 358, 1430, 203, 377, 380, 632, 2463, 326, 2306, 1943, 598, 1267, 4044, 261, 3141, 13, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
083ad22d561d19f1834db30a44acf92ce6e6f3ff
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/service/TextAssessmentKnowledgeService.java
[ "MIT" ]
Java
deleteKnowledge
null
public void deleteKnowledge(Long knowledgeId) { Set<TextExercise> exerciseSet = textExerciseRepository.findAllByKnowledgeId(knowledgeId); // If no other exercises use the same knowledge then remove knowledge if (exerciseSet.isEmpty()) { textAssesmentKnowledgeRepository.deleteById(knowledgeId); } }
/** * delete only when no exercises use the knowledge * @param knowledgeId */
delete only when no exercises use the knowledge @param knowledgeId
[ "delete", "only", "when", "no", "exercises", "use", "the", "knowledge", "@param", "knowledgeId" ]
public void deleteKnowledge(Long knowledgeId) { Set<TextExercise> exerciseSet = textExerciseRepository.findAllByKnowledgeId(knowledgeId); if (exerciseSet.isEmpty()) { textAssesmentKnowledgeRepository.deleteById(knowledgeId); } }
[ "public", "void", "deleteKnowledge", "(", "Long", "knowledgeId", ")", "{", "Set", "<", "TextExercise", ">", "exerciseSet", "=", "textExerciseRepository", ".", "findAllByKnowledgeId", "(", "knowledgeId", ")", ";", "if", "(", "exerciseSet", ".", "isEmpty", "(", ")", ")", "{", "textAssesmentKnowledgeRepository", ".", "deleteById", "(", "knowledgeId", ")", ";", "}", "}" ]
delete only when no exercises use the knowledge @param knowledgeId
[ "delete", "only", "when", "no", "exercises", "use", "the", "knowledge", "@param", "knowledgeId" ]
[ "// If no other exercises use the same knowledge then remove knowledge" ]
[ { "param": "knowledgeId", "type": "Long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "knowledgeId", "type": "Long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 918, 1430, 47, 14390, 12, 3708, 20272, 548, 13, 288, 203, 3639, 1000, 32, 1528, 424, 20603, 34, 24165, 694, 273, 977, 424, 20603, 3305, 18, 4720, 1595, 858, 47, 14390, 548, 12, 79, 14390, 548, 1769, 203, 3639, 368, 971, 1158, 1308, 431, 12610, 6141, 999, 326, 1967, 20272, 1508, 1206, 20272, 203, 3639, 309, 261, 8913, 30708, 694, 18, 291, 1921, 10756, 288, 203, 5411, 977, 2610, 281, 475, 47, 14390, 3305, 18, 3733, 5132, 12, 79, 14390, 548, 1769, 203, 3639, 289, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 1430, 1338, 1347, 1158, 431, 12610, 6141, 999, 326, 20272, 203, 377, 380, 632, 891, 20272, 548, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
083ad22d561d19f1834db30a44acf92ce6e6f3ff
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/service/TextAssessmentKnowledgeService.java
[ "MIT" ]
Java
createNewKnowledge
TextAssessmentKnowledge
public TextAssessmentKnowledge createNewKnowledge() { TextAssessmentKnowledge knowledge = new TextAssessmentKnowledge(); textAssesmentKnowledgeRepository.save(knowledge); return knowledge; }
/** * Create new knowledge if exercise is created from scratch * * @return TextAssessmentKnowledge */
Create new knowledge if exercise is created from scratch @return TextAssessmentKnowledge
[ "Create", "new", "knowledge", "if", "exercise", "is", "created", "from", "scratch", "@return", "TextAssessmentKnowledge" ]
public TextAssessmentKnowledge createNewKnowledge() { TextAssessmentKnowledge knowledge = new TextAssessmentKnowledge(); textAssesmentKnowledgeRepository.save(knowledge); return knowledge; }
[ "public", "TextAssessmentKnowledge", "createNewKnowledge", "(", ")", "{", "TextAssessmentKnowledge", "knowledge", "=", "new", "TextAssessmentKnowledge", "(", ")", ";", "textAssesmentKnowledgeRepository", ".", "save", "(", "knowledge", ")", ";", "return", "knowledge", ";", "}" ]
Create new knowledge if exercise is created from scratch @return TextAssessmentKnowledge
[ "Create", "new", "knowledge", "if", "exercise", "is", "created", "from", "scratch", "@return", "TextAssessmentKnowledge" ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 3867, 15209, 47, 14390, 15291, 47, 14390, 1435, 288, 203, 3639, 3867, 15209, 47, 14390, 20272, 273, 394, 3867, 15209, 47, 14390, 5621, 203, 3639, 977, 2610, 281, 475, 47, 14390, 3305, 18, 5688, 12, 79, 14390, 1769, 203, 3639, 327, 20272, 31, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 1788, 394, 20272, 309, 24165, 353, 2522, 628, 15289, 203, 377, 380, 203, 377, 380, 632, 2463, 3867, 15209, 47, 14390, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
0096f1c99fe7457cdf8be6a17e991d754a6fbd78
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/service/programming/ProgrammingExerciseService.java
[ "MIT" ]
Java
createProgrammingExercise
ProgrammingExercise
@Transactional // ok because we create many objects in a rather complex way and need a rollback in case of exceptions public ProgrammingExercise createProgrammingExercise(ProgrammingExercise programmingExercise) throws InterruptedException, GitAPIException, IOException { programmingExercise.generateAndSetProjectKey(); final User user = userRepository.getUser(); createRepositoriesForNewExercise(programmingExercise); initParticipations(programmingExercise); setURLsAndBuildPlanIDsForNewExercise(programmingExercise); // Save participations to get the ids required for the webhooks connectBaseParticipationsToExerciseAndSave(programmingExercise); connectAuxiliaryRepositoriesToExercise(programmingExercise); setupExerciseTemplate(programmingExercise, user); // Save programming exercise to prevent transient exception programmingExercise = programmingExerciseRepository.save(programmingExercise); setupBuildPlansForNewExercise(programmingExercise); // save to get the id required for the webhook programmingExercise = programmingExerciseRepository.saveAndFlush(programmingExercise); // The creation of the webhooks must occur after the initial push, because the participation is // not yet saved in the database, so we cannot save the submission accordingly (see ProgrammingSubmissionService.notifyPush) versionControlService.get().addWebHooksForExercise(programmingExercise); scheduleOperations(programmingExercise.getId()); instanceMessageSendService.sendExerciseReleaseNotificationSchedule(programmingExercise.getId()); return programmingExercise; }
/** * Setups the context of a new programming exercise. This includes: * <ul> * <li>The VCS project</li> * <li>All repositories (test, exercise, solution)</li> * <li>The template and solution participation</li> * <li>VCS webhooks</li> * <li>Bamboo build plans</li> * </ul> * * The exercise gets set up in the following order: * <ol> * <li>Create all repositories for the new exercise</li> * <li>Setup template and push it to the repositories</li> * <li>Setup new build plans for exercise</li> * <li>Add all webhooks</li> * <li>Init scheduled jobs for exercise maintenance</li> * </ol> * * @param programmingExercise The programmingExercise that should be setup * @return The newly setup exercise * @throws InterruptedException If something during the communication with the remote Git repository went wrong * @throws GitAPIException If something during the communication with the remote Git repository went wrong * @throws IOException If the template files couldn't be read */
Setups the context of a new programming exercise. This includes: The VCS project All repositories (test, exercise, solution) The template and solution participation VCS webhooks Bamboo build plans The exercise gets set up in the following order: Create all repositories for the new exercise Setup template and push it to the repositories Setup new build plans for exercise Add all webhooks Init scheduled jobs for exercise maintenance
[ "Setups", "the", "context", "of", "a", "new", "programming", "exercise", ".", "This", "includes", ":", "The", "VCS", "project", "All", "repositories", "(", "test", "exercise", "solution", ")", "The", "template", "and", "solution", "participation", "VCS", "webhooks", "Bamboo", "build", "plans", "The", "exercise", "gets", "set", "up", "in", "the", "following", "order", ":", "Create", "all", "repositories", "for", "the", "new", "exercise", "Setup", "template", "and", "push", "it", "to", "the", "repositories", "Setup", "new", "build", "plans", "for", "exercise", "Add", "all", "webhooks", "Init", "scheduled", "jobs", "for", "exercise", "maintenance" ]
@Transactional public ProgrammingExercise createProgrammingExercise(ProgrammingExercise programmingExercise) throws InterruptedException, GitAPIException, IOException { programmingExercise.generateAndSetProjectKey(); final User user = userRepository.getUser(); createRepositoriesForNewExercise(programmingExercise); initParticipations(programmingExercise); setURLsAndBuildPlanIDsForNewExercise(programmingExercise); connectBaseParticipationsToExerciseAndSave(programmingExercise); connectAuxiliaryRepositoriesToExercise(programmingExercise); setupExerciseTemplate(programmingExercise, user); programmingExercise = programmingExerciseRepository.save(programmingExercise); setupBuildPlansForNewExercise(programmingExercise); programmingExercise = programmingExerciseRepository.saveAndFlush(programmingExercise); versionControlService.get().addWebHooksForExercise(programmingExercise); scheduleOperations(programmingExercise.getId()); instanceMessageSendService.sendExerciseReleaseNotificationSchedule(programmingExercise.getId()); return programmingExercise; }
[ "@", "Transactional", "public", "ProgrammingExercise", "createProgrammingExercise", "(", "ProgrammingExercise", "programmingExercise", ")", "throws", "InterruptedException", ",", "GitAPIException", ",", "IOException", "{", "programmingExercise", ".", "generateAndSetProjectKey", "(", ")", ";", "final", "User", "user", "=", "userRepository", ".", "getUser", "(", ")", ";", "createRepositoriesForNewExercise", "(", "programmingExercise", ")", ";", "initParticipations", "(", "programmingExercise", ")", ";", "setURLsAndBuildPlanIDsForNewExercise", "(", "programmingExercise", ")", ";", "connectBaseParticipationsToExerciseAndSave", "(", "programmingExercise", ")", ";", "connectAuxiliaryRepositoriesToExercise", "(", "programmingExercise", ")", ";", "setupExerciseTemplate", "(", "programmingExercise", ",", "user", ")", ";", "programmingExercise", "=", "programmingExerciseRepository", ".", "save", "(", "programmingExercise", ")", ";", "setupBuildPlansForNewExercise", "(", "programmingExercise", ")", ";", "programmingExercise", "=", "programmingExerciseRepository", ".", "saveAndFlush", "(", "programmingExercise", ")", ";", "versionControlService", ".", "get", "(", ")", ".", "addWebHooksForExercise", "(", "programmingExercise", ")", ";", "scheduleOperations", "(", "programmingExercise", ".", "getId", "(", ")", ")", ";", "instanceMessageSendService", ".", "sendExerciseReleaseNotificationSchedule", "(", "programmingExercise", ".", "getId", "(", ")", ")", ";", "return", "programmingExercise", ";", "}" ]
Setups the context of a new programming exercise.
[ "Setups", "the", "context", "of", "a", "new", "programming", "exercise", "." ]
[ "// ok because we create many objects in a rather complex way and need a rollback in case of exceptions", "// Save participations to get the ids required for the webhooks", "// Save programming exercise to prevent transient exception", "// save to get the id required for the webhook", "// The creation of the webhooks must occur after the initial push, because the participation is", "// not yet saved in the database, so we cannot save the submission accordingly (see ProgrammingSubmissionService.notifyPush)" ]
[ { "param": "programmingExercise", "type": "ProgrammingExercise" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "programmingExercise", "type": "ProgrammingExercise", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 3342, 287, 368, 1529, 2724, 732, 752, 4906, 2184, 316, 279, 9178, 7233, 4031, 471, 1608, 279, 8006, 316, 648, 434, 4798, 203, 565, 1071, 13586, 11987, 424, 20603, 752, 9459, 11987, 424, 20603, 12, 9459, 11987, 424, 20603, 5402, 11987, 424, 20603, 13, 1216, 7558, 16, 6646, 2557, 503, 16, 1860, 288, 203, 3639, 5402, 11987, 424, 20603, 18, 7163, 13152, 4109, 653, 5621, 203, 3639, 727, 2177, 729, 273, 729, 3305, 18, 588, 1299, 5621, 203, 203, 3639, 752, 18429, 1290, 1908, 424, 20603, 12, 12890, 11987, 424, 20603, 1769, 203, 3639, 1208, 1988, 24629, 1012, 12, 12890, 11987, 424, 20603, 1769, 203, 3639, 444, 15749, 1876, 3116, 5365, 5103, 1290, 1908, 424, 20603, 12, 12890, 11987, 424, 20603, 1769, 203, 203, 3639, 368, 7074, 30891, 1012, 358, 336, 326, 3258, 1931, 364, 326, 30045, 203, 3639, 3077, 2171, 1988, 24629, 1012, 774, 424, 20603, 1876, 4755, 12, 12890, 11987, 424, 20603, 1769, 203, 203, 3639, 3077, 21981, 20606, 18429, 774, 424, 20603, 12, 12890, 11987, 424, 20603, 1769, 203, 203, 3639, 3875, 424, 20603, 2283, 12, 12890, 11987, 424, 20603, 16, 729, 1769, 203, 203, 3639, 368, 7074, 5402, 11987, 24165, 358, 5309, 12315, 1520, 203, 3639, 5402, 11987, 424, 20603, 273, 5402, 11987, 424, 20603, 3305, 18, 5688, 12, 12890, 11987, 424, 20603, 1769, 203, 203, 3639, 3875, 3116, 22846, 1290, 1908, 424, 20603, 12, 12890, 11987, 424, 20603, 1769, 203, 203, 3639, 368, 1923, 358, 336, 326, 612, 1931, 364, 326, 13343, 203, 3639, 5402, 11987, 424, 20603, 273, 5402, 11987, 424, 20603, 3305, 18, 5688, 1876, 8207, 12, 12890, 11987, 424, 20603, 1769, 203, 203, 3639, 368, 1021, 6710, 434, 326, 30045, 1297, 3334, 1839, 326, 2172, 1817, 16, 2724, 326, 30891, 367, 353, 203, 3639, 368, 486, 4671, 5198, 316, 326, 2063, 16, 1427, 732, 2780, 1923, 326, 8515, 15905, 261, 5946, 13586, 11987, 17865, 1179, 18, 12336, 7621, 13, 203, 3639, 1177, 3367, 1179, 18, 588, 7675, 1289, 4079, 13620, 1290, 424, 20603, 12, 12890, 11987, 424, 20603, 1769, 203, 203, 3639, 4788, 9343, 12, 12890, 11987, 424, 20603, 18, 26321, 10663, 203, 3639, 791, 1079, 3826, 1179, 18, 4661, 424, 20603, 7391, 4386, 6061, 12, 12890, 11987, 424, 20603, 18, 26321, 10663, 203, 203, 3639, 327, 5402, 11987, 424, 20603, 31, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 10939, 87, 326, 819, 434, 279, 394, 5402, 11987, 24165, 18, 1220, 6104, 30, 203, 377, 380, 411, 332, 34, 203, 377, 380, 377, 411, 549, 34, 1986, 776, 4596, 1984, 1757, 549, 34, 203, 377, 380, 377, 411, 549, 34, 1595, 14531, 261, 3813, 16, 24165, 16, 6959, 13, 1757, 549, 34, 203, 377, 380, 377, 411, 549, 34, 1986, 1542, 471, 6959, 30891, 367, 1757, 549, 34, 203, 377, 380, 377, 411, 549, 34, 58, 4596, 30045, 1757, 549, 34, 203, 377, 380, 377, 411, 549, 34, 38, 301, 1075, 83, 1361, 21440, 1757, 549, 34, 203, 377, 380, 7765, 332, 34, 203, 377, 380, 203, 377, 380, 1021, 24165, 5571, 444, 731, 316, 326, 3751, 1353, 30, 203, 377, 2 ]
0096f1c99fe7457cdf8be6a17e991d754a6fbd78
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/service/programming/ProgrammingExerciseService.java
[ "MIT" ]
Java
updateProgrammingExercise
ProgrammingExercise
public ProgrammingExercise updateProgrammingExercise(ProgrammingExercise programmingExercise, @Nullable String notificationText) { setURLsForAuxiliaryRepositoriesOfExercise(programmingExercise); connectAuxiliaryRepositoriesToExercise(programmingExercise); ProgrammingExercise savedProgrammingExercise = programmingExerciseRepository.save(programmingExercise); // TODO: in case of an exam exercise, this is not necessary scheduleOperations(programmingExercise.getId()); // Only send notification for course exercises if (notificationText != null && programmingExercise.isCourseExercise()) { groupNotificationService.notifyStudentAndEditorAndInstructorGroupAboutExerciseUpdate(savedProgrammingExercise, notificationText); } return savedProgrammingExercise; }
/** * @param programmingExercise the changed programming exercise with its new values * @param notificationText optional text about the changes for a notification * @return the updates programming exercise from the database */
@param programmingExercise the changed programming exercise with its new values @param notificationText optional text about the changes for a notification @return the updates programming exercise from the database
[ "@param", "programmingExercise", "the", "changed", "programming", "exercise", "with", "its", "new", "values", "@param", "notificationText", "optional", "text", "about", "the", "changes", "for", "a", "notification", "@return", "the", "updates", "programming", "exercise", "from", "the", "database" ]
public ProgrammingExercise updateProgrammingExercise(ProgrammingExercise programmingExercise, @Nullable String notificationText) { setURLsForAuxiliaryRepositoriesOfExercise(programmingExercise); connectAuxiliaryRepositoriesToExercise(programmingExercise); ProgrammingExercise savedProgrammingExercise = programmingExerciseRepository.save(programmingExercise); scheduleOperations(programmingExercise.getId()); if (notificationText != null && programmingExercise.isCourseExercise()) { groupNotificationService.notifyStudentAndEditorAndInstructorGroupAboutExerciseUpdate(savedProgrammingExercise, notificationText); } return savedProgrammingExercise; }
[ "public", "ProgrammingExercise", "updateProgrammingExercise", "(", "ProgrammingExercise", "programmingExercise", ",", "@", "Nullable", "String", "notificationText", ")", "{", "setURLsForAuxiliaryRepositoriesOfExercise", "(", "programmingExercise", ")", ";", "connectAuxiliaryRepositoriesToExercise", "(", "programmingExercise", ")", ";", "ProgrammingExercise", "savedProgrammingExercise", "=", "programmingExerciseRepository", ".", "save", "(", "programmingExercise", ")", ";", "scheduleOperations", "(", "programmingExercise", ".", "getId", "(", ")", ")", ";", "if", "(", "notificationText", "!=", "null", "&&", "programmingExercise", ".", "isCourseExercise", "(", ")", ")", "{", "groupNotificationService", ".", "notifyStudentAndEditorAndInstructorGroupAboutExerciseUpdate", "(", "savedProgrammingExercise", ",", "notificationText", ")", ";", "}", "return", "savedProgrammingExercise", ";", "}" ]
@param programmingExercise the changed programming exercise with its new values @param notificationText optional text about the changes for a notification @return the updates programming exercise from the database
[ "@param", "programmingExercise", "the", "changed", "programming", "exercise", "with", "its", "new", "values", "@param", "notificationText", "optional", "text", "about", "the", "changes", "for", "a", "notification", "@return", "the", "updates", "programming", "exercise", "from", "the", "database" ]
[ "// TODO: in case of an exam exercise, this is not necessary", "// Only send notification for course exercises" ]
[ { "param": "programmingExercise", "type": "ProgrammingExercise" }, { "param": "notificationText", "type": "String" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "programmingExercise", "type": "ProgrammingExercise", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "notificationText", "type": "String", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 13586, 11987, 424, 20603, 1089, 9459, 11987, 424, 20603, 12, 9459, 11987, 424, 20603, 5402, 11987, 424, 20603, 16, 632, 13349, 514, 3851, 1528, 13, 288, 203, 203, 3639, 444, 15749, 1290, 21981, 20606, 18429, 951, 424, 20603, 12, 12890, 11987, 424, 20603, 1769, 203, 3639, 3077, 21981, 20606, 18429, 774, 424, 20603, 12, 12890, 11987, 424, 20603, 1769, 203, 203, 3639, 13586, 11987, 424, 20603, 5198, 9459, 11987, 424, 20603, 273, 5402, 11987, 424, 20603, 3305, 18, 5688, 12, 12890, 11987, 424, 20603, 1769, 203, 203, 3639, 368, 2660, 30, 316, 648, 434, 392, 19707, 24165, 16, 333, 353, 486, 4573, 203, 3639, 4788, 9343, 12, 12890, 11987, 424, 20603, 18, 26321, 10663, 203, 203, 3639, 368, 5098, 1366, 3851, 364, 4362, 431, 12610, 6141, 203, 3639, 309, 261, 9927, 1528, 480, 446, 597, 5402, 11987, 424, 20603, 18, 291, 39, 3117, 424, 20603, 10756, 288, 203, 5411, 1041, 4386, 1179, 18, 12336, 19943, 319, 1876, 6946, 1876, 382, 2732, 1114, 24813, 424, 20603, 1891, 12, 14077, 9459, 11987, 424, 20603, 16, 3851, 1528, 1769, 203, 3639, 289, 203, 203, 3639, 327, 5198, 9459, 11987, 424, 20603, 31, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 632, 891, 5402, 11987, 424, 20603, 326, 3550, 5402, 11987, 24165, 598, 2097, 394, 924, 203, 377, 380, 632, 891, 3851, 1528, 565, 3129, 977, 2973, 326, 3478, 364, 279, 3851, 203, 377, 380, 632, 2463, 326, 4533, 5402, 11987, 24165, 628, 326, 2063, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
0096f1c99fe7457cdf8be6a17e991d754a6fbd78
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/service/programming/ProgrammingExerciseService.java
[ "MIT" ]
Java
replacePlaceholders
null
public void replacePlaceholders(ProgrammingExercise programmingExercise, Repository repository) throws IOException { Map<String, String> replacements = new HashMap<>(); ProgrammingLanguage programmingLanguage = programmingExercise.getProgrammingLanguage(); ProjectType projectType = programmingExercise.getProjectType(); switch (programmingLanguage) { case JAVA, KOTLIN -> { fileService.replaceVariablesInDirectoryName(repository.getLocalPath().toAbsolutePath().toString(), "${packageNameFolder}", programmingExercise.getPackageFolderName()); replacements.put("${packageName}", programmingExercise.getPackageName()); } case SWIFT -> { switch (projectType) { case PLAIN -> { fileService.replaceVariablesInDirectoryName(repository.getLocalPath().toAbsolutePath().toString(), "${packageNameFolder}", programmingExercise.getPackageName()); fileService.replaceVariablesInFileName(repository.getLocalPath().toAbsolutePath().toString(), "${packageNameFile}", programmingExercise.getPackageName()); replacements.put("${packageName}", programmingExercise.getPackageName()); } case XCODE -> { fileService.replaceVariablesInDirectoryName(repository.getLocalPath().toAbsolutePath().toString(), "${appName}", programmingExercise.getPackageName()); fileService.replaceVariablesInFileName(repository.getLocalPath().toAbsolutePath().toString(), "${appName}", programmingExercise.getPackageName()); replacements.put("${appName}", programmingExercise.getPackageName()); } } } } // there is no need in python to replace package names replacements.put("${exerciseNamePomXml}", programmingExercise.getTitle().replaceAll(" ", "-")); // Used e.g. in artifactId replacements.put("${exerciseName}", programmingExercise.getTitle()); replacements.put("${studentWorkingDirectory}", Constants.STUDENT_WORKING_DIRECTORY); replacements.put("${packaging}", programmingExercise.hasSequentialTestRuns() ? "pom" : "jar"); fileService.replaceVariablesInFileRecursive(repository.getLocalPath().toAbsolutePath().toString(), replacements); }
/** * Replace placeholders in repository files (e.g. ${placeholder}). * * @param programmingExercise The related programming exercise * @param repository The repository in which the placeholders should get replaced * @throws IOException If replacing the directory name, or file variables throws an exception */
Replace placeholders in repository files . @param programmingExercise The related programming exercise @param repository The repository in which the placeholders should get replaced @throws IOException If replacing the directory name, or file variables throws an exception
[ "Replace", "placeholders", "in", "repository", "files", ".", "@param", "programmingExercise", "The", "related", "programming", "exercise", "@param", "repository", "The", "repository", "in", "which", "the", "placeholders", "should", "get", "replaced", "@throws", "IOException", "If", "replacing", "the", "directory", "name", "or", "file", "variables", "throws", "an", "exception" ]
public void replacePlaceholders(ProgrammingExercise programmingExercise, Repository repository) throws IOException { Map<String, String> replacements = new HashMap<>(); ProgrammingLanguage programmingLanguage = programmingExercise.getProgrammingLanguage(); ProjectType projectType = programmingExercise.getProjectType(); switch (programmingLanguage) { case JAVA, KOTLIN -> { fileService.replaceVariablesInDirectoryName(repository.getLocalPath().toAbsolutePath().toString(), "${packageNameFolder}", programmingExercise.getPackageFolderName()); replacements.put("${packageName}", programmingExercise.getPackageName()); } case SWIFT -> { switch (projectType) { case PLAIN -> { fileService.replaceVariablesInDirectoryName(repository.getLocalPath().toAbsolutePath().toString(), "${packageNameFolder}", programmingExercise.getPackageName()); fileService.replaceVariablesInFileName(repository.getLocalPath().toAbsolutePath().toString(), "${packageNameFile}", programmingExercise.getPackageName()); replacements.put("${packageName}", programmingExercise.getPackageName()); } case XCODE -> { fileService.replaceVariablesInDirectoryName(repository.getLocalPath().toAbsolutePath().toString(), "${appName}", programmingExercise.getPackageName()); fileService.replaceVariablesInFileName(repository.getLocalPath().toAbsolutePath().toString(), "${appName}", programmingExercise.getPackageName()); replacements.put("${appName}", programmingExercise.getPackageName()); } } } } replacements.put("${exerciseNamePomXml}", programmingExercise.getTitle().replaceAll(" ", "-")); replacements.put("${exerciseName}", programmingExercise.getTitle()); replacements.put("${studentWorkingDirectory}", Constants.STUDENT_WORKING_DIRECTORY); replacements.put("${packaging}", programmingExercise.hasSequentialTestRuns() ? "pom" : "jar"); fileService.replaceVariablesInFileRecursive(repository.getLocalPath().toAbsolutePath().toString(), replacements); }
[ "public", "void", "replacePlaceholders", "(", "ProgrammingExercise", "programmingExercise", ",", "Repository", "repository", ")", "throws", "IOException", "{", "Map", "<", "String", ",", "String", ">", "replacements", "=", "new", "HashMap", "<", ">", "(", ")", ";", "ProgrammingLanguage", "programmingLanguage", "=", "programmingExercise", ".", "getProgrammingLanguage", "(", ")", ";", "ProjectType", "projectType", "=", "programmingExercise", ".", "getProjectType", "(", ")", ";", "switch", "(", "programmingLanguage", ")", "{", "case", "JAVA", ",", "KOTLIN", "->", "{", "fileService", ".", "replaceVariablesInDirectoryName", "(", "repository", ".", "getLocalPath", "(", ")", ".", "toAbsolutePath", "(", ")", ".", "toString", "(", ")", ",", "\"${packageNameFolder}\"", ",", "programmingExercise", ".", "getPackageFolderName", "(", ")", ")", ";", "replacements", ".", "put", "(", "\"${packageName}\"", ",", "programmingExercise", ".", "getPackageName", "(", ")", ")", ";", "}", "case", "SWIFT", "->", "{", "switch", "(", "projectType", ")", "{", "case", "PLAIN", "->", "{", "fileService", ".", "replaceVariablesInDirectoryName", "(", "repository", ".", "getLocalPath", "(", ")", ".", "toAbsolutePath", "(", ")", ".", "toString", "(", ")", ",", "\"${packageNameFolder}\"", ",", "programmingExercise", ".", "getPackageName", "(", ")", ")", ";", "fileService", ".", "replaceVariablesInFileName", "(", "repository", ".", "getLocalPath", "(", ")", ".", "toAbsolutePath", "(", ")", ".", "toString", "(", ")", ",", "\"${packageNameFile}\"", ",", "programmingExercise", ".", "getPackageName", "(", ")", ")", ";", "replacements", ".", "put", "(", "\"${packageName}\"", ",", "programmingExercise", ".", "getPackageName", "(", ")", ")", ";", "}", "case", "XCODE", "->", "{", "fileService", ".", "replaceVariablesInDirectoryName", "(", "repository", ".", "getLocalPath", "(", ")", ".", "toAbsolutePath", "(", ")", ".", "toString", "(", ")", ",", "\"${appName}\"", ",", "programmingExercise", ".", "getPackageName", "(", ")", ")", ";", "fileService", ".", "replaceVariablesInFileName", "(", "repository", ".", "getLocalPath", "(", ")", ".", "toAbsolutePath", "(", ")", ".", "toString", "(", ")", ",", "\"${appName}\"", ",", "programmingExercise", ".", "getPackageName", "(", ")", ")", ";", "replacements", ".", "put", "(", "\"${appName}\"", ",", "programmingExercise", ".", "getPackageName", "(", ")", ")", ";", "}", "}", "}", "}", "replacements", ".", "put", "(", "\"${exerciseNamePomXml}\"", ",", "programmingExercise", ".", "getTitle", "(", ")", ".", "replaceAll", "(", "\" \"", ",", "\"-\"", ")", ")", ";", "replacements", ".", "put", "(", "\"${exerciseName}\"", ",", "programmingExercise", ".", "getTitle", "(", ")", ")", ";", "replacements", ".", "put", "(", "\"${studentWorkingDirectory}\"", ",", "Constants", ".", "STUDENT_WORKING_DIRECTORY", ")", ";", "replacements", ".", "put", "(", "\"${packaging}\"", ",", "programmingExercise", ".", "hasSequentialTestRuns", "(", ")", "?", "\"pom\"", ":", "\"jar\"", ")", ";", "fileService", ".", "replaceVariablesInFileRecursive", "(", "repository", ".", "getLocalPath", "(", ")", ".", "toAbsolutePath", "(", ")", ".", "toString", "(", ")", ",", "replacements", ")", ";", "}" ]
Replace placeholders in repository files (e.g.
[ "Replace", "placeholders", "in", "repository", "files", "(", "e", ".", "g", "." ]
[ "// there is no need in python to replace package names", "// Used e.g. in artifactId" ]
[ { "param": "programmingExercise", "type": "ProgrammingExercise" }, { "param": "repository", "type": "Repository" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "programmingExercise", "type": "ProgrammingExercise", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "repository", "type": "Repository", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 918, 1453, 21098, 12, 9459, 11987, 424, 20603, 5402, 11987, 424, 20603, 16, 6281, 3352, 13, 1216, 1860, 288, 203, 3639, 1635, 32, 780, 16, 514, 34, 11413, 273, 394, 4317, 29667, 5621, 203, 3639, 13586, 11987, 3779, 5402, 11987, 3779, 273, 5402, 11987, 424, 20603, 18, 588, 9459, 11987, 3779, 5621, 203, 3639, 5420, 559, 1984, 559, 273, 5402, 11987, 424, 20603, 18, 588, 4109, 559, 5621, 203, 203, 3639, 1620, 261, 12890, 11987, 3779, 13, 288, 203, 5411, 648, 21227, 16, 1475, 1974, 20663, 317, 288, 203, 7734, 585, 1179, 18, 2079, 6158, 382, 2853, 461, 12, 9071, 18, 588, 2042, 743, 7675, 869, 10368, 743, 7675, 10492, 9334, 27214, 5610, 461, 3899, 1532, 16, 203, 13491, 5402, 11987, 424, 20603, 18, 588, 2261, 26169, 10663, 203, 7734, 11413, 18, 458, 2932, 18498, 5610, 461, 1532, 16, 5402, 11987, 424, 20603, 18, 588, 18308, 10663, 203, 5411, 289, 203, 5411, 648, 16392, 17925, 317, 288, 203, 7734, 1620, 261, 4406, 559, 13, 288, 203, 10792, 648, 25564, 706, 317, 288, 203, 13491, 585, 1179, 18, 2079, 6158, 382, 2853, 461, 12, 9071, 18, 588, 2042, 743, 7675, 869, 10368, 743, 7675, 10492, 9334, 27214, 5610, 461, 3899, 1532, 16, 203, 27573, 5402, 11987, 424, 20603, 18, 588, 18308, 10663, 203, 13491, 585, 1179, 18, 2079, 6158, 382, 4771, 12, 9071, 18, 588, 2042, 743, 7675, 869, 10368, 743, 7675, 10492, 9334, 27214, 5610, 461, 812, 1532, 16, 5402, 11987, 424, 20603, 18, 588, 18308, 10663, 203, 13491, 11413, 18, 458, 2932, 18498, 5610, 461, 1532, 16, 5402, 11987, 424, 20603, 18, 588, 18308, 10663, 203, 10792, 289, 203, 10792, 648, 1139, 5572, 317, 288, 203, 13491, 585, 1179, 18, 2079, 6158, 382, 2853, 461, 12, 9071, 18, 588, 2042, 743, 7675, 869, 10368, 743, 7675, 10492, 9334, 27214, 2910, 461, 1532, 16, 5402, 11987, 424, 20603, 18, 588, 18308, 10663, 203, 13491, 585, 1179, 18, 2079, 6158, 382, 4771, 12, 9071, 18, 588, 2042, 743, 7675, 869, 10368, 743, 7675, 10492, 9334, 27214, 2910, 461, 1532, 16, 5402, 11987, 424, 20603, 18, 588, 18308, 10663, 203, 13491, 11413, 18, 458, 2932, 18498, 2910, 461, 1532, 16, 5402, 11987, 424, 20603, 18, 588, 18308, 10663, 203, 10792, 289, 203, 7734, 289, 203, 5411, 289, 203, 3639, 289, 203, 203, 3639, 368, 1915, 353, 1158, 1608, 316, 5790, 358, 1453, 2181, 1257, 203, 203, 3639, 11413, 18, 458, 2932, 18498, 8913, 30708, 461, 52, 362, 4432, 1532, 16, 5402, 11987, 424, 20603, 18, 588, 4247, 7675, 2079, 1595, 2932, 3104, 7514, 10019, 368, 10286, 425, 18, 75, 18, 316, 25496, 203, 3639, 11413, 18, 458, 2932, 18498, 8913, 30708, 461, 1532, 16, 5402, 11987, 424, 20603, 18, 588, 4247, 10663, 203, 3639, 11413, 18, 458, 2932, 18498, 26240, 14836, 2853, 1532, 16, 5245, 18, 882, 12587, 2222, 67, 10566, 1360, 67, 17229, 1769, 203, 3639, 11413, 18, 458, 2932, 18498, 2920, 5755, 1532, 16, 5402, 11987, 424, 20603, 18, 5332, 28241, 4709, 9361, 1435, 692, 315, 84, 362, 6, 294, 315, 11930, 8863, 203, 3639, 2 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
[ 1, 26873, 203, 377, 380, 6910, 12150, 316, 3352, 1390, 261, 73, 18, 75, 18, 3531, 12988, 97, 2934, 203, 377, 380, 203, 377, 380, 632, 891, 5402, 11987, 424, 20603, 1021, 3746, 5402, 11987, 24165, 203, 377, 380, 632, 891, 3352, 1850, 1021, 3352, 316, 1492, 326, 12150, 1410, 336, 8089, 203, 377, 380, 632, 15069, 1860, 971, 13993, 326, 1867, 508, 16, 578, 585, 3152, 1216, 392, 1520, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
0096f1c99fe7457cdf8be6a17e991d754a6fbd78
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/service/programming/ProgrammingExerciseService.java
[ "MIT" ]
Java
updateTimeline
ProgrammingExercise
public ProgrammingExercise updateTimeline(ProgrammingExercise updatedProgrammingExercise, @Nullable String notificationText) { var programmingExercise = programmingExerciseRepository.findByIdElseThrow(updatedProgrammingExercise.getId()); programmingExercise.setReleaseDate(updatedProgrammingExercise.getReleaseDate()); programmingExercise.setDueDate(updatedProgrammingExercise.getDueDate()); programmingExercise.setBuildAndTestStudentSubmissionsAfterDueDate(updatedProgrammingExercise.getBuildAndTestStudentSubmissionsAfterDueDate()); programmingExercise.setAssessmentType(updatedProgrammingExercise.getAssessmentType()); programmingExercise.setAssessmentDueDate(updatedProgrammingExercise.getAssessmentDueDate()); ProgrammingExercise savedProgrammingExercise = programmingExerciseRepository.save(programmingExercise); if (notificationText != null) { groupNotificationService.notifyStudentAndEditorAndInstructorGroupAboutExerciseUpdate(updatedProgrammingExercise, notificationText); } return savedProgrammingExercise; }
/** * Updates the timeline attributes of the given programming exercise * @param updatedProgrammingExercise containing the changes that have to be saved * @param notificationText optional text for a notification to all students about the update * @return the updated ProgrammingExercise object. */
Updates the timeline attributes of the given programming exercise @param updatedProgrammingExercise containing the changes that have to be saved @param notificationText optional text for a notification to all students about the update @return the updated ProgrammingExercise object.
[ "Updates", "the", "timeline", "attributes", "of", "the", "given", "programming", "exercise", "@param", "updatedProgrammingExercise", "containing", "the", "changes", "that", "have", "to", "be", "saved", "@param", "notificationText", "optional", "text", "for", "a", "notification", "to", "all", "students", "about", "the", "update", "@return", "the", "updated", "ProgrammingExercise", "object", "." ]
public ProgrammingExercise updateTimeline(ProgrammingExercise updatedProgrammingExercise, @Nullable String notificationText) { var programmingExercise = programmingExerciseRepository.findByIdElseThrow(updatedProgrammingExercise.getId()); programmingExercise.setReleaseDate(updatedProgrammingExercise.getReleaseDate()); programmingExercise.setDueDate(updatedProgrammingExercise.getDueDate()); programmingExercise.setBuildAndTestStudentSubmissionsAfterDueDate(updatedProgrammingExercise.getBuildAndTestStudentSubmissionsAfterDueDate()); programmingExercise.setAssessmentType(updatedProgrammingExercise.getAssessmentType()); programmingExercise.setAssessmentDueDate(updatedProgrammingExercise.getAssessmentDueDate()); ProgrammingExercise savedProgrammingExercise = programmingExerciseRepository.save(programmingExercise); if (notificationText != null) { groupNotificationService.notifyStudentAndEditorAndInstructorGroupAboutExerciseUpdate(updatedProgrammingExercise, notificationText); } return savedProgrammingExercise; }
[ "public", "ProgrammingExercise", "updateTimeline", "(", "ProgrammingExercise", "updatedProgrammingExercise", ",", "@", "Nullable", "String", "notificationText", ")", "{", "var", "programmingExercise", "=", "programmingExerciseRepository", ".", "findByIdElseThrow", "(", "updatedProgrammingExercise", ".", "getId", "(", ")", ")", ";", "programmingExercise", ".", "setReleaseDate", "(", "updatedProgrammingExercise", ".", "getReleaseDate", "(", ")", ")", ";", "programmingExercise", ".", "setDueDate", "(", "updatedProgrammingExercise", ".", "getDueDate", "(", ")", ")", ";", "programmingExercise", ".", "setBuildAndTestStudentSubmissionsAfterDueDate", "(", "updatedProgrammingExercise", ".", "getBuildAndTestStudentSubmissionsAfterDueDate", "(", ")", ")", ";", "programmingExercise", ".", "setAssessmentType", "(", "updatedProgrammingExercise", ".", "getAssessmentType", "(", ")", ")", ";", "programmingExercise", ".", "setAssessmentDueDate", "(", "updatedProgrammingExercise", ".", "getAssessmentDueDate", "(", ")", ")", ";", "ProgrammingExercise", "savedProgrammingExercise", "=", "programmingExerciseRepository", ".", "save", "(", "programmingExercise", ")", ";", "if", "(", "notificationText", "!=", "null", ")", "{", "groupNotificationService", ".", "notifyStudentAndEditorAndInstructorGroupAboutExerciseUpdate", "(", "updatedProgrammingExercise", ",", "notificationText", ")", ";", "}", "return", "savedProgrammingExercise", ";", "}" ]
Updates the timeline attributes of the given programming exercise @param updatedProgrammingExercise containing the changes that have to be saved @param notificationText optional text for a notification to all students about the update @return the updated ProgrammingExercise object.
[ "Updates", "the", "timeline", "attributes", "of", "the", "given", "programming", "exercise", "@param", "updatedProgrammingExercise", "containing", "the", "changes", "that", "have", "to", "be", "saved", "@param", "notificationText", "optional", "text", "for", "a", "notification", "to", "all", "students", "about", "the", "update", "@return", "the", "updated", "ProgrammingExercise", "object", "." ]
[]
[ { "param": "updatedProgrammingExercise", "type": "ProgrammingExercise" }, { "param": "notificationText", "type": "String" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "updatedProgrammingExercise", "type": "ProgrammingExercise", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "notificationText", "type": "String", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 13586, 11987, 424, 20603, 1089, 31914, 12, 9459, 11987, 424, 20603, 3526, 9459, 11987, 424, 20603, 16, 632, 13349, 514, 3851, 1528, 13, 288, 203, 203, 3639, 569, 5402, 11987, 424, 20603, 273, 5402, 11987, 424, 20603, 3305, 18, 4720, 5132, 12427, 8282, 12, 7007, 9459, 11987, 424, 20603, 18, 26321, 10663, 203, 3639, 5402, 11987, 424, 20603, 18, 542, 7391, 1626, 12, 7007, 9459, 11987, 424, 20603, 18, 588, 7391, 1626, 10663, 203, 3639, 5402, 11987, 424, 20603, 18, 542, 30023, 1626, 12, 7007, 9459, 11987, 424, 20603, 18, 588, 30023, 1626, 10663, 203, 3639, 5402, 11987, 424, 20603, 18, 542, 3116, 1876, 4709, 19943, 319, 1676, 7300, 4436, 30023, 1626, 12, 7007, 9459, 11987, 424, 20603, 18, 588, 3116, 1876, 4709, 19943, 319, 1676, 7300, 4436, 30023, 1626, 10663, 203, 3639, 5402, 11987, 424, 20603, 18, 542, 15209, 559, 12, 7007, 9459, 11987, 424, 20603, 18, 588, 15209, 559, 10663, 203, 3639, 5402, 11987, 424, 20603, 18, 542, 15209, 30023, 1626, 12, 7007, 9459, 11987, 424, 20603, 18, 588, 15209, 30023, 1626, 10663, 203, 3639, 13586, 11987, 424, 20603, 5198, 9459, 11987, 424, 20603, 273, 5402, 11987, 424, 20603, 3305, 18, 5688, 12, 12890, 11987, 424, 20603, 1769, 203, 3639, 309, 261, 9927, 1528, 480, 446, 13, 288, 203, 5411, 1041, 4386, 1179, 18, 12336, 19943, 319, 1876, 6946, 1876, 382, 2732, 1114, 24813, 424, 20603, 1891, 12, 7007, 9459, 11987, 424, 20603, 16, 3851, 1528, 1769, 203, 3639, 289, 203, 3639, 327, 5198, 9459, 11987, 424, 20603, 31, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 15419, 326, 18316, 1677, 434, 326, 864, 5402, 11987, 24165, 203, 377, 380, 632, 891, 3526, 9459, 11987, 424, 20603, 4191, 326, 3478, 716, 1240, 358, 506, 5198, 203, 377, 380, 632, 891, 3851, 1528, 3129, 977, 364, 279, 3851, 358, 777, 10068, 4877, 2973, 326, 1089, 203, 377, 380, 632, 2463, 326, 3526, 13586, 11987, 424, 20603, 733, 18, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
0096f1c99fe7457cdf8be6a17e991d754a6fbd78
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/service/programming/ProgrammingExerciseService.java
[ "MIT" ]
Java
updateProblemStatement
ProgrammingExercise
public ProgrammingExercise updateProblemStatement(ProgrammingExercise programmingExercise, String problemStatement, @Nullable String notificationText) throws EntityNotFoundException { programmingExercise.setProblemStatement(problemStatement); ProgrammingExercise updatedProgrammingExercise = programmingExerciseRepository.save(programmingExercise); if (notificationText != null) { groupNotificationService.notifyStudentAndEditorAndInstructorGroupAboutExerciseUpdate(updatedProgrammingExercise, notificationText); } return updatedProgrammingExercise; }
/** * Updates the problem statement of the given programming exercise. * * @param programmingExercise The ProgrammingExercise of which the problem statement is updated. * @param problemStatement markdown of the problem statement. * @param notificationText optional text for a notification to all students about the update * @return the updated ProgrammingExercise object. * @throws EntityNotFoundException if there is no ProgrammingExercise for the given id. */
Updates the problem statement of the given programming exercise. @param programmingExercise The ProgrammingExercise of which the problem statement is updated. @param problemStatement markdown of the problem statement. @param notificationText optional text for a notification to all students about the update @return the updated ProgrammingExercise object. @throws EntityNotFoundException if there is no ProgrammingExercise for the given id.
[ "Updates", "the", "problem", "statement", "of", "the", "given", "programming", "exercise", ".", "@param", "programmingExercise", "The", "ProgrammingExercise", "of", "which", "the", "problem", "statement", "is", "updated", ".", "@param", "problemStatement", "markdown", "of", "the", "problem", "statement", ".", "@param", "notificationText", "optional", "text", "for", "a", "notification", "to", "all", "students", "about", "the", "update", "@return", "the", "updated", "ProgrammingExercise", "object", ".", "@throws", "EntityNotFoundException", "if", "there", "is", "no", "ProgrammingExercise", "for", "the", "given", "id", "." ]
public ProgrammingExercise updateProblemStatement(ProgrammingExercise programmingExercise, String problemStatement, @Nullable String notificationText) throws EntityNotFoundException { programmingExercise.setProblemStatement(problemStatement); ProgrammingExercise updatedProgrammingExercise = programmingExerciseRepository.save(programmingExercise); if (notificationText != null) { groupNotificationService.notifyStudentAndEditorAndInstructorGroupAboutExerciseUpdate(updatedProgrammingExercise, notificationText); } return updatedProgrammingExercise; }
[ "public", "ProgrammingExercise", "updateProblemStatement", "(", "ProgrammingExercise", "programmingExercise", ",", "String", "problemStatement", ",", "@", "Nullable", "String", "notificationText", ")", "throws", "EntityNotFoundException", "{", "programmingExercise", ".", "setProblemStatement", "(", "problemStatement", ")", ";", "ProgrammingExercise", "updatedProgrammingExercise", "=", "programmingExerciseRepository", ".", "save", "(", "programmingExercise", ")", ";", "if", "(", "notificationText", "!=", "null", ")", "{", "groupNotificationService", ".", "notifyStudentAndEditorAndInstructorGroupAboutExerciseUpdate", "(", "updatedProgrammingExercise", ",", "notificationText", ")", ";", "}", "return", "updatedProgrammingExercise", ";", "}" ]
Updates the problem statement of the given programming exercise.
[ "Updates", "the", "problem", "statement", "of", "the", "given", "programming", "exercise", "." ]
[]
[ { "param": "programmingExercise", "type": "ProgrammingExercise" }, { "param": "problemStatement", "type": "String" }, { "param": "notificationText", "type": "String" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "programmingExercise", "type": "ProgrammingExercise", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "problemStatement", "type": "String", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "notificationText", "type": "String", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 13586, 11987, 424, 20603, 1089, 13719, 3406, 12, 9459, 11987, 424, 20603, 5402, 11987, 424, 20603, 16, 514, 6199, 3406, 16, 632, 13349, 514, 3851, 1528, 13, 203, 5411, 1216, 3887, 3990, 288, 203, 203, 3639, 5402, 11987, 424, 20603, 18, 542, 13719, 3406, 12, 18968, 3406, 1769, 203, 3639, 13586, 11987, 424, 20603, 3526, 9459, 11987, 424, 20603, 273, 5402, 11987, 424, 20603, 3305, 18, 5688, 12, 12890, 11987, 424, 20603, 1769, 203, 3639, 309, 261, 9927, 1528, 480, 446, 13, 288, 203, 5411, 1041, 4386, 1179, 18, 12336, 19943, 319, 1876, 6946, 1876, 382, 2732, 1114, 24813, 424, 20603, 1891, 12, 7007, 9459, 11987, 424, 20603, 16, 3851, 1528, 1769, 203, 3639, 289, 203, 3639, 327, 3526, 9459, 11987, 424, 20603, 31, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 15419, 326, 6199, 3021, 434, 326, 864, 5402, 11987, 24165, 18, 203, 377, 380, 203, 377, 380, 632, 891, 5402, 11987, 424, 20603, 282, 1021, 13586, 11987, 424, 20603, 434, 1492, 326, 6199, 3021, 353, 3526, 18, 203, 377, 380, 632, 891, 6199, 3406, 1377, 12737, 434, 326, 6199, 3021, 18, 203, 377, 380, 632, 891, 3851, 1528, 1377, 3129, 977, 364, 279, 3851, 358, 777, 10068, 4877, 2973, 326, 1089, 203, 377, 380, 632, 2463, 326, 3526, 13586, 11987, 424, 20603, 733, 18, 203, 377, 380, 632, 15069, 3887, 3990, 309, 1915, 353, 1158, 13586, 11987, 424, 20603, 364, 326, 864, 612, 18, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
0096f1c99fe7457cdf8be6a17e991d754a6fbd78
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/service/programming/ProgrammingExerciseService.java
[ "MIT" ]
Java
generateStructureOracleFile
null
public boolean generateStructureOracleFile(VcsRepositoryUrl solutionRepoURL, VcsRepositoryUrl exerciseRepoURL, VcsRepositoryUrl testRepoURL, String testsPath, User user) throws IOException, GitAPIException, InterruptedException { Repository solutionRepository = gitService.getOrCheckoutRepository(solutionRepoURL, true); Repository exerciseRepository = gitService.getOrCheckoutRepository(exerciseRepoURL, true); Repository testRepository = gitService.getOrCheckoutRepository(testRepoURL, true); gitService.resetToOriginHead(solutionRepository); gitService.pullIgnoreConflicts(solutionRepository); gitService.resetToOriginHead(exerciseRepository); gitService.pullIgnoreConflicts(exerciseRepository); gitService.resetToOriginHead(testRepository); gitService.pullIgnoreConflicts(testRepository); Path solutionRepositoryPath = solutionRepository.getLocalPath().toRealPath(); Path exerciseRepositoryPath = exerciseRepository.getLocalPath().toRealPath(); Path structureOraclePath = Paths.get(testRepository.getLocalPath().toRealPath().toString(), testsPath, "test.json"); String structureOracleJSON = OracleGenerator.generateStructureOracleJSON(solutionRepositoryPath, exerciseRepositoryPath); return saveAndPushStructuralOracle(user, testRepository, structureOraclePath, structureOracleJSON); }
/** * This method calls the StructureOracleGenerator, generates the string out of the JSON representation of the structure oracle of the programming exercise and returns true if * the file was updated or generated, false otherwise. This can happen if the contents of the file have not changed. * * @param solutionRepoURL The URL of the solution repository. * @param exerciseRepoURL The URL of the exercise repository. * @param testRepoURL The URL of the tests repository. * @param testsPath The path to the tests folder, e.g. the path inside the repository where the structure oracle file will be saved in. * @param user The user who has initiated the action * @return True, if the structure oracle was successfully generated or updated, false if no changes to the file were made. * @throws IOException If the URLs cannot be converted to actual {@link Path paths} * @throws InterruptedException If the checkout fails * @throws GitAPIException If the checkout fails */
This method calls the StructureOracleGenerator, generates the string out of the JSON representation of the structure oracle of the programming exercise and returns true if the file was updated or generated, false otherwise. This can happen if the contents of the file have not changed. @param solutionRepoURL The URL of the solution repository. @param exerciseRepoURL The URL of the exercise repository. @param testRepoURL The URL of the tests repository. @param testsPath The path to the tests folder, e.g. the path inside the repository where the structure oracle file will be saved in. @param user The user who has initiated the action @return True, if the structure oracle was successfully generated or updated, false if no changes to the file were made. @throws IOException If the URLs cannot be converted to actual Path paths @throws InterruptedException If the checkout fails @throws GitAPIException If the checkout fails
[ "This", "method", "calls", "the", "StructureOracleGenerator", "generates", "the", "string", "out", "of", "the", "JSON", "representation", "of", "the", "structure", "oracle", "of", "the", "programming", "exercise", "and", "returns", "true", "if", "the", "file", "was", "updated", "or", "generated", "false", "otherwise", ".", "This", "can", "happen", "if", "the", "contents", "of", "the", "file", "have", "not", "changed", ".", "@param", "solutionRepoURL", "The", "URL", "of", "the", "solution", "repository", ".", "@param", "exerciseRepoURL", "The", "URL", "of", "the", "exercise", "repository", ".", "@param", "testRepoURL", "The", "URL", "of", "the", "tests", "repository", ".", "@param", "testsPath", "The", "path", "to", "the", "tests", "folder", "e", ".", "g", ".", "the", "path", "inside", "the", "repository", "where", "the", "structure", "oracle", "file", "will", "be", "saved", "in", ".", "@param", "user", "The", "user", "who", "has", "initiated", "the", "action", "@return", "True", "if", "the", "structure", "oracle", "was", "successfully", "generated", "or", "updated", "false", "if", "no", "changes", "to", "the", "file", "were", "made", ".", "@throws", "IOException", "If", "the", "URLs", "cannot", "be", "converted", "to", "actual", "Path", "paths", "@throws", "InterruptedException", "If", "the", "checkout", "fails", "@throws", "GitAPIException", "If", "the", "checkout", "fails" ]
public boolean generateStructureOracleFile(VcsRepositoryUrl solutionRepoURL, VcsRepositoryUrl exerciseRepoURL, VcsRepositoryUrl testRepoURL, String testsPath, User user) throws IOException, GitAPIException, InterruptedException { Repository solutionRepository = gitService.getOrCheckoutRepository(solutionRepoURL, true); Repository exerciseRepository = gitService.getOrCheckoutRepository(exerciseRepoURL, true); Repository testRepository = gitService.getOrCheckoutRepository(testRepoURL, true); gitService.resetToOriginHead(solutionRepository); gitService.pullIgnoreConflicts(solutionRepository); gitService.resetToOriginHead(exerciseRepository); gitService.pullIgnoreConflicts(exerciseRepository); gitService.resetToOriginHead(testRepository); gitService.pullIgnoreConflicts(testRepository); Path solutionRepositoryPath = solutionRepository.getLocalPath().toRealPath(); Path exerciseRepositoryPath = exerciseRepository.getLocalPath().toRealPath(); Path structureOraclePath = Paths.get(testRepository.getLocalPath().toRealPath().toString(), testsPath, "test.json"); String structureOracleJSON = OracleGenerator.generateStructureOracleJSON(solutionRepositoryPath, exerciseRepositoryPath); return saveAndPushStructuralOracle(user, testRepository, structureOraclePath, structureOracleJSON); }
[ "public", "boolean", "generateStructureOracleFile", "(", "VcsRepositoryUrl", "solutionRepoURL", ",", "VcsRepositoryUrl", "exerciseRepoURL", ",", "VcsRepositoryUrl", "testRepoURL", ",", "String", "testsPath", ",", "User", "user", ")", "throws", "IOException", ",", "GitAPIException", ",", "InterruptedException", "{", "Repository", "solutionRepository", "=", "gitService", ".", "getOrCheckoutRepository", "(", "solutionRepoURL", ",", "true", ")", ";", "Repository", "exerciseRepository", "=", "gitService", ".", "getOrCheckoutRepository", "(", "exerciseRepoURL", ",", "true", ")", ";", "Repository", "testRepository", "=", "gitService", ".", "getOrCheckoutRepository", "(", "testRepoURL", ",", "true", ")", ";", "gitService", ".", "resetToOriginHead", "(", "solutionRepository", ")", ";", "gitService", ".", "pullIgnoreConflicts", "(", "solutionRepository", ")", ";", "gitService", ".", "resetToOriginHead", "(", "exerciseRepository", ")", ";", "gitService", ".", "pullIgnoreConflicts", "(", "exerciseRepository", ")", ";", "gitService", ".", "resetToOriginHead", "(", "testRepository", ")", ";", "gitService", ".", "pullIgnoreConflicts", "(", "testRepository", ")", ";", "Path", "solutionRepositoryPath", "=", "solutionRepository", ".", "getLocalPath", "(", ")", ".", "toRealPath", "(", ")", ";", "Path", "exerciseRepositoryPath", "=", "exerciseRepository", ".", "getLocalPath", "(", ")", ".", "toRealPath", "(", ")", ";", "Path", "structureOraclePath", "=", "Paths", ".", "get", "(", "testRepository", ".", "getLocalPath", "(", ")", ".", "toRealPath", "(", ")", ".", "toString", "(", ")", ",", "testsPath", ",", "\"test.json\"", ")", ";", "String", "structureOracleJSON", "=", "OracleGenerator", ".", "generateStructureOracleJSON", "(", "solutionRepositoryPath", ",", "exerciseRepositoryPath", ")", ";", "return", "saveAndPushStructuralOracle", "(", "user", ",", "testRepository", ",", "structureOraclePath", ",", "structureOracleJSON", ")", ";", "}" ]
This method calls the StructureOracleGenerator, generates the string out of the JSON representation of the structure oracle of the programming exercise and returns true if the file was updated or generated, false otherwise.
[ "This", "method", "calls", "the", "StructureOracleGenerator", "generates", "the", "string", "out", "of", "the", "JSON", "representation", "of", "the", "structure", "oracle", "of", "the", "programming", "exercise", "and", "returns", "true", "if", "the", "file", "was", "updated", "or", "generated", "false", "otherwise", "." ]
[]
[ { "param": "solutionRepoURL", "type": "VcsRepositoryUrl" }, { "param": "exerciseRepoURL", "type": "VcsRepositoryUrl" }, { "param": "testRepoURL", "type": "VcsRepositoryUrl" }, { "param": "testsPath", "type": "String" }, { "param": "user", "type": "User" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "solutionRepoURL", "type": "VcsRepositoryUrl", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "exerciseRepoURL", "type": "VcsRepositoryUrl", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "testRepoURL", "type": "VcsRepositoryUrl", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "testsPath", "type": "String", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "user", "type": "User", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 1250, 2103, 6999, 23601, 812, 12, 58, 2143, 3305, 1489, 6959, 8791, 1785, 16, 776, 2143, 3305, 1489, 24165, 8791, 1785, 16, 776, 2143, 3305, 1489, 1842, 8791, 1785, 16, 514, 7434, 743, 16, 2177, 729, 13, 203, 5411, 1216, 1860, 16, 6646, 2557, 503, 16, 7558, 288, 203, 3639, 6281, 6959, 3305, 273, 5071, 1179, 18, 588, 1162, 18581, 3305, 12, 13385, 8791, 1785, 16, 638, 1769, 203, 3639, 6281, 24165, 3305, 273, 5071, 1179, 18, 588, 1162, 18581, 3305, 12, 8913, 30708, 8791, 1785, 16, 638, 1769, 203, 3639, 6281, 1842, 3305, 273, 5071, 1179, 18, 588, 1162, 18581, 3305, 12, 3813, 8791, 1785, 16, 638, 1769, 203, 203, 3639, 5071, 1179, 18, 6208, 774, 7571, 1414, 12, 13385, 3305, 1769, 203, 3639, 5071, 1179, 18, 13469, 3777, 30897, 12, 13385, 3305, 1769, 203, 3639, 5071, 1179, 18, 6208, 774, 7571, 1414, 12, 8913, 30708, 3305, 1769, 203, 3639, 5071, 1179, 18, 13469, 3777, 30897, 12, 8913, 30708, 3305, 1769, 203, 3639, 5071, 1179, 18, 6208, 774, 7571, 1414, 12, 3813, 3305, 1769, 203, 3639, 5071, 1179, 18, 13469, 3777, 30897, 12, 3813, 3305, 1769, 203, 203, 3639, 2666, 6959, 3305, 743, 273, 6959, 3305, 18, 588, 2042, 743, 7675, 869, 6955, 743, 5621, 203, 3639, 2666, 24165, 3305, 743, 273, 24165, 3305, 18, 588, 2042, 743, 7675, 869, 6955, 743, 5621, 203, 3639, 2666, 3695, 23601, 743, 273, 16643, 18, 588, 12, 3813, 3305, 18, 588, 2042, 743, 7675, 869, 6955, 743, 7675, 10492, 9334, 7434, 743, 16, 315, 3813, 18, 1977, 8863, 203, 203, 3639, 514, 3695, 23601, 2986, 273, 28544, 3908, 18, 7163, 6999, 23601, 2986, 12, 13385, 3305, 743, 16, 24165, 3305, 743, 1769, 203, 3639, 327, 1923, 1876, 7621, 14372, 23601, 12, 1355, 16, 1842, 3305, 16, 3695, 23601, 743, 16, 3695, 23601, 2986, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 629, 3541, 18, 1220, 848, 5865, 309, 326, 2939, 434, 326, 585, 1240, 486, 3550, 18, 203, 377, 380, 203, 377, 380, 632, 891, 6959, 8791, 1785, 1021, 1976, 434, 326, 6959, 3352, 18, 203, 377, 380, 632, 891, 24165, 8791, 1785, 1021, 1976, 434, 326, 24165, 3352, 18, 203, 377, 380, 632, 891, 1842, 8791, 1785, 377, 1021, 1976, 434, 326, 7434, 3352, 18, 203, 377, 380, 632, 891, 7434, 743, 4202, 1021, 589, 358, 326, 7434, 3009, 16, 425, 18, 75, 2 ]
0096f1c99fe7457cdf8be6a17e991d754a6fbd78
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/service/programming/ProgrammingExerciseService.java
[ "MIT" ]
Java
delete
null
@Transactional // ok public void delete(Long programmingExerciseId, boolean deleteBaseReposBuildPlans) { // TODO: This method does not accept a programming exercise to solve issues with nested Transactions. // It would be good to refactor the delete calls and move the validity checks down from the resources to the service methods (e.g. EntityNotFound). var programmingExercise = programmingExerciseRepository.findWithTemplateAndSolutionParticipationTeamAssignmentConfigCategoriesById(programmingExerciseId) .orElseThrow(() -> new EntityNotFoundException("Programming Exercise", programmingExerciseId)); final var templateRepositoryUrlAsUrl = programmingExercise.getVcsTemplateRepositoryUrl(); final var solutionRepositoryUrlAsUrl = programmingExercise.getVcsSolutionRepositoryUrl(); final var testRepositoryUrlAsUrl = programmingExercise.getVcsTestRepositoryUrl(); // This cancels scheduled tasks (like locking/unlocking repositories) // As the programming exercise might already be deleted once the scheduling node receives the message, only the // id is used to cancel the scheduling. No interaction with the database is required. cancelScheduledOperations(programmingExercise.getId()); if (deleteBaseReposBuildPlans) { final var templateBuildPlanId = programmingExercise.getTemplateBuildPlanId(); if (templateBuildPlanId != null) { continuousIntegrationService.get().deleteBuildPlan(programmingExercise.getProjectKey(), templateBuildPlanId); } final var solutionBuildPlanId = programmingExercise.getSolutionBuildPlanId(); if (solutionBuildPlanId != null) { continuousIntegrationService.get().deleteBuildPlan(programmingExercise.getProjectKey(), solutionBuildPlanId); } continuousIntegrationService.get().deleteProject(programmingExercise.getProjectKey()); if (programmingExercise.getTemplateRepositoryUrl() != null) { versionControlService.get().deleteRepository(templateRepositoryUrlAsUrl); } if (programmingExercise.getSolutionRepositoryUrl() != null) { versionControlService.get().deleteRepository(solutionRepositoryUrlAsUrl); } if (programmingExercise.getTestRepositoryUrl() != null) { versionControlService.get().deleteRepository(testRepositoryUrlAsUrl); } // We also want to delete any auxiliary repositories programmingExercise.getAuxiliaryRepositories().forEach(repo -> { if (repo.getRepositoryUrl() != null) { versionControlService.get().deleteRepository(repo.getVcsRepositoryUrl()); } }); versionControlService.get().deleteProject(programmingExercise.getProjectKey()); } /* * Always delete the local copies of the repository because they can (in theory) be restored by cloning again, but they block the creation of new programming exercises with * the same short name as a deleted one. The instructors might have missed selecting deleteBaseReposBuildPlans, and delete those manually later. This however leaves no * chance to remove the Artemis-local repositories on the server. In summary, they should and can always be deleted. */ if (programmingExercise.getTemplateRepositoryUrl() != null) { gitService.deleteLocalRepository(templateRepositoryUrlAsUrl); } if (programmingExercise.getSolutionRepositoryUrl() != null) { gitService.deleteLocalRepository(solutionRepositoryUrlAsUrl); } if (programmingExercise.getTestRepositoryUrl() != null) { gitService.deleteLocalRepository(testRepositoryUrlAsUrl); } SolutionProgrammingExerciseParticipation solutionProgrammingExerciseParticipation = programmingExercise.getSolutionParticipation(); TemplateProgrammingExerciseParticipation templateProgrammingExerciseParticipation = programmingExercise.getTemplateParticipation(); if (solutionProgrammingExerciseParticipation != null) { participationService.deleteResultsAndSubmissionsOfParticipation(solutionProgrammingExerciseParticipation.getId()); } if (templateProgrammingExerciseParticipation != null) { participationService.deleteResultsAndSubmissionsOfParticipation(templateProgrammingExerciseParticipation.getId()); } // This will also delete the template & solution participation. programmingExerciseRepository.delete(programmingExercise); }
/** * Delete a programming exercise, including its template and solution participations. * * @param programmingExerciseId id of the programming exercise to delete. * @param deleteBaseReposBuildPlans if true will also delete build plans and projects. */
Delete a programming exercise, including its template and solution participations. @param programmingExerciseId id of the programming exercise to delete. @param deleteBaseReposBuildPlans if true will also delete build plans and projects.
[ "Delete", "a", "programming", "exercise", "including", "its", "template", "and", "solution", "participations", ".", "@param", "programmingExerciseId", "id", "of", "the", "programming", "exercise", "to", "delete", ".", "@param", "deleteBaseReposBuildPlans", "if", "true", "will", "also", "delete", "build", "plans", "and", "projects", "." ]
@Transactional public void delete(Long programmingExerciseId, boolean deleteBaseReposBuildPlans) { var programmingExercise = programmingExerciseRepository.findWithTemplateAndSolutionParticipationTeamAssignmentConfigCategoriesById(programmingExerciseId) .orElseThrow(() -> new EntityNotFoundException("Programming Exercise", programmingExerciseId)); final var templateRepositoryUrlAsUrl = programmingExercise.getVcsTemplateRepositoryUrl(); final var solutionRepositoryUrlAsUrl = programmingExercise.getVcsSolutionRepositoryUrl(); final var testRepositoryUrlAsUrl = programmingExercise.getVcsTestRepositoryUrl(); cancelScheduledOperations(programmingExercise.getId()); if (deleteBaseReposBuildPlans) { final var templateBuildPlanId = programmingExercise.getTemplateBuildPlanId(); if (templateBuildPlanId != null) { continuousIntegrationService.get().deleteBuildPlan(programmingExercise.getProjectKey(), templateBuildPlanId); } final var solutionBuildPlanId = programmingExercise.getSolutionBuildPlanId(); if (solutionBuildPlanId != null) { continuousIntegrationService.get().deleteBuildPlan(programmingExercise.getProjectKey(), solutionBuildPlanId); } continuousIntegrationService.get().deleteProject(programmingExercise.getProjectKey()); if (programmingExercise.getTemplateRepositoryUrl() != null) { versionControlService.get().deleteRepository(templateRepositoryUrlAsUrl); } if (programmingExercise.getSolutionRepositoryUrl() != null) { versionControlService.get().deleteRepository(solutionRepositoryUrlAsUrl); } if (programmingExercise.getTestRepositoryUrl() != null) { versionControlService.get().deleteRepository(testRepositoryUrlAsUrl); } programmingExercise.getAuxiliaryRepositories().forEach(repo -> { if (repo.getRepositoryUrl() != null) { versionControlService.get().deleteRepository(repo.getVcsRepositoryUrl()); } }); versionControlService.get().deleteProject(programmingExercise.getProjectKey()); } /* * Always delete the local copies of the repository because they can (in theory) be restored by cloning again, but they block the creation of new programming exercises with * the same short name as a deleted one. The instructors might have missed selecting deleteBaseReposBuildPlans, and delete those manually later. This however leaves no * chance to remove the Artemis-local repositories on the server. In summary, they should and can always be deleted. */ if (programmingExercise.getTemplateRepositoryUrl() != null) { gitService.deleteLocalRepository(templateRepositoryUrlAsUrl); } if (programmingExercise.getSolutionRepositoryUrl() != null) { gitService.deleteLocalRepository(solutionRepositoryUrlAsUrl); } if (programmingExercise.getTestRepositoryUrl() != null) { gitService.deleteLocalRepository(testRepositoryUrlAsUrl); } SolutionProgrammingExerciseParticipation solutionProgrammingExerciseParticipation = programmingExercise.getSolutionParticipation(); TemplateProgrammingExerciseParticipation templateProgrammingExerciseParticipation = programmingExercise.getTemplateParticipation(); if (solutionProgrammingExerciseParticipation != null) { participationService.deleteResultsAndSubmissionsOfParticipation(solutionProgrammingExerciseParticipation.getId()); } if (templateProgrammingExerciseParticipation != null) { participationService.deleteResultsAndSubmissionsOfParticipation(templateProgrammingExerciseParticipation.getId()); } programmingExerciseRepository.delete(programmingExercise); }
[ "@", "Transactional", "public", "void", "delete", "(", "Long", "programmingExerciseId", ",", "boolean", "deleteBaseReposBuildPlans", ")", "{", "var", "programmingExercise", "=", "programmingExerciseRepository", ".", "findWithTemplateAndSolutionParticipationTeamAssignmentConfigCategoriesById", "(", "programmingExerciseId", ")", ".", "orElseThrow", "(", "(", ")", "->", "new", "EntityNotFoundException", "(", "\"Programming Exercise\"", ",", "programmingExerciseId", ")", ")", ";", "final", "var", "templateRepositoryUrlAsUrl", "=", "programmingExercise", ".", "getVcsTemplateRepositoryUrl", "(", ")", ";", "final", "var", "solutionRepositoryUrlAsUrl", "=", "programmingExercise", ".", "getVcsSolutionRepositoryUrl", "(", ")", ";", "final", "var", "testRepositoryUrlAsUrl", "=", "programmingExercise", ".", "getVcsTestRepositoryUrl", "(", ")", ";", "cancelScheduledOperations", "(", "programmingExercise", ".", "getId", "(", ")", ")", ";", "if", "(", "deleteBaseReposBuildPlans", ")", "{", "final", "var", "templateBuildPlanId", "=", "programmingExercise", ".", "getTemplateBuildPlanId", "(", ")", ";", "if", "(", "templateBuildPlanId", "!=", "null", ")", "{", "continuousIntegrationService", ".", "get", "(", ")", ".", "deleteBuildPlan", "(", "programmingExercise", ".", "getProjectKey", "(", ")", ",", "templateBuildPlanId", ")", ";", "}", "final", "var", "solutionBuildPlanId", "=", "programmingExercise", ".", "getSolutionBuildPlanId", "(", ")", ";", "if", "(", "solutionBuildPlanId", "!=", "null", ")", "{", "continuousIntegrationService", ".", "get", "(", ")", ".", "deleteBuildPlan", "(", "programmingExercise", ".", "getProjectKey", "(", ")", ",", "solutionBuildPlanId", ")", ";", "}", "continuousIntegrationService", ".", "get", "(", ")", ".", "deleteProject", "(", "programmingExercise", ".", "getProjectKey", "(", ")", ")", ";", "if", "(", "programmingExercise", ".", "getTemplateRepositoryUrl", "(", ")", "!=", "null", ")", "{", "versionControlService", ".", "get", "(", ")", ".", "deleteRepository", "(", "templateRepositoryUrlAsUrl", ")", ";", "}", "if", "(", "programmingExercise", ".", "getSolutionRepositoryUrl", "(", ")", "!=", "null", ")", "{", "versionControlService", ".", "get", "(", ")", ".", "deleteRepository", "(", "solutionRepositoryUrlAsUrl", ")", ";", "}", "if", "(", "programmingExercise", ".", "getTestRepositoryUrl", "(", ")", "!=", "null", ")", "{", "versionControlService", ".", "get", "(", ")", ".", "deleteRepository", "(", "testRepositoryUrlAsUrl", ")", ";", "}", "programmingExercise", ".", "getAuxiliaryRepositories", "(", ")", ".", "forEach", "(", "repo", "->", "{", "if", "(", "repo", ".", "getRepositoryUrl", "(", ")", "!=", "null", ")", "{", "versionControlService", ".", "get", "(", ")", ".", "deleteRepository", "(", "repo", ".", "getVcsRepositoryUrl", "(", ")", ")", ";", "}", "}", ")", ";", "versionControlService", ".", "get", "(", ")", ".", "deleteProject", "(", "programmingExercise", ".", "getProjectKey", "(", ")", ")", ";", "}", "/*\n * Always delete the local copies of the repository because they can (in theory) be restored by cloning again, but they block the creation of new programming exercises with\n * the same short name as a deleted one. The instructors might have missed selecting deleteBaseReposBuildPlans, and delete those manually later. This however leaves no\n * chance to remove the Artemis-local repositories on the server. In summary, they should and can always be deleted.\n */", "if", "(", "programmingExercise", ".", "getTemplateRepositoryUrl", "(", ")", "!=", "null", ")", "{", "gitService", ".", "deleteLocalRepository", "(", "templateRepositoryUrlAsUrl", ")", ";", "}", "if", "(", "programmingExercise", ".", "getSolutionRepositoryUrl", "(", ")", "!=", "null", ")", "{", "gitService", ".", "deleteLocalRepository", "(", "solutionRepositoryUrlAsUrl", ")", ";", "}", "if", "(", "programmingExercise", ".", "getTestRepositoryUrl", "(", ")", "!=", "null", ")", "{", "gitService", ".", "deleteLocalRepository", "(", "testRepositoryUrlAsUrl", ")", ";", "}", "SolutionProgrammingExerciseParticipation", "solutionProgrammingExerciseParticipation", "=", "programmingExercise", ".", "getSolutionParticipation", "(", ")", ";", "TemplateProgrammingExerciseParticipation", "templateProgrammingExerciseParticipation", "=", "programmingExercise", ".", "getTemplateParticipation", "(", ")", ";", "if", "(", "solutionProgrammingExerciseParticipation", "!=", "null", ")", "{", "participationService", ".", "deleteResultsAndSubmissionsOfParticipation", "(", "solutionProgrammingExerciseParticipation", ".", "getId", "(", ")", ")", ";", "}", "if", "(", "templateProgrammingExerciseParticipation", "!=", "null", ")", "{", "participationService", ".", "deleteResultsAndSubmissionsOfParticipation", "(", "templateProgrammingExerciseParticipation", ".", "getId", "(", ")", ")", ";", "}", "programmingExerciseRepository", ".", "delete", "(", "programmingExercise", ")", ";", "}" ]
Delete a programming exercise, including its template and solution participations.
[ "Delete", "a", "programming", "exercise", "including", "its", "template", "and", "solution", "participations", "." ]
[ "// ok", "// TODO: This method does not accept a programming exercise to solve issues with nested Transactions.", "// It would be good to refactor the delete calls and move the validity checks down from the resources to the service methods (e.g. EntityNotFound).", "// This cancels scheduled tasks (like locking/unlocking repositories)", "// As the programming exercise might already be deleted once the scheduling node receives the message, only the", "// id is used to cancel the scheduling. No interaction with the database is required.", "// We also want to delete any auxiliary repositories", "// This will also delete the template & solution participation." ]
[ { "param": "programmingExerciseId", "type": "Long" }, { "param": "deleteBaseReposBuildPlans", "type": "boolean" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "programmingExerciseId", "type": "Long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "deleteBaseReposBuildPlans", "type": "boolean", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 3342, 287, 368, 1529, 203, 565, 1071, 918, 1430, 12, 3708, 5402, 11987, 424, 20603, 548, 16, 1250, 1430, 2171, 28453, 3116, 22846, 13, 288, 203, 3639, 368, 2660, 30, 1220, 707, 1552, 486, 2791, 279, 5402, 11987, 24165, 358, 12439, 8296, 598, 4764, 27148, 18, 203, 3639, 368, 2597, 4102, 506, 7494, 358, 26627, 326, 1430, 4097, 471, 3635, 326, 13800, 4271, 2588, 628, 326, 2703, 358, 326, 1156, 2590, 261, 73, 18, 75, 18, 3887, 2768, 2934, 203, 3639, 569, 5402, 11987, 424, 20603, 273, 5402, 11987, 424, 20603, 3305, 18, 4720, 1190, 2283, 1876, 16135, 1988, 24629, 367, 8689, 7729, 809, 10487, 5132, 12, 12890, 11987, 424, 20603, 548, 13, 203, 7734, 263, 280, 12427, 8282, 12, 1435, 317, 394, 3887, 3990, 2932, 9459, 11987, 1312, 20603, 3113, 5402, 11987, 424, 20603, 548, 10019, 203, 3639, 727, 569, 1542, 3305, 1489, 1463, 1489, 273, 5402, 11987, 424, 20603, 18, 588, 58, 2143, 2283, 3305, 1489, 5621, 203, 3639, 727, 569, 6959, 3305, 1489, 1463, 1489, 273, 5402, 11987, 424, 20603, 18, 588, 58, 2143, 16135, 3305, 1489, 5621, 203, 3639, 727, 569, 1842, 3305, 1489, 1463, 1489, 273, 5402, 11987, 424, 20603, 18, 588, 58, 2143, 4709, 3305, 1489, 5621, 203, 203, 3639, 368, 1220, 3755, 87, 9755, 4592, 261, 5625, 18887, 19, 26226, 310, 14531, 13, 203, 3639, 368, 2970, 326, 5402, 11987, 24165, 4825, 1818, 506, 4282, 3647, 326, 21895, 756, 17024, 326, 883, 16, 1338, 326, 203, 3639, 368, 612, 353, 1399, 358, 3755, 326, 21895, 18, 2631, 13581, 598, 326, 2063, 353, 1931, 18, 203, 3639, 3755, 10660, 9343, 12, 12890, 11987, 424, 20603, 18, 26321, 10663, 203, 203, 3639, 309, 261, 3733, 2171, 28453, 3116, 22846, 13, 288, 203, 5411, 727, 569, 1542, 3116, 5365, 548, 273, 5402, 11987, 424, 20603, 18, 588, 2283, 3116, 5365, 548, 5621, 203, 5411, 309, 261, 3202, 3116, 5365, 548, 480, 446, 13, 288, 203, 7734, 17235, 15372, 1179, 18, 588, 7675, 3733, 3116, 5365, 12, 12890, 11987, 424, 20603, 18, 588, 4109, 653, 9334, 1542, 3116, 5365, 548, 1769, 203, 5411, 289, 203, 5411, 727, 569, 6959, 3116, 5365, 548, 273, 5402, 11987, 424, 20603, 18, 588, 16135, 3116, 5365, 548, 5621, 203, 5411, 309, 261, 13385, 3116, 5365, 548, 480, 446, 13, 288, 203, 7734, 17235, 15372, 1179, 18, 588, 7675, 3733, 3116, 5365, 12, 12890, 11987, 424, 20603, 18, 588, 4109, 653, 9334, 6959, 3116, 5365, 548, 1769, 203, 5411, 289, 203, 5411, 17235, 15372, 1179, 18, 588, 7675, 3733, 4109, 12, 12890, 11987, 424, 20603, 18, 588, 4109, 653, 10663, 203, 203, 5411, 309, 261, 12890, 11987, 424, 20603, 18, 588, 2283, 3305, 1489, 1435, 480, 446, 13, 288, 203, 7734, 1177, 3367, 1179, 18, 588, 7675, 3733, 3305, 12, 3202, 3305, 1489, 1463, 1489, 1769, 203, 5411, 289, 203, 5411, 309, 261, 12890, 11987, 424, 20603, 18, 588, 16135, 3305, 1489, 1435, 480, 446, 13, 288, 203, 7734, 1177, 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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
[ 1, 26873, 203, 377, 380, 2504, 279, 5402, 11987, 24165, 16, 6508, 2097, 1542, 471, 6959, 30891, 1012, 18, 203, 377, 380, 203, 377, 380, 632, 891, 5402, 11987, 424, 20603, 548, 377, 612, 434, 326, 5402, 11987, 24165, 358, 1430, 18, 203, 377, 380, 632, 891, 1430, 2171, 28453, 3116, 22846, 309, 638, 903, 2546, 1430, 1361, 21440, 471, 10137, 18, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
b4282fff8741271bf4388a976e801963def16126
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/web/rest/QuizExerciseResource.java
[ "MIT" ]
Java
createQuizExercise
null
@PostMapping("/quiz-exercises") @PreAuthorize("hasRole('EDITOR')") public ResponseEntity<QuizExercise> createQuizExercise(@RequestBody QuizExercise quizExercise) throws URISyntaxException { log.debug("REST request to create QuizExercise : {}", quizExercise); if (quizExercise.getId() != null) { return ResponseEntity.badRequest() .headers(HeaderUtil.createFailureAlert(applicationName, true, ENTITY_NAME, "idexists", "A new quizExercise cannot already have an ID")).body(null); } // check if quiz is valid if (!quizExercise.isValid()) { // TODO: improve error message and tell the client why the quiz is invalid (also see below in update Quiz) return ResponseEntity.badRequest().headers(HeaderUtil.createFailureAlert(applicationName, true, ENTITY_NAME, "invalidQuiz", "The quiz exercise is invalid")).body(null); } exerciseService.validateScoreSettings(quizExercise); // Valid exercises have set either a course or an exerciseGroup quizExercise.checkCourseAndExerciseGroupExclusivity(ENTITY_NAME); // Retrieve the course over the exerciseGroup or the given courseId Course course = courseService.retrieveCourseOverExerciseGroupOrCourseId(quizExercise); // Check that the user is authorized to create the exercise User user = userRepository.getUserWithGroupsAndAuthorities(); if (!authCheckService.isAtLeastEditorInCourse(course, user)) { return forbidden(); } quizExercise = quizExerciseService.save(quizExercise); // Only notify students and tutors if the exercise is created for a course if (quizExercise.isCourseExercise()) { // notify websocket channel of changes to the quiz exercise quizMessagingService.sendQuizExerciseToSubscribedClients(quizExercise, "change"); instanceMessageSendService.sendExerciseReleaseNotificationSchedule(quizExercise.getId()); } return ResponseEntity.created(new URI("/api/quiz-exercises/" + quizExercise.getId())) .headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, quizExercise.getId().toString())).body(quizExercise); }
/** * POST /quiz-exercises : Create a new quizExercise. * * @param quizExercise the quizExercise to create * @return the ResponseEntity with status 201 (Created) and with body the new quizExercise, or with status 400 (Bad Request) if the quizExercise has already an ID * @throws URISyntaxException if the Location URI syntax is incorrect */
POST /quiz-exercises : Create a new quizExercise. @param quizExercise the quizExercise to create @return the ResponseEntity with status 201 (Created) and with body the new quizExercise, or with status 400 (Bad Request) if the quizExercise has already an ID @throws URISyntaxException if the Location URI syntax is incorrect
[ "POST", "/", "quiz", "-", "exercises", ":", "Create", "a", "new", "quizExercise", ".", "@param", "quizExercise", "the", "quizExercise", "to", "create", "@return", "the", "ResponseEntity", "with", "status", "201", "(", "Created", ")", "and", "with", "body", "the", "new", "quizExercise", "or", "with", "status", "400", "(", "Bad", "Request", ")", "if", "the", "quizExercise", "has", "already", "an", "ID", "@throws", "URISyntaxException", "if", "the", "Location", "URI", "syntax", "is", "incorrect" ]
@PostMapping("/quiz-exercises") @PreAuthorize("hasRole('EDITOR')") public ResponseEntity<QuizExercise> createQuizExercise(@RequestBody QuizExercise quizExercise) throws URISyntaxException { log.debug("REST request to create QuizExercise : {}", quizExercise); if (quizExercise.getId() != null) { return ResponseEntity.badRequest() .headers(HeaderUtil.createFailureAlert(applicationName, true, ENTITY_NAME, "idexists", "A new quizExercise cannot already have an ID")).body(null); } if (!quizExercise.isValid()) { return ResponseEntity.badRequest().headers(HeaderUtil.createFailureAlert(applicationName, true, ENTITY_NAME, "invalidQuiz", "The quiz exercise is invalid")).body(null); } exerciseService.validateScoreSettings(quizExercise); quizExercise.checkCourseAndExerciseGroupExclusivity(ENTITY_NAME); Course course = courseService.retrieveCourseOverExerciseGroupOrCourseId(quizExercise); User user = userRepository.getUserWithGroupsAndAuthorities(); if (!authCheckService.isAtLeastEditorInCourse(course, user)) { return forbidden(); } quizExercise = quizExerciseService.save(quizExercise); if (quizExercise.isCourseExercise()) { quizMessagingService.sendQuizExerciseToSubscribedClients(quizExercise, "change"); instanceMessageSendService.sendExerciseReleaseNotificationSchedule(quizExercise.getId()); } return ResponseEntity.created(new URI("/api/quiz-exercises/" + quizExercise.getId())) .headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, quizExercise.getId().toString())).body(quizExercise); }
[ "@", "PostMapping", "(", "\"/quiz-exercises\"", ")", "@", "PreAuthorize", "(", "\"hasRole('EDITOR')\"", ")", "public", "ResponseEntity", "<", "QuizExercise", ">", "createQuizExercise", "(", "@", "RequestBody", "QuizExercise", "quizExercise", ")", "throws", "URISyntaxException", "{", "log", ".", "debug", "(", "\"REST request to create QuizExercise : {}\"", ",", "quizExercise", ")", ";", "if", "(", "quizExercise", ".", "getId", "(", ")", "!=", "null", ")", "{", "return", "ResponseEntity", ".", "badRequest", "(", ")", ".", "headers", "(", "HeaderUtil", ".", "createFailureAlert", "(", "applicationName", ",", "true", ",", "ENTITY_NAME", ",", "\"idexists\"", ",", "\"A new quizExercise cannot already have an ID\"", ")", ")", ".", "body", "(", "null", ")", ";", "}", "if", "(", "!", "quizExercise", ".", "isValid", "(", ")", ")", "{", "return", "ResponseEntity", ".", "badRequest", "(", ")", ".", "headers", "(", "HeaderUtil", ".", "createFailureAlert", "(", "applicationName", ",", "true", ",", "ENTITY_NAME", ",", "\"invalidQuiz\"", ",", "\"The quiz exercise is invalid\"", ")", ")", ".", "body", "(", "null", ")", ";", "}", "exerciseService", ".", "validateScoreSettings", "(", "quizExercise", ")", ";", "quizExercise", ".", "checkCourseAndExerciseGroupExclusivity", "(", "ENTITY_NAME", ")", ";", "Course", "course", "=", "courseService", ".", "retrieveCourseOverExerciseGroupOrCourseId", "(", "quizExercise", ")", ";", "User", "user", "=", "userRepository", ".", "getUserWithGroupsAndAuthorities", "(", ")", ";", "if", "(", "!", "authCheckService", ".", "isAtLeastEditorInCourse", "(", "course", ",", "user", ")", ")", "{", "return", "forbidden", "(", ")", ";", "}", "quizExercise", "=", "quizExerciseService", ".", "save", "(", "quizExercise", ")", ";", "if", "(", "quizExercise", ".", "isCourseExercise", "(", ")", ")", "{", "quizMessagingService", ".", "sendQuizExerciseToSubscribedClients", "(", "quizExercise", ",", "\"change\"", ")", ";", "instanceMessageSendService", ".", "sendExerciseReleaseNotificationSchedule", "(", "quizExercise", ".", "getId", "(", ")", ")", ";", "}", "return", "ResponseEntity", ".", "created", "(", "new", "URI", "(", "\"/api/quiz-exercises/\"", "+", "quizExercise", ".", "getId", "(", ")", ")", ")", ".", "headers", "(", "HeaderUtil", ".", "createEntityCreationAlert", "(", "applicationName", ",", "true", ",", "ENTITY_NAME", ",", "quizExercise", ".", "getId", "(", ")", ".", "toString", "(", ")", ")", ")", ".", "body", "(", "quizExercise", ")", ";", "}" ]
POST /quiz-exercises : Create a new quizExercise.
[ "POST", "/", "quiz", "-", "exercises", ":", "Create", "a", "new", "quizExercise", "." ]
[ "// check if quiz is valid", "// TODO: improve error message and tell the client why the quiz is invalid (also see below in update Quiz)", "// Valid exercises have set either a course or an exerciseGroup", "// Retrieve the course over the exerciseGroup or the given courseId", "// Check that the user is authorized to create the exercise", "// Only notify students and tutors if the exercise is created for a course", "// notify websocket channel of changes to the quiz exercise" ]
[ { "param": "quizExercise", "type": "QuizExercise" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "quizExercise", "type": "QuizExercise", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 3349, 3233, 2932, 19, 18345, 17, 8913, 71, 6141, 7923, 203, 565, 632, 1386, 18987, 2932, 5332, 2996, 2668, 13208, 23291, 13, 203, 565, 1071, 2306, 1943, 32, 928, 452, 424, 20603, 34, 752, 928, 452, 424, 20603, 26964, 28843, 4783, 452, 424, 20603, 16479, 424, 20603, 13, 1216, 19883, 288, 203, 3639, 613, 18, 4148, 2932, 12030, 590, 358, 752, 4783, 452, 424, 20603, 294, 3728, 16, 16479, 424, 20603, 1769, 203, 3639, 309, 261, 18345, 424, 20603, 18, 26321, 1435, 480, 446, 13, 288, 203, 5411, 327, 2306, 1943, 18, 8759, 691, 1435, 203, 10792, 263, 2485, 12, 1864, 1304, 18, 2640, 5247, 13298, 12, 3685, 461, 16, 638, 16, 17020, 67, 1985, 16, 315, 77, 561, 1486, 3113, 315, 37, 394, 16479, 424, 20603, 2780, 1818, 1240, 392, 1599, 7923, 2934, 3432, 12, 2011, 1769, 203, 3639, 289, 203, 203, 3639, 368, 866, 309, 16479, 353, 923, 203, 3639, 309, 16051, 18345, 424, 20603, 18, 26810, 10756, 288, 203, 5411, 368, 2660, 30, 21171, 555, 883, 471, 9276, 326, 1004, 11598, 326, 16479, 353, 2057, 261, 31144, 2621, 5712, 316, 1089, 4783, 452, 13, 203, 5411, 327, 2306, 1943, 18, 8759, 691, 7675, 2485, 12, 1864, 1304, 18, 2640, 5247, 13298, 12, 3685, 461, 16, 638, 16, 17020, 67, 1985, 16, 315, 5387, 928, 452, 3113, 315, 1986, 16479, 24165, 353, 2057, 7923, 2934, 3432, 12, 2011, 1769, 203, 3639, 289, 203, 203, 3639, 24165, 1179, 18, 5662, 7295, 2628, 12, 18345, 424, 20603, 1769, 203, 203, 3639, 368, 2364, 431, 12610, 6141, 1240, 444, 3344, 279, 4362, 578, 392, 24165, 1114, 203, 3639, 16479, 424, 20603, 18, 1893, 39, 3117, 1876, 424, 20603, 1114, 424, 830, 407, 2818, 12, 11101, 67, 1985, 1769, 203, 203, 3639, 368, 10708, 326, 4362, 1879, 326, 24165, 1114, 578, 326, 864, 4362, 548, 203, 3639, 385, 3117, 4362, 273, 4362, 1179, 18, 17466, 39, 3117, 4851, 424, 20603, 1114, 1162, 39, 3117, 548, 12, 18345, 424, 20603, 1769, 203, 203, 3639, 368, 2073, 716, 326, 729, 353, 10799, 358, 752, 326, 24165, 203, 3639, 2177, 729, 273, 729, 3305, 18, 588, 1299, 1190, 3621, 1876, 3594, 1961, 5621, 203, 3639, 309, 16051, 1944, 1564, 1179, 18, 291, 25070, 6946, 382, 39, 3117, 12, 5566, 16, 729, 3719, 288, 203, 5411, 327, 17987, 5621, 203, 3639, 289, 203, 203, 3639, 16479, 424, 20603, 273, 16479, 424, 20603, 1179, 18, 5688, 12, 18345, 424, 20603, 1769, 203, 203, 3639, 368, 5098, 5066, 10068, 4877, 471, 268, 13595, 309, 326, 24165, 353, 2522, 364, 279, 4362, 203, 3639, 309, 261, 18345, 424, 20603, 18, 291, 39, 3117, 424, 20603, 10756, 288, 203, 5411, 368, 5066, 11537, 1904, 434, 3478, 358, 326, 16479, 24165, 203, 5411, 16479, 23389, 1179, 18, 4661, 928, 452, 424, 20603, 774, 1676, 15802, 12300, 12, 18345, 424, 20603, 16, 315, 3427, 8863, 203, 5411, 791, 1079, 3826, 1179, 18, 4661, 424, 20603, 7391, 4386, 6061, 12, 18345, 424, 20603, 18, 26321, 10663, 203, 3639, 289, 203, 203, 3639, 327, 2306, 1943, 18, 4824, 12, 2 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
[ 1, 26873, 203, 377, 380, 5485, 342, 18345, 17, 8913, 71, 6141, 294, 1788, 279, 394, 16479, 424, 20603, 18, 203, 377, 380, 203, 377, 380, 632, 891, 16479, 424, 20603, 326, 16479, 424, 20603, 358, 752, 203, 377, 380, 632, 2463, 326, 2306, 1943, 598, 1267, 3786, 261, 6119, 13, 471, 598, 1417, 326, 394, 16479, 424, 20603, 16, 578, 598, 1267, 7409, 261, 6434, 1567, 13, 309, 326, 16479, 424, 20603, 711, 1818, 392, 1599, 203, 377, 380, 632, 15069, 19883, 309, 326, 7050, 3699, 6279, 353, 11332, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
b4282fff8741271bf4388a976e801963def16126
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/web/rest/QuizExerciseResource.java
[ "MIT" ]
Java
updateQuizExercise
null
@PutMapping("/quiz-exercises") @PreAuthorize("hasRole('EDITOR')") public ResponseEntity<QuizExercise> updateQuizExercise(@RequestBody QuizExercise quizExercise, @RequestParam(value = "notificationText", required = false) String notificationText) throws URISyntaxException { log.debug("REST request to update QuizExercise : {}", quizExercise); if (quizExercise.getId() == null) { return createQuizExercise(quizExercise); } // check if quiz is valid if (!quizExercise.isValid()) { // TODO: improve error message and tell the client why the quiz is invalid (also see above in create Quiz) return ResponseEntity.badRequest().headers(HeaderUtil.createFailureAlert(applicationName, true, ENTITY_NAME, "invalidQuiz", "The quiz exercise is invalid")).body(null); } exerciseService.validateScoreSettings(quizExercise); // Valid exercises have set either a course or an exerciseGroup quizExercise.checkCourseAndExerciseGroupExclusivity(ENTITY_NAME); // Retrieve the course over the exerciseGroup or the given courseId Course course = courseService.retrieveCourseOverExerciseGroupOrCourseId(quizExercise); // Check that the user is authorized to update the exercise User user = userRepository.getUserWithGroupsAndAuthorities(); if (!authCheckService.isAtLeastEditorInCourse(course, user)) { return forbidden(); } // Forbid conversion between normal course exercise and exam exercise var originalQuiz = quizExerciseRepository.findByIdElseThrow(quizExercise.getId()); exerciseService.checkForConversionBetweenExamAndCourseExercise(quizExercise, originalQuiz, ENTITY_NAME); // check if quiz is has already started if (originalQuiz.isStarted()) { return ResponseEntity.badRequest().headers(HeaderUtil.createFailureAlert(applicationName, true, ENTITY_NAME, "quizHasStarted", "The quiz has already started. Use the re-evaluate endpoint to make retroactive corrections.")).body(null); } quizExercise.reconnectJSONIgnoreAttributes(); quizExercise = quizExerciseService.save(quizExercise); exerciseService.logUpdate(quizExercise, quizExercise.getCourseViaExerciseGroupOrCourseMember(), user); // TODO: it does not really make sense to notify students here because the quiz is not visible yet when it is edited! // Only notify students about changes if a regular exercise in a course was updated if (notificationText != null && quizExercise.isCourseExercise()) { // notify websocket channel of changes to the quiz exercise quizMessagingService.sendQuizExerciseToSubscribedClients(quizExercise, "change"); groupNotificationService.notifyStudentAndEditorAndInstructorGroupAboutExerciseUpdate(quizExercise, notificationText); } return ResponseEntity.ok().headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, quizExercise.getId().toString())).body(quizExercise); }
/** * PUT /quiz-exercises : Updates an existing quizExercise. * * @param quizExercise the quizExercise to update * @param notificationText about the quiz exercise update that should be displayed to the student group * @return the ResponseEntity with status 200 (OK) and with body the updated quizExercise, or with status 400 (Bad Request) if the quizExercise is not valid, or with status 500 * (Internal Server Error) if the quizExercise couldn't be updated * @throws URISyntaxException if the Location URI syntax is incorrect */
PUT /quiz-exercises : Updates an existing quizExercise. @param quizExercise the quizExercise to update @param notificationText about the quiz exercise update that should be displayed to the student group @return the ResponseEntity with status 200 (OK) and with body the updated quizExercise, or with status 400 (Bad Request) if the quizExercise is not valid, or with status 500 (Internal Server Error) if the quizExercise couldn't be updated @throws URISyntaxException if the Location URI syntax is incorrect
[ "PUT", "/", "quiz", "-", "exercises", ":", "Updates", "an", "existing", "quizExercise", ".", "@param", "quizExercise", "the", "quizExercise", "to", "update", "@param", "notificationText", "about", "the", "quiz", "exercise", "update", "that", "should", "be", "displayed", "to", "the", "student", "group", "@return", "the", "ResponseEntity", "with", "status", "200", "(", "OK", ")", "and", "with", "body", "the", "updated", "quizExercise", "or", "with", "status", "400", "(", "Bad", "Request", ")", "if", "the", "quizExercise", "is", "not", "valid", "or", "with", "status", "500", "(", "Internal", "Server", "Error", ")", "if", "the", "quizExercise", "couldn", "'", "t", "be", "updated", "@throws", "URISyntaxException", "if", "the", "Location", "URI", "syntax", "is", "incorrect" ]
@PutMapping("/quiz-exercises") @PreAuthorize("hasRole('EDITOR')") public ResponseEntity<QuizExercise> updateQuizExercise(@RequestBody QuizExercise quizExercise, @RequestParam(value = "notificationText", required = false) String notificationText) throws URISyntaxException { log.debug("REST request to update QuizExercise : {}", quizExercise); if (quizExercise.getId() == null) { return createQuizExercise(quizExercise); } if (!quizExercise.isValid()) { return ResponseEntity.badRequest().headers(HeaderUtil.createFailureAlert(applicationName, true, ENTITY_NAME, "invalidQuiz", "The quiz exercise is invalid")).body(null); } exerciseService.validateScoreSettings(quizExercise); quizExercise.checkCourseAndExerciseGroupExclusivity(ENTITY_NAME); Course course = courseService.retrieveCourseOverExerciseGroupOrCourseId(quizExercise); User user = userRepository.getUserWithGroupsAndAuthorities(); if (!authCheckService.isAtLeastEditorInCourse(course, user)) { return forbidden(); } var originalQuiz = quizExerciseRepository.findByIdElseThrow(quizExercise.getId()); exerciseService.checkForConversionBetweenExamAndCourseExercise(quizExercise, originalQuiz, ENTITY_NAME); if (originalQuiz.isStarted()) { return ResponseEntity.badRequest().headers(HeaderUtil.createFailureAlert(applicationName, true, ENTITY_NAME, "quizHasStarted", "The quiz has already started. Use the re-evaluate endpoint to make retroactive corrections.")).body(null); } quizExercise.reconnectJSONIgnoreAttributes(); quizExercise = quizExerciseService.save(quizExercise); exerciseService.logUpdate(quizExercise, quizExercise.getCourseViaExerciseGroupOrCourseMember(), user); if (notificationText != null && quizExercise.isCourseExercise()) { quizMessagingService.sendQuizExerciseToSubscribedClients(quizExercise, "change"); groupNotificationService.notifyStudentAndEditorAndInstructorGroupAboutExerciseUpdate(quizExercise, notificationText); } return ResponseEntity.ok().headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, quizExercise.getId().toString())).body(quizExercise); }
[ "@", "PutMapping", "(", "\"/quiz-exercises\"", ")", "@", "PreAuthorize", "(", "\"hasRole('EDITOR')\"", ")", "public", "ResponseEntity", "<", "QuizExercise", ">", "updateQuizExercise", "(", "@", "RequestBody", "QuizExercise", "quizExercise", ",", "@", "RequestParam", "(", "value", "=", "\"notificationText\"", ",", "required", "=", "false", ")", "String", "notificationText", ")", "throws", "URISyntaxException", "{", "log", ".", "debug", "(", "\"REST request to update QuizExercise : {}\"", ",", "quizExercise", ")", ";", "if", "(", "quizExercise", ".", "getId", "(", ")", "==", "null", ")", "{", "return", "createQuizExercise", "(", "quizExercise", ")", ";", "}", "if", "(", "!", "quizExercise", ".", "isValid", "(", ")", ")", "{", "return", "ResponseEntity", ".", "badRequest", "(", ")", ".", "headers", "(", "HeaderUtil", ".", "createFailureAlert", "(", "applicationName", ",", "true", ",", "ENTITY_NAME", ",", "\"invalidQuiz\"", ",", "\"The quiz exercise is invalid\"", ")", ")", ".", "body", "(", "null", ")", ";", "}", "exerciseService", ".", "validateScoreSettings", "(", "quizExercise", ")", ";", "quizExercise", ".", "checkCourseAndExerciseGroupExclusivity", "(", "ENTITY_NAME", ")", ";", "Course", "course", "=", "courseService", ".", "retrieveCourseOverExerciseGroupOrCourseId", "(", "quizExercise", ")", ";", "User", "user", "=", "userRepository", ".", "getUserWithGroupsAndAuthorities", "(", ")", ";", "if", "(", "!", "authCheckService", ".", "isAtLeastEditorInCourse", "(", "course", ",", "user", ")", ")", "{", "return", "forbidden", "(", ")", ";", "}", "var", "originalQuiz", "=", "quizExerciseRepository", ".", "findByIdElseThrow", "(", "quizExercise", ".", "getId", "(", ")", ")", ";", "exerciseService", ".", "checkForConversionBetweenExamAndCourseExercise", "(", "quizExercise", ",", "originalQuiz", ",", "ENTITY_NAME", ")", ";", "if", "(", "originalQuiz", ".", "isStarted", "(", ")", ")", "{", "return", "ResponseEntity", ".", "badRequest", "(", ")", ".", "headers", "(", "HeaderUtil", ".", "createFailureAlert", "(", "applicationName", ",", "true", ",", "ENTITY_NAME", ",", "\"quizHasStarted\"", ",", "\"The quiz has already started. Use the re-evaluate endpoint to make retroactive corrections.\"", ")", ")", ".", "body", "(", "null", ")", ";", "}", "quizExercise", ".", "reconnectJSONIgnoreAttributes", "(", ")", ";", "quizExercise", "=", "quizExerciseService", ".", "save", "(", "quizExercise", ")", ";", "exerciseService", ".", "logUpdate", "(", "quizExercise", ",", "quizExercise", ".", "getCourseViaExerciseGroupOrCourseMember", "(", ")", ",", "user", ")", ";", "if", "(", "notificationText", "!=", "null", "&&", "quizExercise", ".", "isCourseExercise", "(", ")", ")", "{", "quizMessagingService", ".", "sendQuizExerciseToSubscribedClients", "(", "quizExercise", ",", "\"change\"", ")", ";", "groupNotificationService", ".", "notifyStudentAndEditorAndInstructorGroupAboutExerciseUpdate", "(", "quizExercise", ",", "notificationText", ")", ";", "}", "return", "ResponseEntity", ".", "ok", "(", ")", ".", "headers", "(", "HeaderUtil", ".", "createEntityUpdateAlert", "(", "applicationName", ",", "true", ",", "ENTITY_NAME", ",", "quizExercise", ".", "getId", "(", ")", ".", "toString", "(", ")", ")", ")", ".", "body", "(", "quizExercise", ")", ";", "}" ]
PUT /quiz-exercises : Updates an existing quizExercise.
[ "PUT", "/", "quiz", "-", "exercises", ":", "Updates", "an", "existing", "quizExercise", "." ]
[ "// check if quiz is valid", "// TODO: improve error message and tell the client why the quiz is invalid (also see above in create Quiz)", "// Valid exercises have set either a course or an exerciseGroup", "// Retrieve the course over the exerciseGroup or the given courseId", "// Check that the user is authorized to update the exercise", "// Forbid conversion between normal course exercise and exam exercise", "// check if quiz is has already started", "// TODO: it does not really make sense to notify students here because the quiz is not visible yet when it is edited!", "// Only notify students about changes if a regular exercise in a course was updated", "// notify websocket channel of changes to the quiz exercise" ]
[ { "param": "quizExercise", "type": "QuizExercise" }, { "param": "notificationText", "type": "String" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "quizExercise", "type": "QuizExercise", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "notificationText", "type": "String", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 6426, 3233, 2932, 19, 18345, 17, 8913, 71, 6141, 7923, 203, 565, 632, 1386, 18987, 2932, 5332, 2996, 2668, 13208, 23291, 13, 203, 565, 1071, 2306, 1943, 32, 928, 452, 424, 20603, 34, 1089, 928, 452, 424, 20603, 26964, 28843, 4783, 452, 424, 20603, 16479, 424, 20603, 16, 203, 5411, 632, 691, 786, 12, 1132, 273, 315, 9927, 1528, 3113, 1931, 273, 629, 13, 514, 3851, 1528, 13, 1216, 19883, 288, 203, 3639, 613, 18, 4148, 2932, 12030, 590, 358, 1089, 4783, 452, 424, 20603, 294, 3728, 16, 16479, 424, 20603, 1769, 203, 3639, 309, 261, 18345, 424, 20603, 18, 26321, 1435, 422, 446, 13, 288, 203, 5411, 327, 752, 928, 452, 424, 20603, 12, 18345, 424, 20603, 1769, 203, 3639, 289, 203, 203, 3639, 368, 866, 309, 16479, 353, 923, 203, 3639, 309, 16051, 18345, 424, 20603, 18, 26810, 10756, 288, 203, 5411, 368, 2660, 30, 21171, 555, 883, 471, 9276, 326, 1004, 11598, 326, 16479, 353, 2057, 261, 31144, 2621, 5721, 316, 752, 4783, 452, 13, 203, 5411, 327, 2306, 1943, 18, 8759, 691, 7675, 2485, 12, 1864, 1304, 18, 2640, 5247, 13298, 12, 3685, 461, 16, 638, 16, 17020, 67, 1985, 16, 315, 5387, 928, 452, 3113, 315, 1986, 16479, 24165, 353, 2057, 7923, 2934, 3432, 12, 2011, 1769, 203, 3639, 289, 203, 203, 3639, 24165, 1179, 18, 5662, 7295, 2628, 12, 18345, 424, 20603, 1769, 203, 203, 3639, 368, 2364, 431, 12610, 6141, 1240, 444, 3344, 279, 4362, 578, 392, 24165, 1114, 203, 3639, 16479, 424, 20603, 18, 1893, 39, 3117, 1876, 424, 20603, 1114, 424, 830, 407, 2818, 12, 11101, 67, 1985, 1769, 203, 203, 3639, 368, 10708, 326, 4362, 1879, 326, 24165, 1114, 578, 326, 864, 4362, 548, 203, 3639, 385, 3117, 4362, 273, 4362, 1179, 18, 17466, 39, 3117, 4851, 424, 20603, 1114, 1162, 39, 3117, 548, 12, 18345, 424, 20603, 1769, 203, 203, 3639, 368, 2073, 716, 326, 729, 353, 10799, 358, 1089, 326, 24165, 203, 3639, 2177, 729, 273, 729, 3305, 18, 588, 1299, 1190, 3621, 1876, 3594, 1961, 5621, 203, 3639, 309, 16051, 1944, 1564, 1179, 18, 291, 25070, 6946, 382, 39, 3117, 12, 5566, 16, 729, 3719, 288, 203, 5411, 327, 17987, 5621, 203, 3639, 289, 203, 203, 3639, 368, 2457, 19773, 4105, 3086, 2212, 4362, 24165, 471, 19707, 24165, 203, 3639, 569, 2282, 928, 452, 273, 16479, 424, 20603, 3305, 18, 4720, 5132, 12427, 8282, 12, 18345, 424, 20603, 18, 26321, 10663, 203, 3639, 24165, 1179, 18, 1893, 1290, 6814, 11831, 424, 301, 1876, 39, 3117, 424, 20603, 12, 18345, 424, 20603, 16, 2282, 928, 452, 16, 17020, 67, 1985, 1769, 203, 203, 3639, 368, 866, 309, 16479, 353, 711, 1818, 5746, 203, 203, 3639, 309, 261, 8830, 928, 452, 18, 291, 9217, 10756, 288, 203, 5411, 327, 2306, 1943, 18, 8759, 691, 7675, 2485, 12, 1864, 1304, 18, 2640, 5247, 13298, 12, 3685, 461, 16, 638, 16, 17020, 67, 1985, 16, 315, 18345, 5582, 9217, 3113, 203, 10792, 315, 1986, 16479, 711, 1818, 5746, 18, 2672, 326, 283, 17, 21024, 2494, 358, 2 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
[ 1, 26873, 203, 377, 380, 11443, 342, 18345, 17, 8913, 71, 6141, 294, 15419, 392, 2062, 16479, 424, 20603, 18, 203, 377, 380, 203, 377, 380, 632, 891, 16479, 424, 20603, 326, 16479, 424, 20603, 358, 1089, 203, 377, 380, 632, 891, 3851, 1528, 2973, 326, 16479, 24165, 1089, 716, 1410, 506, 10453, 358, 326, 18110, 1041, 203, 377, 380, 632, 2463, 326, 2306, 1943, 598, 1267, 4044, 261, 3141, 13, 471, 598, 1417, 326, 3526, 16479, 424, 20603, 16, 578, 598, 1267, 7409, 261, 6434, 1567, 13, 309, 326, 16479, 424, 20603, 353, 486, 923, 16, 578, 598, 1267, 6604, 203, 377, 380, 540, 261, 3061, 3224, 1068, 13, 309, 326, 16479, 424, 20603, 17991, 1404, 506, 3526, 203, 377, 380, 632, 15069, 19883, 309, 326, 2 ]
b4282fff8741271bf4388a976e801963def16126
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/web/rest/QuizExerciseResource.java
[ "MIT" ]
Java
recalculateStatistics
null
@GetMapping("/quiz-exercises/{quizExerciseId}/recalculate-statistics") @PreAuthorize("hasRole('TA')") public ResponseEntity<QuizExercise> recalculateStatistics(@PathVariable Long quizExerciseId) { log.debug("REST request to get QuizExercise : {}", quizExerciseId); QuizExercise quizExercise = quizExerciseRepository.findByIdWithQuestionsAndStatisticsElseThrow(quizExerciseId); if (!authCheckService.isAllowedToSeeExercise(quizExercise, null)) { return forbidden(); } quizStatisticService.recalculateStatistics(quizExercise); // fetch the quiz exercise again to make sure the latest changes are included return ResponseEntity.ok(quizExerciseRepository.findByIdWithQuestionsAndStatisticsElseThrow(quizExercise.getId())); }
/** * GET /quiz-exercises/:quizExerciseId/recalculate-statistics : recalculate all statistics in case something went wrong with them * * @param quizExerciseId the id of the quizExercise for which the statistics should be recalculated * @return the ResponseEntity with status 200 (OK) and with body the quizExercise, or with status 404 (Not Found) */
GET /quiz-exercises/:quizExerciseId/recalculate-statistics : recalculate all statistics in case something went wrong with them @param quizExerciseId the id of the quizExercise for which the statistics should be recalculated @return the ResponseEntity with status 200 (OK) and with body the quizExercise, or with status 404 (Not Found)
[ "GET", "/", "quiz", "-", "exercises", "/", ":", "quizExerciseId", "/", "recalculate", "-", "statistics", ":", "recalculate", "all", "statistics", "in", "case", "something", "went", "wrong", "with", "them", "@param", "quizExerciseId", "the", "id", "of", "the", "quizExercise", "for", "which", "the", "statistics", "should", "be", "recalculated", "@return", "the", "ResponseEntity", "with", "status", "200", "(", "OK", ")", "and", "with", "body", "the", "quizExercise", "or", "with", "status", "404", "(", "Not", "Found", ")" ]
@GetMapping("/quiz-exercises/{quizExerciseId}/recalculate-statistics") @PreAuthorize("hasRole('TA')") public ResponseEntity<QuizExercise> recalculateStatistics(@PathVariable Long quizExerciseId) { log.debug("REST request to get QuizExercise : {}", quizExerciseId); QuizExercise quizExercise = quizExerciseRepository.findByIdWithQuestionsAndStatisticsElseThrow(quizExerciseId); if (!authCheckService.isAllowedToSeeExercise(quizExercise, null)) { return forbidden(); } quizStatisticService.recalculateStatistics(quizExercise); return ResponseEntity.ok(quizExerciseRepository.findByIdWithQuestionsAndStatisticsElseThrow(quizExercise.getId())); }
[ "@", "GetMapping", "(", "\"/quiz-exercises/{quizExerciseId}/recalculate-statistics\"", ")", "@", "PreAuthorize", "(", "\"hasRole('TA')\"", ")", "public", "ResponseEntity", "<", "QuizExercise", ">", "recalculateStatistics", "(", "@", "PathVariable", "Long", "quizExerciseId", ")", "{", "log", ".", "debug", "(", "\"REST request to get QuizExercise : {}\"", ",", "quizExerciseId", ")", ";", "QuizExercise", "quizExercise", "=", "quizExerciseRepository", ".", "findByIdWithQuestionsAndStatisticsElseThrow", "(", "quizExerciseId", ")", ";", "if", "(", "!", "authCheckService", ".", "isAllowedToSeeExercise", "(", "quizExercise", ",", "null", ")", ")", "{", "return", "forbidden", "(", ")", ";", "}", "quizStatisticService", ".", "recalculateStatistics", "(", "quizExercise", ")", ";", "return", "ResponseEntity", ".", "ok", "(", "quizExerciseRepository", ".", "findByIdWithQuestionsAndStatisticsElseThrow", "(", "quizExercise", ".", "getId", "(", ")", ")", ")", ";", "}" ]
GET /quiz-exercises/:quizExerciseId/recalculate-statistics : recalculate all statistics in case something went wrong with them @param quizExerciseId the id of the quizExercise for which the statistics should be recalculated @return the ResponseEntity with status 200 (OK) and with body the quizExercise, or with status 404 (Not Found)
[ "GET", "/", "quiz", "-", "exercises", "/", ":", "quizExerciseId", "/", "recalculate", "-", "statistics", ":", "recalculate", "all", "statistics", "in", "case", "something", "went", "wrong", "with", "them", "@param", "quizExerciseId", "the", "id", "of", "the", "quizExercise", "for", "which", "the", "statistics", "should", "be", "recalculated", "@return", "the", "ResponseEntity", "with", "status", "200", "(", "OK", ")", "and", "with", "body", "the", "quizExercise", "or", "with", "status", "404", "(", "Not", "Found", ")" ]
[ "// fetch the quiz exercise again to make sure the latest changes are included" ]
[ { "param": "quizExerciseId", "type": "Long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "quizExerciseId", "type": "Long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 967, 3233, 2932, 19, 18345, 17, 8913, 71, 6141, 4938, 18345, 424, 20603, 548, 4004, 266, 11162, 17, 14438, 7923, 203, 565, 632, 1386, 18987, 2932, 5332, 2996, 2668, 9833, 23291, 13, 203, 565, 1071, 2306, 1943, 32, 928, 452, 424, 20603, 34, 26657, 8569, 26964, 743, 3092, 3407, 16479, 424, 20603, 548, 13, 288, 203, 3639, 613, 18, 4148, 2932, 12030, 590, 358, 336, 4783, 452, 424, 20603, 294, 3728, 16, 16479, 424, 20603, 548, 1769, 203, 3639, 4783, 452, 424, 20603, 16479, 424, 20603, 273, 16479, 424, 20603, 3305, 18, 4720, 5132, 1190, 30791, 1115, 1876, 8569, 12427, 8282, 12, 18345, 424, 20603, 548, 1769, 203, 3639, 309, 16051, 1944, 1564, 1179, 18, 291, 5042, 774, 9704, 424, 20603, 12, 18345, 424, 20603, 16, 446, 3719, 288, 203, 5411, 327, 17987, 5621, 203, 3639, 289, 203, 3639, 16479, 20673, 1179, 18, 266, 11162, 8569, 12, 18345, 424, 20603, 1769, 203, 3639, 368, 2158, 326, 16479, 24165, 3382, 358, 1221, 3071, 326, 4891, 3478, 854, 5849, 203, 3639, 327, 2306, 1943, 18, 601, 12, 18345, 424, 20603, 3305, 18, 4720, 5132, 1190, 30791, 1115, 1876, 8569, 12427, 8282, 12, 18345, 424, 20603, 18, 26321, 1435, 10019, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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 ]
[ 1, 26873, 203, 377, 380, 4978, 342, 18345, 17, 8913, 71, 6141, 16880, 18345, 424, 20603, 548, 19, 266, 11162, 17, 14438, 294, 26657, 777, 7691, 316, 648, 5943, 16343, 7194, 598, 2182, 203, 377, 380, 203, 377, 380, 632, 891, 16479, 424, 20603, 548, 326, 612, 434, 326, 16479, 424, 20603, 364, 1492, 326, 7691, 1410, 506, 283, 22113, 203, 377, 380, 632, 2463, 326, 2306, 1943, 598, 1267, 4044, 261, 3141, 13, 471, 598, 1417, 326, 16479, 424, 20603, 16, 578, 598, 1267, 7709, 261, 1248, 10750, 13, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
b4282fff8741271bf4388a976e801963def16126
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/web/rest/QuizExerciseResource.java
[ "MIT" ]
Java
deleteQuizExercise
null
@DeleteMapping("/quiz-exercises/{quizExerciseId}") @PreAuthorize("hasRole('INSTRUCTOR')") public ResponseEntity<Void> deleteQuizExercise(@PathVariable Long quizExerciseId) { log.info("REST request to delete QuizExercise : {}", quizExerciseId); var quizExercise = quizExerciseRepository.findByIdElseThrow(quizExerciseId); Course course = quizExercise.getCourseViaExerciseGroupOrCourseMember(); User user = userRepository.getUserWithGroupsAndAuthorities(); if (!authCheckService.isAtLeastInstructorInCourse(course, user)) { return forbidden(); } // note: we use the exercise service here, because this one makes sure to clean up all lazy references correctly. exerciseService.logDeletion(quizExercise, course, user); exerciseService.delete(quizExerciseId, false, false); quizExerciseService.cancelScheduledQuiz(quizExerciseId); return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, quizExercise.getTitle())).build(); }
/** * DELETE /quiz-exercises/:quizExerciseId : delete the "id" quizExercise. * * @param quizExerciseId the id of the quizExercise to delete * @return the ResponseEntity with status 200 (OK) */
DELETE /quiz-exercises/:quizExerciseId : delete the "id" quizExercise. @param quizExerciseId the id of the quizExercise to delete @return the ResponseEntity with status 200 (OK)
[ "DELETE", "/", "quiz", "-", "exercises", "/", ":", "quizExerciseId", ":", "delete", "the", "\"", "id", "\"", "quizExercise", ".", "@param", "quizExerciseId", "the", "id", "of", "the", "quizExercise", "to", "delete", "@return", "the", "ResponseEntity", "with", "status", "200", "(", "OK", ")" ]
@DeleteMapping("/quiz-exercises/{quizExerciseId}") @PreAuthorize("hasRole('INSTRUCTOR')") public ResponseEntity<Void> deleteQuizExercise(@PathVariable Long quizExerciseId) { log.info("REST request to delete QuizExercise : {}", quizExerciseId); var quizExercise = quizExerciseRepository.findByIdElseThrow(quizExerciseId); Course course = quizExercise.getCourseViaExerciseGroupOrCourseMember(); User user = userRepository.getUserWithGroupsAndAuthorities(); if (!authCheckService.isAtLeastInstructorInCourse(course, user)) { return forbidden(); } exerciseService.logDeletion(quizExercise, course, user); exerciseService.delete(quizExerciseId, false, false); quizExerciseService.cancelScheduledQuiz(quizExerciseId); return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, quizExercise.getTitle())).build(); }
[ "@", "DeleteMapping", "(", "\"/quiz-exercises/{quizExerciseId}\"", ")", "@", "PreAuthorize", "(", "\"hasRole('INSTRUCTOR')\"", ")", "public", "ResponseEntity", "<", "Void", ">", "deleteQuizExercise", "(", "@", "PathVariable", "Long", "quizExerciseId", ")", "{", "log", ".", "info", "(", "\"REST request to delete QuizExercise : {}\"", ",", "quizExerciseId", ")", ";", "var", "quizExercise", "=", "quizExerciseRepository", ".", "findByIdElseThrow", "(", "quizExerciseId", ")", ";", "Course", "course", "=", "quizExercise", ".", "getCourseViaExerciseGroupOrCourseMember", "(", ")", ";", "User", "user", "=", "userRepository", ".", "getUserWithGroupsAndAuthorities", "(", ")", ";", "if", "(", "!", "authCheckService", ".", "isAtLeastInstructorInCourse", "(", "course", ",", "user", ")", ")", "{", "return", "forbidden", "(", ")", ";", "}", "exerciseService", ".", "logDeletion", "(", "quizExercise", ",", "course", ",", "user", ")", ";", "exerciseService", ".", "delete", "(", "quizExerciseId", ",", "false", ",", "false", ")", ";", "quizExerciseService", ".", "cancelScheduledQuiz", "(", "quizExerciseId", ")", ";", "return", "ResponseEntity", ".", "ok", "(", ")", ".", "headers", "(", "HeaderUtil", ".", "createEntityDeletionAlert", "(", "applicationName", ",", "true", ",", "ENTITY_NAME", ",", "quizExercise", ".", "getTitle", "(", ")", ")", ")", ".", "build", "(", ")", ";", "}" ]
DELETE /quiz-exercises/:quizExerciseId : delete the "id" quizExercise.
[ "DELETE", "/", "quiz", "-", "exercises", "/", ":", "quizExerciseId", ":", "delete", "the", "\"", "id", "\"", "quizExercise", "." ]
[ "// note: we use the exercise service here, because this one makes sure to clean up all lazy references correctly." ]
[ { "param": "quizExerciseId", "type": "Long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "quizExerciseId", "type": "Long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 2613, 3233, 2932, 19, 18345, 17, 8913, 71, 6141, 4938, 18345, 424, 20603, 548, 1532, 13, 203, 565, 632, 1386, 18987, 2932, 5332, 2996, 2668, 706, 13915, 916, 23291, 13, 203, 565, 1071, 2306, 1943, 32, 19038, 34, 1430, 928, 452, 424, 20603, 26964, 743, 3092, 3407, 16479, 424, 20603, 548, 13, 288, 203, 3639, 613, 18, 1376, 2932, 12030, 590, 358, 1430, 4783, 452, 424, 20603, 294, 3728, 16, 16479, 424, 20603, 548, 1769, 203, 3639, 569, 16479, 424, 20603, 273, 16479, 424, 20603, 3305, 18, 4720, 5132, 12427, 8282, 12, 18345, 424, 20603, 548, 1769, 203, 3639, 385, 3117, 4362, 273, 16479, 424, 20603, 18, 588, 39, 3117, 21246, 424, 20603, 1114, 1162, 39, 3117, 4419, 5621, 203, 3639, 2177, 729, 273, 729, 3305, 18, 588, 1299, 1190, 3621, 1876, 3594, 1961, 5621, 203, 3639, 309, 16051, 1944, 1564, 1179, 18, 291, 25070, 382, 2732, 382, 39, 3117, 12, 5566, 16, 729, 3719, 288, 203, 5411, 327, 17987, 5621, 203, 3639, 289, 203, 3639, 368, 4721, 30, 732, 999, 326, 24165, 1156, 2674, 16, 2724, 333, 1245, 7297, 3071, 358, 2721, 731, 777, 7962, 5351, 8783, 18, 203, 3639, 24165, 1179, 18, 1330, 13064, 12, 18345, 424, 20603, 16, 4362, 16, 729, 1769, 203, 3639, 24165, 1179, 18, 3733, 12, 18345, 424, 20603, 548, 16, 629, 16, 629, 1769, 203, 3639, 16479, 424, 20603, 1179, 18, 10996, 10660, 928, 452, 12, 18345, 424, 20603, 548, 1769, 203, 3639, 327, 2306, 1943, 18, 601, 7675, 2485, 12, 1864, 1304, 18, 2640, 1943, 13064, 13298, 12, 3685, 461, 16, 638, 16, 17020, 67, 1985, 16, 16479, 424, 20603, 18, 588, 4247, 10756, 2934, 3510, 5621, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 8568, 342, 18345, 17, 8913, 71, 6141, 16880, 18345, 424, 20603, 548, 294, 1430, 326, 315, 350, 6, 16479, 424, 20603, 18, 203, 377, 380, 203, 377, 380, 632, 891, 16479, 424, 20603, 548, 326, 612, 434, 326, 16479, 424, 20603, 358, 1430, 203, 377, 380, 632, 2463, 326, 2306, 1943, 598, 1267, 4044, 261, 3141, 13, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
b4282fff8741271bf4388a976e801963def16126
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/web/rest/QuizExerciseResource.java
[ "MIT" ]
Java
reEvaluateQuizExercise
null
@PutMapping("/quiz-exercises/{quizExerciseId}/re-evaluate") @PreAuthorize("hasRole('INSTRUCTOR')") public ResponseEntity<QuizExercise> reEvaluateQuizExercise(@PathVariable Long quizExerciseId, @RequestBody QuizExercise quizExercise) { log.debug("REST request to re-evaluate QuizExercise : {}", quizExercise); QuizExercise originalQuizExercise = quizExerciseRepository.findByIdWithQuestionsAndStatisticsElseThrow(quizExerciseId); if (originalQuizExercise.isExamExercise()) { // Re-evaluation of an exam quiz is only possible if all students finished their exam ZonedDateTime latestIndividualExamEndDate = examDateService.getLatestIndividualExamEndDate(originalQuizExercise.getExerciseGroup().getExam()); if (latestIndividualExamEndDate == null || latestIndividualExamEndDate.isAfter(ZonedDateTime.now())) { return ResponseEntity.badRequest().headers(HeaderUtil.createFailureAlert(applicationName, true, ENTITY_NAME, "examOfQuizExerciseNotEnded", "The exam of the quiz exercise has not ended yet. Re-evaluation is only allowed after an exam has ended.")).build(); } } else if (!originalQuizExercise.isEnded()) { return ResponseEntity.badRequest().headers(HeaderUtil.createFailureAlert(applicationName, true, ENTITY_NAME, "quizExerciseNotEnded", "The quiz exercise has not ended yet. Re-evaluation is only allowed after a quiz has ended.")).build(); } var user = userRepository.getUserWithGroupsAndAuthorities(); if (!authCheckService.isAtLeastInstructorForExercise(originalQuizExercise, user)) { return forbidden(); } quizExercise = quizExerciseService.reEvaluate(quizExercise, originalQuizExercise); exerciseService.logUpdate(quizExercise, quizExercise.getCourseViaExerciseGroupOrCourseMember(), user); exerciseService.validateScoreSettings(quizExercise); return ResponseEntity.ok().headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, quizExercise.getId().toString())).body(quizExercise); }
/** * PUT /quiz-exercises/:quizExerciseId/re-evaluate : Re-evaluates an existing quizExercise. * * 1. reset not allowed changes and set flag updateResultsAndStatistics if a recalculation of results and statistics is necessary * 2. save changed quizExercise * 3. if flag is set: -> change results if an answer or a question is set invalid -> recalculate statistics and results and save them. * * @param quizExerciseId the quiz id for the quiz that should be re-evaluated * @param quizExercise the quizExercise to re-evaluate * @return the ResponseEntity with status 200 (OK) and with body the re-evaluated quizExercise, or with status 400 (Bad Request) if the quizExercise is not valid, or with * status 500 (Internal Server Error) if the quizExercise couldn't be re-evaluated */
PUT /quiz-exercises/:quizExerciseId/re-evaluate : Re-evaluates an existing quizExercise. 1. reset not allowed changes and set flag updateResultsAndStatistics if a recalculation of results and statistics is necessary 2. save changed quizExercise 3. if flag is set: -> change results if an answer or a question is set invalid -> recalculate statistics and results and save them. @param quizExerciseId the quiz id for the quiz that should be re-evaluated @param quizExercise the quizExercise to re-evaluate @return the ResponseEntity with status 200 (OK) and with body the re-evaluated quizExercise, or with status 400 (Bad Request) if the quizExercise is not valid, or with status 500 (Internal Server Error) if the quizExercise couldn't be re-evaluated
[ "PUT", "/", "quiz", "-", "exercises", "/", ":", "quizExerciseId", "/", "re", "-", "evaluate", ":", "Re", "-", "evaluates", "an", "existing", "quizExercise", ".", "1", ".", "reset", "not", "allowed", "changes", "and", "set", "flag", "updateResultsAndStatistics", "if", "a", "recalculation", "of", "results", "and", "statistics", "is", "necessary", "2", ".", "save", "changed", "quizExercise", "3", ".", "if", "flag", "is", "set", ":", "-", ">", "change", "results", "if", "an", "answer", "or", "a", "question", "is", "set", "invalid", "-", ">", "recalculate", "statistics", "and", "results", "and", "save", "them", ".", "@param", "quizExerciseId", "the", "quiz", "id", "for", "the", "quiz", "that", "should", "be", "re", "-", "evaluated", "@param", "quizExercise", "the", "quizExercise", "to", "re", "-", "evaluate", "@return", "the", "ResponseEntity", "with", "status", "200", "(", "OK", ")", "and", "with", "body", "the", "re", "-", "evaluated", "quizExercise", "or", "with", "status", "400", "(", "Bad", "Request", ")", "if", "the", "quizExercise", "is", "not", "valid", "or", "with", "status", "500", "(", "Internal", "Server", "Error", ")", "if", "the", "quizExercise", "couldn", "'", "t", "be", "re", "-", "evaluated" ]
@PutMapping("/quiz-exercises/{quizExerciseId}/re-evaluate") @PreAuthorize("hasRole('INSTRUCTOR')") public ResponseEntity<QuizExercise> reEvaluateQuizExercise(@PathVariable Long quizExerciseId, @RequestBody QuizExercise quizExercise) { log.debug("REST request to re-evaluate QuizExercise : {}", quizExercise); QuizExercise originalQuizExercise = quizExerciseRepository.findByIdWithQuestionsAndStatisticsElseThrow(quizExerciseId); if (originalQuizExercise.isExamExercise()) { ZonedDateTime latestIndividualExamEndDate = examDateService.getLatestIndividualExamEndDate(originalQuizExercise.getExerciseGroup().getExam()); if (latestIndividualExamEndDate == null || latestIndividualExamEndDate.isAfter(ZonedDateTime.now())) { return ResponseEntity.badRequest().headers(HeaderUtil.createFailureAlert(applicationName, true, ENTITY_NAME, "examOfQuizExerciseNotEnded", "The exam of the quiz exercise has not ended yet. Re-evaluation is only allowed after an exam has ended.")).build(); } } else if (!originalQuizExercise.isEnded()) { return ResponseEntity.badRequest().headers(HeaderUtil.createFailureAlert(applicationName, true, ENTITY_NAME, "quizExerciseNotEnded", "The quiz exercise has not ended yet. Re-evaluation is only allowed after a quiz has ended.")).build(); } var user = userRepository.getUserWithGroupsAndAuthorities(); if (!authCheckService.isAtLeastInstructorForExercise(originalQuizExercise, user)) { return forbidden(); } quizExercise = quizExerciseService.reEvaluate(quizExercise, originalQuizExercise); exerciseService.logUpdate(quizExercise, quizExercise.getCourseViaExerciseGroupOrCourseMember(), user); exerciseService.validateScoreSettings(quizExercise); return ResponseEntity.ok().headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, quizExercise.getId().toString())).body(quizExercise); }
[ "@", "PutMapping", "(", "\"/quiz-exercises/{quizExerciseId}/re-evaluate\"", ")", "@", "PreAuthorize", "(", "\"hasRole('INSTRUCTOR')\"", ")", "public", "ResponseEntity", "<", "QuizExercise", ">", "reEvaluateQuizExercise", "(", "@", "PathVariable", "Long", "quizExerciseId", ",", "@", "RequestBody", "QuizExercise", "quizExercise", ")", "{", "log", ".", "debug", "(", "\"REST request to re-evaluate QuizExercise : {}\"", ",", "quizExercise", ")", ";", "QuizExercise", "originalQuizExercise", "=", "quizExerciseRepository", ".", "findByIdWithQuestionsAndStatisticsElseThrow", "(", "quizExerciseId", ")", ";", "if", "(", "originalQuizExercise", ".", "isExamExercise", "(", ")", ")", "{", "ZonedDateTime", "latestIndividualExamEndDate", "=", "examDateService", ".", "getLatestIndividualExamEndDate", "(", "originalQuizExercise", ".", "getExerciseGroup", "(", ")", ".", "getExam", "(", ")", ")", ";", "if", "(", "latestIndividualExamEndDate", "==", "null", "||", "latestIndividualExamEndDate", ".", "isAfter", "(", "ZonedDateTime", ".", "now", "(", ")", ")", ")", "{", "return", "ResponseEntity", ".", "badRequest", "(", ")", ".", "headers", "(", "HeaderUtil", ".", "createFailureAlert", "(", "applicationName", ",", "true", ",", "ENTITY_NAME", ",", "\"examOfQuizExerciseNotEnded\"", ",", "\"The exam of the quiz exercise has not ended yet. Re-evaluation is only allowed after an exam has ended.\"", ")", ")", ".", "build", "(", ")", ";", "}", "}", "else", "if", "(", "!", "originalQuizExercise", ".", "isEnded", "(", ")", ")", "{", "return", "ResponseEntity", ".", "badRequest", "(", ")", ".", "headers", "(", "HeaderUtil", ".", "createFailureAlert", "(", "applicationName", ",", "true", ",", "ENTITY_NAME", ",", "\"quizExerciseNotEnded\"", ",", "\"The quiz exercise has not ended yet. Re-evaluation is only allowed after a quiz has ended.\"", ")", ")", ".", "build", "(", ")", ";", "}", "var", "user", "=", "userRepository", ".", "getUserWithGroupsAndAuthorities", "(", ")", ";", "if", "(", "!", "authCheckService", ".", "isAtLeastInstructorForExercise", "(", "originalQuizExercise", ",", "user", ")", ")", "{", "return", "forbidden", "(", ")", ";", "}", "quizExercise", "=", "quizExerciseService", ".", "reEvaluate", "(", "quizExercise", ",", "originalQuizExercise", ")", ";", "exerciseService", ".", "logUpdate", "(", "quizExercise", ",", "quizExercise", ".", "getCourseViaExerciseGroupOrCourseMember", "(", ")", ",", "user", ")", ";", "exerciseService", ".", "validateScoreSettings", "(", "quizExercise", ")", ";", "return", "ResponseEntity", ".", "ok", "(", ")", ".", "headers", "(", "HeaderUtil", ".", "createEntityUpdateAlert", "(", "applicationName", ",", "true", ",", "ENTITY_NAME", ",", "quizExercise", ".", "getId", "(", ")", ".", "toString", "(", ")", ")", ")", ".", "body", "(", "quizExercise", ")", ";", "}" ]
PUT /quiz-exercises/:quizExerciseId/re-evaluate : Re-evaluates an existing quizExercise.
[ "PUT", "/", "quiz", "-", "exercises", "/", ":", "quizExerciseId", "/", "re", "-", "evaluate", ":", "Re", "-", "evaluates", "an", "existing", "quizExercise", "." ]
[ "// Re-evaluation of an exam quiz is only possible if all students finished their exam" ]
[ { "param": "quizExerciseId", "type": "Long" }, { "param": "quizExercise", "type": "QuizExercise" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "quizExerciseId", "type": "Long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "quizExercise", "type": "QuizExercise", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 6426, 3233, 2932, 19, 18345, 17, 8913, 71, 6141, 4938, 18345, 424, 20603, 548, 4004, 266, 17, 21024, 7923, 203, 565, 632, 1386, 18987, 2932, 5332, 2996, 2668, 706, 13915, 916, 23291, 13, 203, 565, 1071, 2306, 1943, 32, 928, 452, 424, 20603, 34, 283, 15369, 928, 452, 424, 20603, 26964, 743, 3092, 3407, 16479, 424, 20603, 548, 16, 632, 28843, 4783, 452, 424, 20603, 16479, 424, 20603, 13, 288, 203, 3639, 613, 18, 4148, 2932, 12030, 590, 358, 283, 17, 21024, 4783, 452, 424, 20603, 294, 3728, 16, 16479, 424, 20603, 1769, 203, 3639, 4783, 452, 424, 20603, 2282, 928, 452, 424, 20603, 273, 16479, 424, 20603, 3305, 18, 4720, 5132, 1190, 30791, 1115, 1876, 8569, 12427, 8282, 12, 18345, 424, 20603, 548, 1769, 203, 203, 3639, 309, 261, 8830, 928, 452, 424, 20603, 18, 291, 424, 301, 424, 20603, 10756, 288, 203, 5411, 368, 868, 17, 14168, 367, 434, 392, 19707, 16479, 353, 1338, 3323, 309, 777, 10068, 4877, 6708, 3675, 19707, 203, 5411, 24869, 4891, 29834, 424, 301, 24640, 273, 19707, 1626, 1179, 18, 588, 18650, 29834, 424, 301, 24640, 12, 8830, 928, 452, 424, 20603, 18, 588, 424, 20603, 1114, 7675, 588, 424, 301, 10663, 203, 5411, 309, 261, 13550, 29834, 424, 301, 24640, 422, 446, 747, 4891, 29834, 424, 301, 24640, 18, 291, 4436, 12, 62, 20461, 18, 3338, 1435, 3719, 288, 203, 7734, 327, 2306, 1943, 18, 8759, 691, 7675, 2485, 12, 1864, 1304, 18, 2640, 5247, 13298, 12, 3685, 461, 16, 638, 16, 17020, 67, 1985, 16, 315, 338, 301, 951, 928, 452, 424, 20603, 1248, 28362, 3113, 203, 13491, 315, 1986, 19707, 434, 326, 16479, 24165, 711, 486, 16926, 4671, 18, 868, 17, 14168, 367, 353, 1338, 2935, 1839, 392, 19707, 711, 16926, 1199, 13, 2934, 3510, 5621, 203, 5411, 289, 203, 3639, 289, 203, 3639, 469, 309, 16051, 8830, 928, 452, 424, 20603, 18, 291, 28362, 10756, 288, 203, 5411, 327, 2306, 1943, 18, 8759, 691, 7675, 2485, 12, 1864, 1304, 18, 2640, 5247, 13298, 12, 3685, 461, 16, 638, 16, 17020, 67, 1985, 16, 315, 18345, 424, 20603, 1248, 28362, 3113, 203, 10792, 315, 1986, 16479, 24165, 711, 486, 16926, 4671, 18, 868, 17, 14168, 367, 353, 1338, 2935, 1839, 279, 16479, 711, 16926, 1199, 13, 2934, 3510, 5621, 203, 3639, 289, 203, 203, 3639, 569, 729, 273, 729, 3305, 18, 588, 1299, 1190, 3621, 1876, 3594, 1961, 5621, 203, 3639, 309, 16051, 1944, 1564, 1179, 18, 291, 25070, 382, 2732, 1290, 424, 20603, 12, 8830, 928, 452, 424, 20603, 16, 729, 3719, 288, 203, 5411, 327, 17987, 5621, 203, 3639, 289, 203, 203, 3639, 16479, 424, 20603, 273, 16479, 424, 20603, 1179, 18, 266, 15369, 12, 18345, 424, 20603, 16, 2282, 928, 452, 424, 20603, 1769, 203, 3639, 24165, 1179, 18, 1330, 1891, 12, 18345, 424, 20603, 16, 16479, 424, 20603, 18, 588, 39, 3117, 21246, 424, 20603, 1114, 1162, 39, 3117, 4419, 9334, 729, 1769, 203, 203, 3639, 24165, 1179, 18, 5662, 7295, 2628, 12, 18345, 424, 20603, 1769, 203, 203, 3639, 327, 2 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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16880, 18345, 424, 20603, 548, 19, 266, 17, 21024, 294, 868, 17, 14168, 815, 392, 2062, 16479, 424, 20603, 18, 203, 377, 380, 203, 377, 380, 404, 18, 2715, 486, 2935, 3478, 471, 444, 2982, 1089, 3447, 1876, 8569, 309, 279, 283, 29916, 434, 1686, 471, 7691, 353, 4573, 203, 377, 380, 576, 18, 1923, 3550, 16479, 424, 20603, 203, 377, 380, 890, 18, 309, 2982, 353, 444, 30, 317, 2549, 1686, 309, 392, 5803, 578, 279, 5073, 353, 444, 2057, 317, 26657, 7691, 471, 1686, 471, 1923, 2182, 18, 203, 377, 380, 203, 377, 380, 632, 891, 16479, 424, 20603, 548, 326, 16479, 612, 364, 326, 16479, 716, 1410, 506, 283, 17, 14168, 690, 2 ]
7ad954fa7cfd587aa60e2989a2c860407be9395b
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/web/rest/TextExerciseResource.java
[ "MIT" ]
Java
createTextExercise
null
@PostMapping("/text-exercises") @PreAuthorize("hasRole('EDITOR')") public ResponseEntity<TextExercise> createTextExercise(@RequestBody TextExercise textExercise) throws URISyntaxException { log.debug("REST request to save TextExercise : {}", textExercise); if (textExercise.getId() != null) { throw new BadRequestAlertException("A new textExercise cannot already have an ID", ENTITY_NAME, "idexists"); } if (textExercise.getTitle() == null) { throw new BadRequestAlertException("A new textExercise needs a title", ENTITY_NAME, "missingtitle"); } // validates general settings: points, dates exerciseService.validateGeneralSettings(textExercise); if (textExercise.getDueDate() == null && textExercise.getAssessmentDueDate() != null) { throw new BadRequestAlertException("If you set an assessmentDueDate, then you need to add also a dueDate", ENTITY_NAME, "dueDate"); } // Valid exercises have set either a course or an exerciseGroup textExercise.checkCourseAndExerciseGroupExclusivity(ENTITY_NAME); // Retrieve the course over the exerciseGroup or the given courseId Course course = courseService.retrieveCourseOverExerciseGroupOrCourseId(textExercise); // Check that the user is authorized to create the exercise User user = userRepository.getUserWithGroupsAndAuthorities(); if (!authCheckService.isAtLeastEditorInCourse(course, user)) { return forbidden(); } // if exercise is created from scratch we create a new knowledge instance textExercise.setKnowledge(textAssessmentKnowledgeService.createNewKnowledge()); TextExercise result = textExerciseRepository.save(textExercise); instanceMessageSendService.sendTextExerciseSchedule(result.getId()); instanceMessageSendService.sendExerciseReleaseNotificationSchedule(textExercise.getId()); return ResponseEntity.created(new URI("/api/text-exercises/" + result.getId())) .headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString())).body(result); }
/** * POST /text-exercises : Create a new textExercise. * * @param textExercise the textExercise to create * @return the ResponseEntity with status 201 (Created) and with body the new textExercise, or * with status 400 (Bad Request) if the textExercise has already an ID * @throws URISyntaxException if the Location URI syntax is incorrect */
POST /text-exercises : Create a new textExercise. @param textExercise the textExercise to create @return the ResponseEntity with status 201 (Created) and with body the new textExercise, or with status 400 (Bad Request) if the textExercise has already an ID @throws URISyntaxException if the Location URI syntax is incorrect
[ "POST", "/", "text", "-", "exercises", ":", "Create", "a", "new", "textExercise", ".", "@param", "textExercise", "the", "textExercise", "to", "create", "@return", "the", "ResponseEntity", "with", "status", "201", "(", "Created", ")", "and", "with", "body", "the", "new", "textExercise", "or", "with", "status", "400", "(", "Bad", "Request", ")", "if", "the", "textExercise", "has", "already", "an", "ID", "@throws", "URISyntaxException", "if", "the", "Location", "URI", "syntax", "is", "incorrect" ]
@PostMapping("/text-exercises") @PreAuthorize("hasRole('EDITOR')") public ResponseEntity<TextExercise> createTextExercise(@RequestBody TextExercise textExercise) throws URISyntaxException { log.debug("REST request to save TextExercise : {}", textExercise); if (textExercise.getId() != null) { throw new BadRequestAlertException("A new textExercise cannot already have an ID", ENTITY_NAME, "idexists"); } if (textExercise.getTitle() == null) { throw new BadRequestAlertException("A new textExercise needs a title", ENTITY_NAME, "missingtitle"); } exerciseService.validateGeneralSettings(textExercise); if (textExercise.getDueDate() == null && textExercise.getAssessmentDueDate() != null) { throw new BadRequestAlertException("If you set an assessmentDueDate, then you need to add also a dueDate", ENTITY_NAME, "dueDate"); } textExercise.checkCourseAndExerciseGroupExclusivity(ENTITY_NAME); Course course = courseService.retrieveCourseOverExerciseGroupOrCourseId(textExercise); User user = userRepository.getUserWithGroupsAndAuthorities(); if (!authCheckService.isAtLeastEditorInCourse(course, user)) { return forbidden(); } textExercise.setKnowledge(textAssessmentKnowledgeService.createNewKnowledge()); TextExercise result = textExerciseRepository.save(textExercise); instanceMessageSendService.sendTextExerciseSchedule(result.getId()); instanceMessageSendService.sendExerciseReleaseNotificationSchedule(textExercise.getId()); return ResponseEntity.created(new URI("/api/text-exercises/" + result.getId())) .headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString())).body(result); }
[ "@", "PostMapping", "(", "\"/text-exercises\"", ")", "@", "PreAuthorize", "(", "\"hasRole('EDITOR')\"", ")", "public", "ResponseEntity", "<", "TextExercise", ">", "createTextExercise", "(", "@", "RequestBody", "TextExercise", "textExercise", ")", "throws", "URISyntaxException", "{", "log", ".", "debug", "(", "\"REST request to save TextExercise : {}\"", ",", "textExercise", ")", ";", "if", "(", "textExercise", ".", "getId", "(", ")", "!=", "null", ")", "{", "throw", "new", "BadRequestAlertException", "(", "\"A new textExercise cannot already have an ID\"", ",", "ENTITY_NAME", ",", "\"idexists\"", ")", ";", "}", "if", "(", "textExercise", ".", "getTitle", "(", ")", "==", "null", ")", "{", "throw", "new", "BadRequestAlertException", "(", "\"A new textExercise needs a title\"", ",", "ENTITY_NAME", ",", "\"missingtitle\"", ")", ";", "}", "exerciseService", ".", "validateGeneralSettings", "(", "textExercise", ")", ";", "if", "(", "textExercise", ".", "getDueDate", "(", ")", "==", "null", "&&", "textExercise", ".", "getAssessmentDueDate", "(", ")", "!=", "null", ")", "{", "throw", "new", "BadRequestAlertException", "(", "\"If you set an assessmentDueDate, then you need to add also a dueDate\"", ",", "ENTITY_NAME", ",", "\"dueDate\"", ")", ";", "}", "textExercise", ".", "checkCourseAndExerciseGroupExclusivity", "(", "ENTITY_NAME", ")", ";", "Course", "course", "=", "courseService", ".", "retrieveCourseOverExerciseGroupOrCourseId", "(", "textExercise", ")", ";", "User", "user", "=", "userRepository", ".", "getUserWithGroupsAndAuthorities", "(", ")", ";", "if", "(", "!", "authCheckService", ".", "isAtLeastEditorInCourse", "(", "course", ",", "user", ")", ")", "{", "return", "forbidden", "(", ")", ";", "}", "textExercise", ".", "setKnowledge", "(", "textAssessmentKnowledgeService", ".", "createNewKnowledge", "(", ")", ")", ";", "TextExercise", "result", "=", "textExerciseRepository", ".", "save", "(", "textExercise", ")", ";", "instanceMessageSendService", ".", "sendTextExerciseSchedule", "(", "result", ".", "getId", "(", ")", ")", ";", "instanceMessageSendService", ".", "sendExerciseReleaseNotificationSchedule", "(", "textExercise", ".", "getId", "(", ")", ")", ";", "return", "ResponseEntity", ".", "created", "(", "new", "URI", "(", "\"/api/text-exercises/\"", "+", "result", ".", "getId", "(", ")", ")", ")", ".", "headers", "(", "HeaderUtil", ".", "createEntityCreationAlert", "(", "applicationName", ",", "true", ",", "ENTITY_NAME", ",", "result", ".", "getId", "(", ")", ".", "toString", "(", ")", ")", ")", ".", "body", "(", "result", ")", ";", "}" ]
POST /text-exercises : Create a new textExercise.
[ "POST", "/", "text", "-", "exercises", ":", "Create", "a", "new", "textExercise", "." ]
[ "// validates general settings: points, dates", "// Valid exercises have set either a course or an exerciseGroup", "// Retrieve the course over the exerciseGroup or the given courseId", "// Check that the user is authorized to create the exercise", "// if exercise is created from scratch we create a new knowledge instance" ]
[ { "param": "textExercise", "type": "TextExercise" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "textExercise", "type": "TextExercise", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 3349, 3233, 2932, 19, 955, 17, 8913, 71, 6141, 7923, 203, 565, 632, 1386, 18987, 2932, 5332, 2996, 2668, 13208, 23291, 13, 203, 565, 1071, 2306, 1943, 32, 1528, 424, 20603, 34, 752, 1528, 424, 20603, 26964, 28843, 3867, 424, 20603, 977, 424, 20603, 13, 1216, 19883, 288, 203, 3639, 613, 18, 4148, 2932, 12030, 590, 358, 1923, 3867, 424, 20603, 294, 3728, 16, 977, 424, 20603, 1769, 203, 3639, 309, 261, 955, 424, 20603, 18, 26321, 1435, 480, 446, 13, 288, 203, 5411, 604, 394, 23223, 13298, 503, 2932, 37, 394, 977, 424, 20603, 2780, 1818, 1240, 392, 1599, 3113, 17020, 67, 1985, 16, 315, 77, 561, 1486, 8863, 203, 3639, 289, 203, 203, 3639, 309, 261, 955, 424, 20603, 18, 588, 4247, 1435, 422, 446, 13, 288, 203, 5411, 604, 394, 23223, 13298, 503, 2932, 37, 394, 977, 424, 20603, 4260, 279, 2077, 3113, 17020, 67, 1985, 16, 315, 7337, 2649, 8863, 203, 3639, 289, 203, 3639, 368, 11964, 7470, 1947, 30, 3143, 16, 7811, 203, 3639, 24165, 1179, 18, 5662, 12580, 2628, 12, 955, 424, 20603, 1769, 203, 203, 3639, 309, 261, 955, 424, 20603, 18, 588, 30023, 1626, 1435, 422, 446, 597, 977, 424, 20603, 18, 588, 15209, 30023, 1626, 1435, 480, 446, 13, 288, 203, 5411, 604, 394, 23223, 13298, 503, 2932, 2047, 1846, 444, 392, 14158, 30023, 1626, 16, 1508, 1846, 1608, 358, 527, 2546, 279, 6541, 1626, 3113, 17020, 67, 1985, 16, 315, 24334, 1626, 8863, 203, 3639, 289, 203, 203, 3639, 368, 2364, 431, 12610, 6141, 1240, 444, 3344, 279, 4362, 578, 392, 24165, 1114, 203, 3639, 977, 424, 20603, 18, 1893, 39, 3117, 1876, 424, 20603, 1114, 424, 830, 407, 2818, 12, 11101, 67, 1985, 1769, 203, 203, 3639, 368, 10708, 326, 4362, 1879, 326, 24165, 1114, 578, 326, 864, 4362, 548, 203, 3639, 385, 3117, 4362, 273, 4362, 1179, 18, 17466, 39, 3117, 4851, 424, 20603, 1114, 1162, 39, 3117, 548, 12, 955, 424, 20603, 1769, 203, 203, 3639, 368, 2073, 716, 326, 729, 353, 10799, 358, 752, 326, 24165, 203, 3639, 2177, 729, 273, 729, 3305, 18, 588, 1299, 1190, 3621, 1876, 3594, 1961, 5621, 203, 3639, 309, 16051, 1944, 1564, 1179, 18, 291, 25070, 6946, 382, 39, 3117, 12, 5566, 16, 729, 3719, 288, 203, 5411, 327, 17987, 5621, 203, 3639, 289, 203, 203, 3639, 368, 309, 24165, 353, 2522, 628, 15289, 732, 752, 279, 394, 20272, 791, 203, 3639, 977, 424, 20603, 18, 542, 47, 14390, 12, 955, 15209, 47, 14390, 1179, 18, 2640, 1908, 47, 14390, 10663, 203, 203, 3639, 3867, 424, 20603, 563, 273, 977, 424, 20603, 3305, 18, 5688, 12, 955, 424, 20603, 1769, 203, 3639, 791, 1079, 3826, 1179, 18, 4661, 1528, 424, 20603, 6061, 12, 2088, 18, 26321, 10663, 203, 3639, 791, 1079, 3826, 1179, 18, 4661, 424, 20603, 7391, 4386, 6061, 12, 955, 424, 20603, 18, 26321, 10663, 203, 203, 3639, 327, 2306, 1943, 18, 4824, 12, 2704, 3699, 2932, 19, 2425, 19, 955, 17, 8913, 71, 6141, 4898, 397, 563, 18, 26321, 1435, 3719, 203, 2 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
[ 1, 26873, 203, 377, 380, 5485, 342, 955, 17, 8913, 71, 6141, 294, 1788, 279, 394, 977, 424, 20603, 18, 203, 377, 380, 203, 377, 380, 632, 891, 977, 424, 20603, 326, 977, 424, 20603, 358, 752, 203, 377, 380, 632, 2463, 326, 2306, 1943, 598, 1267, 3786, 261, 6119, 13, 471, 598, 1417, 326, 394, 977, 424, 20603, 16, 578, 203, 377, 380, 598, 1267, 7409, 261, 6434, 1567, 13, 309, 326, 977, 424, 20603, 711, 1818, 392, 1599, 203, 377, 380, 632, 15069, 19883, 309, 326, 7050, 3699, 6279, 353, 11332, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
7ad954fa7cfd587aa60e2989a2c860407be9395b
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/web/rest/TextExerciseResource.java
[ "MIT" ]
Java
updateTextExercise
null
@PutMapping("/text-exercises") @PreAuthorize("hasRole('EDITOR')") public ResponseEntity<TextExercise> updateTextExercise(@RequestBody TextExercise textExercise, @RequestParam(value = "notificationText", required = false) String notificationText) throws URISyntaxException { log.debug("REST request to update TextExercise : {}", textExercise); if (textExercise.getId() == null) { return createTextExercise(textExercise); } // validates general settings: points, dates exerciseService.validateGeneralSettings(textExercise); // Valid exercises have set either a course or an exerciseGroup textExercise.checkCourseAndExerciseGroupExclusivity(ENTITY_NAME); // Retrieve the course over the exerciseGroup or the given courseId Course course = courseService.retrieveCourseOverExerciseGroupOrCourseId(textExercise); // Check that the user is authorized to update the exercise User user = userRepository.getUserWithGroupsAndAuthorities(); if (!authCheckService.isAtLeastEditorInCourse(course, user)) { return forbidden(); } TextExercise textExerciseBeforeUpdate = textExerciseRepository.findByIdElseThrow(textExercise.getId()); // Forbid changing the course the exercise belongs to. if (!Objects.equals(textExerciseBeforeUpdate.getCourseViaExerciseGroupOrCourseMember().getId(), textExercise.getCourseViaExerciseGroupOrCourseMember().getId())) { return conflict("Exercise course id does not match the stored course id", ENTITY_NAME, "cannotChangeCourseId"); } // Forbid conversion between normal course exercise and exam exercise exerciseService.checkForConversionBetweenExamAndCourseExercise(textExercise, textExerciseBeforeUpdate, ENTITY_NAME); TextExercise updatedTextExercise = textExerciseRepository.save(textExercise); exerciseService.logUpdate(updatedTextExercise, updatedTextExercise.getCourseViaExerciseGroupOrCourseMember(), user); exerciseService.updatePointsInRelatedParticipantScores(textExerciseBeforeUpdate, updatedTextExercise); instanceMessageSendService.sendTextExerciseSchedule(updatedTextExercise.getId()); // Avoid recursions if (textExercise.getExampleSubmissions().size() != 0) { Set<ExampleSubmission> exampleSubmissionsWithResults = exampleSubmissionRepository.findAllWithResultByExerciseId(textExercise.getId()); updatedTextExercise.setExampleSubmissions(exampleSubmissionsWithResults); updatedTextExercise.getExampleSubmissions().forEach(exampleSubmission -> exampleSubmission.setExercise(null)); updatedTextExercise.getExampleSubmissions().forEach(exampleSubmission -> exampleSubmission.setTutorParticipations(null)); } if ((notificationText != null && textExercise.isCourseExercise()) || textExercise.isExamExercise()) { groupNotificationService.notifyStudentAndEditorAndInstructorGroupAboutExerciseUpdate(textExercise, notificationText); } return ResponseEntity.ok().headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, textExercise.getId().toString())).body(updatedTextExercise); }
/** * PUT /text-exercises : Updates an existing textExercise. * * @param textExercise the textExercise to update * @param notificationText about the text exercise update that should be displayed for the * student group * @return the ResponseEntity with status 200 (OK) and with body the updated textExercise, or * with status 400 (Bad Request) if the textExercise is not valid, or with status 500 (Internal * Server Error) if the textExercise couldn't be updated * @throws URISyntaxException if the Location URI syntax is incorrect */
PUT /text-exercises : Updates an existing textExercise. @param textExercise the textExercise to update @param notificationText about the text exercise update that should be displayed for the student group @return the ResponseEntity with status 200 (OK) and with body the updated textExercise, or with status 400 (Bad Request) if the textExercise is not valid, or with status 500 (Internal Server Error) if the textExercise couldn't be updated @throws URISyntaxException if the Location URI syntax is incorrect
[ "PUT", "/", "text", "-", "exercises", ":", "Updates", "an", "existing", "textExercise", ".", "@param", "textExercise", "the", "textExercise", "to", "update", "@param", "notificationText", "about", "the", "text", "exercise", "update", "that", "should", "be", "displayed", "for", "the", "student", "group", "@return", "the", "ResponseEntity", "with", "status", "200", "(", "OK", ")", "and", "with", "body", "the", "updated", "textExercise", "or", "with", "status", "400", "(", "Bad", "Request", ")", "if", "the", "textExercise", "is", "not", "valid", "or", "with", "status", "500", "(", "Internal", "Server", "Error", ")", "if", "the", "textExercise", "couldn", "'", "t", "be", "updated", "@throws", "URISyntaxException", "if", "the", "Location", "URI", "syntax", "is", "incorrect" ]
@PutMapping("/text-exercises") @PreAuthorize("hasRole('EDITOR')") public ResponseEntity<TextExercise> updateTextExercise(@RequestBody TextExercise textExercise, @RequestParam(value = "notificationText", required = false) String notificationText) throws URISyntaxException { log.debug("REST request to update TextExercise : {}", textExercise); if (textExercise.getId() == null) { return createTextExercise(textExercise); } exerciseService.validateGeneralSettings(textExercise); textExercise.checkCourseAndExerciseGroupExclusivity(ENTITY_NAME); Course course = courseService.retrieveCourseOverExerciseGroupOrCourseId(textExercise); User user = userRepository.getUserWithGroupsAndAuthorities(); if (!authCheckService.isAtLeastEditorInCourse(course, user)) { return forbidden(); } TextExercise textExerciseBeforeUpdate = textExerciseRepository.findByIdElseThrow(textExercise.getId()); if (!Objects.equals(textExerciseBeforeUpdate.getCourseViaExerciseGroupOrCourseMember().getId(), textExercise.getCourseViaExerciseGroupOrCourseMember().getId())) { return conflict("Exercise course id does not match the stored course id", ENTITY_NAME, "cannotChangeCourseId"); } exerciseService.checkForConversionBetweenExamAndCourseExercise(textExercise, textExerciseBeforeUpdate, ENTITY_NAME); TextExercise updatedTextExercise = textExerciseRepository.save(textExercise); exerciseService.logUpdate(updatedTextExercise, updatedTextExercise.getCourseViaExerciseGroupOrCourseMember(), user); exerciseService.updatePointsInRelatedParticipantScores(textExerciseBeforeUpdate, updatedTextExercise); instanceMessageSendService.sendTextExerciseSchedule(updatedTextExercise.getId()); if (textExercise.getExampleSubmissions().size() != 0) { Set<ExampleSubmission> exampleSubmissionsWithResults = exampleSubmissionRepository.findAllWithResultByExerciseId(textExercise.getId()); updatedTextExercise.setExampleSubmissions(exampleSubmissionsWithResults); updatedTextExercise.getExampleSubmissions().forEach(exampleSubmission -> exampleSubmission.setExercise(null)); updatedTextExercise.getExampleSubmissions().forEach(exampleSubmission -> exampleSubmission.setTutorParticipations(null)); } if ((notificationText != null && textExercise.isCourseExercise()) || textExercise.isExamExercise()) { groupNotificationService.notifyStudentAndEditorAndInstructorGroupAboutExerciseUpdate(textExercise, notificationText); } return ResponseEntity.ok().headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, textExercise.getId().toString())).body(updatedTextExercise); }
[ "@", "PutMapping", "(", "\"/text-exercises\"", ")", "@", "PreAuthorize", "(", "\"hasRole('EDITOR')\"", ")", "public", "ResponseEntity", "<", "TextExercise", ">", "updateTextExercise", "(", "@", "RequestBody", "TextExercise", "textExercise", ",", "@", "RequestParam", "(", "value", "=", "\"notificationText\"", ",", "required", "=", "false", ")", "String", "notificationText", ")", "throws", "URISyntaxException", "{", "log", ".", "debug", "(", "\"REST request to update TextExercise : {}\"", ",", "textExercise", ")", ";", "if", "(", "textExercise", ".", "getId", "(", ")", "==", "null", ")", "{", "return", "createTextExercise", "(", "textExercise", ")", ";", "}", "exerciseService", ".", "validateGeneralSettings", "(", "textExercise", ")", ";", "textExercise", ".", "checkCourseAndExerciseGroupExclusivity", "(", "ENTITY_NAME", ")", ";", "Course", "course", "=", "courseService", ".", "retrieveCourseOverExerciseGroupOrCourseId", "(", "textExercise", ")", ";", "User", "user", "=", "userRepository", ".", "getUserWithGroupsAndAuthorities", "(", ")", ";", "if", "(", "!", "authCheckService", ".", "isAtLeastEditorInCourse", "(", "course", ",", "user", ")", ")", "{", "return", "forbidden", "(", ")", ";", "}", "TextExercise", "textExerciseBeforeUpdate", "=", "textExerciseRepository", ".", "findByIdElseThrow", "(", "textExercise", ".", "getId", "(", ")", ")", ";", "if", "(", "!", "Objects", ".", "equals", "(", "textExerciseBeforeUpdate", ".", "getCourseViaExerciseGroupOrCourseMember", "(", ")", ".", "getId", "(", ")", ",", "textExercise", ".", "getCourseViaExerciseGroupOrCourseMember", "(", ")", ".", "getId", "(", ")", ")", ")", "{", "return", "conflict", "(", "\"Exercise course id does not match the stored course id\"", ",", "ENTITY_NAME", ",", "\"cannotChangeCourseId\"", ")", ";", "}", "exerciseService", ".", "checkForConversionBetweenExamAndCourseExercise", "(", "textExercise", ",", "textExerciseBeforeUpdate", ",", "ENTITY_NAME", ")", ";", "TextExercise", "updatedTextExercise", "=", "textExerciseRepository", ".", "save", "(", "textExercise", ")", ";", "exerciseService", ".", "logUpdate", "(", "updatedTextExercise", ",", "updatedTextExercise", ".", "getCourseViaExerciseGroupOrCourseMember", "(", ")", ",", "user", ")", ";", "exerciseService", ".", "updatePointsInRelatedParticipantScores", "(", "textExerciseBeforeUpdate", ",", "updatedTextExercise", ")", ";", "instanceMessageSendService", ".", "sendTextExerciseSchedule", "(", "updatedTextExercise", ".", "getId", "(", ")", ")", ";", "if", "(", "textExercise", ".", "getExampleSubmissions", "(", ")", ".", "size", "(", ")", "!=", "0", ")", "{", "Set", "<", "ExampleSubmission", ">", "exampleSubmissionsWithResults", "=", "exampleSubmissionRepository", ".", "findAllWithResultByExerciseId", "(", "textExercise", ".", "getId", "(", ")", ")", ";", "updatedTextExercise", ".", "setExampleSubmissions", "(", "exampleSubmissionsWithResults", ")", ";", "updatedTextExercise", ".", "getExampleSubmissions", "(", ")", ".", "forEach", "(", "exampleSubmission", "->", "exampleSubmission", ".", "setExercise", "(", "null", ")", ")", ";", "updatedTextExercise", ".", "getExampleSubmissions", "(", ")", ".", "forEach", "(", "exampleSubmission", "->", "exampleSubmission", ".", "setTutorParticipations", "(", "null", ")", ")", ";", "}", "if", "(", "(", "notificationText", "!=", "null", "&&", "textExercise", ".", "isCourseExercise", "(", ")", ")", "||", "textExercise", ".", "isExamExercise", "(", ")", ")", "{", "groupNotificationService", ".", "notifyStudentAndEditorAndInstructorGroupAboutExerciseUpdate", "(", "textExercise", ",", "notificationText", ")", ";", "}", "return", "ResponseEntity", ".", "ok", "(", ")", ".", "headers", "(", "HeaderUtil", ".", "createEntityUpdateAlert", "(", "applicationName", ",", "true", ",", "ENTITY_NAME", ",", "textExercise", ".", "getId", "(", ")", ".", "toString", "(", ")", ")", ")", ".", "body", "(", "updatedTextExercise", ")", ";", "}" ]
PUT /text-exercises : Updates an existing textExercise.
[ "PUT", "/", "text", "-", "exercises", ":", "Updates", "an", "existing", "textExercise", "." ]
[ "// validates general settings: points, dates", "// Valid exercises have set either a course or an exerciseGroup", "// Retrieve the course over the exerciseGroup or the given courseId", "// Check that the user is authorized to update the exercise", "// Forbid changing the course the exercise belongs to.", "// Forbid conversion between normal course exercise and exam exercise", "// Avoid recursions" ]
[ { "param": "textExercise", "type": "TextExercise" }, { "param": "notificationText", "type": "String" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "textExercise", "type": "TextExercise", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "notificationText", "type": "String", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 6426, 3233, 2932, 19, 955, 17, 8913, 71, 6141, 7923, 203, 565, 632, 1386, 18987, 2932, 5332, 2996, 2668, 13208, 23291, 13, 203, 565, 1071, 2306, 1943, 32, 1528, 424, 20603, 34, 1089, 1528, 424, 20603, 26964, 28843, 3867, 424, 20603, 977, 424, 20603, 16, 203, 5411, 632, 691, 786, 12, 1132, 273, 315, 9927, 1528, 3113, 1931, 273, 629, 13, 514, 3851, 1528, 13, 1216, 19883, 288, 203, 3639, 613, 18, 4148, 2932, 12030, 590, 358, 1089, 3867, 424, 20603, 294, 3728, 16, 977, 424, 20603, 1769, 203, 3639, 309, 261, 955, 424, 20603, 18, 26321, 1435, 422, 446, 13, 288, 203, 5411, 327, 752, 1528, 424, 20603, 12, 955, 424, 20603, 1769, 203, 3639, 289, 203, 203, 3639, 368, 11964, 7470, 1947, 30, 3143, 16, 7811, 203, 3639, 24165, 1179, 18, 5662, 12580, 2628, 12, 955, 424, 20603, 1769, 203, 203, 3639, 368, 2364, 431, 12610, 6141, 1240, 444, 3344, 279, 4362, 578, 392, 24165, 1114, 203, 3639, 977, 424, 20603, 18, 1893, 39, 3117, 1876, 424, 20603, 1114, 424, 830, 407, 2818, 12, 11101, 67, 1985, 1769, 203, 203, 3639, 368, 10708, 326, 4362, 1879, 326, 24165, 1114, 578, 326, 864, 4362, 548, 203, 3639, 385, 3117, 4362, 273, 4362, 1179, 18, 17466, 39, 3117, 4851, 424, 20603, 1114, 1162, 39, 3117, 548, 12, 955, 424, 20603, 1769, 203, 203, 3639, 368, 2073, 716, 326, 729, 353, 10799, 358, 1089, 326, 24165, 203, 3639, 2177, 729, 273, 729, 3305, 18, 588, 1299, 1190, 3621, 1876, 3594, 1961, 5621, 203, 3639, 309, 16051, 1944, 1564, 1179, 18, 291, 25070, 6946, 382, 39, 3117, 12, 5566, 16, 729, 3719, 288, 203, 5411, 327, 17987, 5621, 203, 3639, 289, 203, 3639, 3867, 424, 20603, 977, 424, 20603, 4649, 1891, 273, 977, 424, 20603, 3305, 18, 4720, 5132, 12427, 8282, 12, 955, 424, 20603, 18, 26321, 10663, 203, 203, 3639, 368, 2457, 19773, 12770, 326, 4362, 326, 24165, 11081, 358, 18, 203, 3639, 309, 16051, 4710, 18, 14963, 12, 955, 424, 20603, 4649, 1891, 18, 588, 39, 3117, 21246, 424, 20603, 1114, 1162, 39, 3117, 4419, 7675, 26321, 9334, 977, 424, 20603, 18, 588, 39, 3117, 21246, 424, 20603, 1114, 1162, 39, 3117, 4419, 7675, 26321, 1435, 3719, 288, 203, 5411, 327, 7546, 2932, 424, 20603, 4362, 612, 1552, 486, 845, 326, 4041, 4362, 612, 3113, 17020, 67, 1985, 16, 315, 12892, 3043, 39, 3117, 548, 8863, 203, 3639, 289, 203, 203, 3639, 368, 2457, 19773, 4105, 3086, 2212, 4362, 24165, 471, 19707, 24165, 203, 3639, 24165, 1179, 18, 1893, 1290, 6814, 11831, 424, 301, 1876, 39, 3117, 424, 20603, 12, 955, 424, 20603, 16, 977, 424, 20603, 4649, 1891, 16, 17020, 67, 1985, 1769, 203, 203, 3639, 3867, 424, 20603, 3526, 1528, 424, 20603, 273, 977, 424, 20603, 3305, 18, 5688, 12, 955, 424, 20603, 1769, 203, 3639, 24165, 1179, 18, 1330, 1891, 12, 7007, 1528, 424, 20603, 16, 3526, 1528, 424, 20603, 18, 588, 39, 3117, 21246, 424, 20603, 1114, 1162, 39, 3117, 4419, 9334, 729, 1769, 203, 3639, 24165, 1179, 18, 2725, 5636, 2 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
[ 1, 26873, 203, 377, 380, 11443, 342, 955, 17, 8913, 71, 6141, 294, 15419, 392, 2062, 977, 424, 20603, 18, 203, 377, 380, 203, 377, 380, 632, 891, 977, 424, 20603, 377, 326, 977, 424, 20603, 358, 1089, 203, 377, 380, 632, 891, 3851, 1528, 2973, 326, 977, 24165, 1089, 716, 1410, 506, 10453, 364, 326, 203, 377, 380, 7682, 18110, 1041, 203, 377, 380, 632, 2463, 326, 2306, 1943, 598, 1267, 4044, 261, 3141, 13, 471, 598, 1417, 326, 3526, 977, 424, 20603, 16, 578, 203, 377, 380, 598, 1267, 7409, 261, 6434, 1567, 13, 309, 326, 977, 424, 20603, 353, 486, 923, 16, 578, 598, 1267, 6604, 261, 3061, 203, 377, 380, 3224, 1068, 13, 309, 326, 977, 424, 20603, 17991, 1404, 506, 3526, 203, 2 ]
7ad954fa7cfd587aa60e2989a2c860407be9395b
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/web/rest/TextExerciseResource.java
[ "MIT" ]
Java
exportSubmissions
null
@PostMapping("/text-exercises/{exerciseId}/export-submissions") @PreAuthorize("hasRole('TA')") public ResponseEntity<Resource> exportSubmissions(@PathVariable long exerciseId, @RequestBody SubmissionExportOptionsDTO submissionExportOptions) { TextExercise textExercise = textExerciseRepository.findByIdElseThrow(exerciseId); authCheckService.checkHasAtLeastRoleForExerciseElseThrow(Role.TEACHING_ASSISTANT, textExercise, null); // TAs are not allowed to download all participations if (submissionExportOptions.isExportAllParticipants()) { authCheckService.checkHasAtLeastRoleInCourseElseThrow(Role.INSTRUCTOR, textExercise.getCourseViaExerciseGroupOrCourseMember(), null); } File zipFile = textSubmissionExportService.exportStudentSubmissionsElseThrow(exerciseId, submissionExportOptions); return ResponseUtil.ok(zipFile); }
/** * POST /text-exercises/:exerciseId/export-submissions : sends exercise submissions as zip * * @param exerciseId the id of the exercise to get the repos from * @param submissionExportOptions the options that should be used for the export * @return ResponseEntity with status */
POST /text-exercises/:exerciseId/export-submissions : sends exercise submissions as zip @param exerciseId the id of the exercise to get the repos from @param submissionExportOptions the options that should be used for the export @return ResponseEntity with status
[ "POST", "/", "text", "-", "exercises", "/", ":", "exerciseId", "/", "export", "-", "submissions", ":", "sends", "exercise", "submissions", "as", "zip", "@param", "exerciseId", "the", "id", "of", "the", "exercise", "to", "get", "the", "repos", "from", "@param", "submissionExportOptions", "the", "options", "that", "should", "be", "used", "for", "the", "export", "@return", "ResponseEntity", "with", "status" ]
@PostMapping("/text-exercises/{exerciseId}/export-submissions") @PreAuthorize("hasRole('TA')") public ResponseEntity<Resource> exportSubmissions(@PathVariable long exerciseId, @RequestBody SubmissionExportOptionsDTO submissionExportOptions) { TextExercise textExercise = textExerciseRepository.findByIdElseThrow(exerciseId); authCheckService.checkHasAtLeastRoleForExerciseElseThrow(Role.TEACHING_ASSISTANT, textExercise, null); if (submissionExportOptions.isExportAllParticipants()) { authCheckService.checkHasAtLeastRoleInCourseElseThrow(Role.INSTRUCTOR, textExercise.getCourseViaExerciseGroupOrCourseMember(), null); } File zipFile = textSubmissionExportService.exportStudentSubmissionsElseThrow(exerciseId, submissionExportOptions); return ResponseUtil.ok(zipFile); }
[ "@", "PostMapping", "(", "\"/text-exercises/{exerciseId}/export-submissions\"", ")", "@", "PreAuthorize", "(", "\"hasRole('TA')\"", ")", "public", "ResponseEntity", "<", "Resource", ">", "exportSubmissions", "(", "@", "PathVariable", "long", "exerciseId", ",", "@", "RequestBody", "SubmissionExportOptionsDTO", "submissionExportOptions", ")", "{", "TextExercise", "textExercise", "=", "textExerciseRepository", ".", "findByIdElseThrow", "(", "exerciseId", ")", ";", "authCheckService", ".", "checkHasAtLeastRoleForExerciseElseThrow", "(", "Role", ".", "TEACHING_ASSISTANT", ",", "textExercise", ",", "null", ")", ";", "if", "(", "submissionExportOptions", ".", "isExportAllParticipants", "(", ")", ")", "{", "authCheckService", ".", "checkHasAtLeastRoleInCourseElseThrow", "(", "Role", ".", "INSTRUCTOR", ",", "textExercise", ".", "getCourseViaExerciseGroupOrCourseMember", "(", ")", ",", "null", ")", ";", "}", "File", "zipFile", "=", "textSubmissionExportService", ".", "exportStudentSubmissionsElseThrow", "(", "exerciseId", ",", "submissionExportOptions", ")", ";", "return", "ResponseUtil", ".", "ok", "(", "zipFile", ")", ";", "}" ]
POST /text-exercises/:exerciseId/export-submissions : sends exercise submissions as zip @param exerciseId the id of the exercise to get the repos from @param submissionExportOptions the options that should be used for the export @return ResponseEntity with status
[ "POST", "/", "text", "-", "exercises", "/", ":", "exerciseId", "/", "export", "-", "submissions", ":", "sends", "exercise", "submissions", "as", "zip", "@param", "exerciseId", "the", "id", "of", "the", "exercise", "to", "get", "the", "repos", "from", "@param", "submissionExportOptions", "the", "options", "that", "should", "be", "used", "for", "the", "export", "@return", "ResponseEntity", "with", "status" ]
[ "// TAs are not allowed to download all participations" ]
[ { "param": "exerciseId", "type": "long" }, { "param": "submissionExportOptions", "type": "SubmissionExportOptionsDTO" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "exerciseId", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "submissionExportOptions", "type": "SubmissionExportOptionsDTO", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 3349, 3233, 2932, 19, 955, 17, 8913, 71, 6141, 4938, 8913, 30708, 548, 4004, 6530, 17, 25675, 7923, 203, 565, 632, 1386, 18987, 2932, 5332, 2996, 2668, 9833, 23291, 13, 203, 565, 1071, 2306, 1943, 32, 1420, 34, 3359, 1676, 7300, 26964, 743, 3092, 1525, 24165, 548, 16, 632, 28843, 2592, 3951, 6144, 1320, 19792, 8515, 6144, 1320, 13, 288, 203, 203, 3639, 3867, 424, 20603, 977, 424, 20603, 273, 977, 424, 20603, 3305, 18, 4720, 5132, 12427, 8282, 12, 8913, 30708, 548, 1769, 203, 203, 3639, 1357, 1564, 1179, 18, 1893, 5582, 25070, 2996, 1290, 424, 20603, 12427, 8282, 12, 2996, 18, 1448, 18133, 1360, 67, 8423, 5511, 6856, 16, 977, 424, 20603, 16, 446, 1769, 203, 203, 3639, 368, 399, 1463, 854, 486, 2935, 358, 4224, 777, 30891, 1012, 203, 3639, 309, 261, 12684, 6144, 1320, 18, 291, 6144, 1595, 1988, 27620, 10756, 288, 203, 5411, 1357, 1564, 1179, 18, 1893, 5582, 25070, 2996, 382, 39, 3117, 12427, 8282, 12, 2996, 18, 706, 13915, 916, 16, 977, 424, 20603, 18, 588, 39, 3117, 21246, 424, 20603, 1114, 1162, 39, 3117, 4419, 9334, 446, 1769, 203, 3639, 289, 203, 203, 3639, 1387, 19450, 273, 977, 17865, 6144, 1179, 18, 6530, 19943, 319, 1676, 7300, 12427, 8282, 12, 8913, 30708, 548, 16, 8515, 6144, 1320, 1769, 203, 3639, 327, 2306, 1304, 18, 601, 12, 4450, 812, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 5485, 342, 955, 17, 8913, 71, 6141, 16880, 8913, 30708, 548, 19, 6530, 17, 25675, 294, 9573, 24165, 22071, 487, 3144, 203, 377, 380, 203, 377, 380, 632, 891, 24165, 548, 2868, 326, 612, 434, 326, 24165, 358, 336, 326, 13686, 628, 203, 377, 380, 632, 891, 8515, 6144, 1320, 326, 702, 716, 1410, 506, 1399, 364, 326, 3359, 203, 377, 380, 632, 2463, 2306, 1943, 598, 1267, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
7ad954fa7cfd587aa60e2989a2c860407be9395b
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/web/rest/TextExerciseResource.java
[ "MIT" ]
Java
reEvaluateAndUpdateTextExercise
null
@PutMapping(Endpoints.REEVALUATE_EXERCISE) @PreAuthorize("hasRole('EDITOR')") public ResponseEntity<TextExercise> reEvaluateAndUpdateTextExercise(@PathVariable long exerciseId, @RequestBody TextExercise textExercise, @RequestParam(value = "deleteFeedback", required = false) Boolean deleteFeedbackAfterGradingInstructionUpdate) throws URISyntaxException { log.debug("REST request to re-evaluate TextExercise : {}", textExercise); // check that the exercise is exist for given id textExerciseRepository.findByIdWithStudentParticipationsAndSubmissionsElseThrow(exerciseId); authCheckService.checkGivenExerciseIdSameForExerciseInRequestBodyElseThrow(exerciseId, textExercise); Course course = courseService.retrieveCourseOverExerciseGroupOrCourseId(textExercise); // Check that the user is authorized to update the exercise User user = userRepository.getUserWithGroupsAndAuthorities(); authCheckService.checkHasAtLeastRoleInCourseElseThrow(Role.EDITOR, course, user); exerciseService.reEvaluateExercise(textExercise, deleteFeedbackAfterGradingInstructionUpdate); return updateTextExercise(textExercise, null); }
/** * PUT /text-exercises/{exerciseId}/re-evaluate : Re-evaluates and updates an existing textExercise. * * @param exerciseId of the exercise * @param textExercise the textExercise to re-evaluate and update * @param deleteFeedbackAfterGradingInstructionUpdate boolean flag that indicates whether the associated feedback should be deleted or not * * @return the ResponseEntity with status 200 (OK) and with body the updated textExercise, or * with status 400 (Bad Request) if the textExercise is not valid, or with status 409 (Conflict) * if given exerciseId is not same as in the object of the request body, or with status 500 * (Internal Server Error) if the textExercise couldn't be updated * @throws URISyntaxException if the Location URI syntax is incorrect */
PUT /text-exercises/{exerciseId}/re-evaluate : Re-evaluates and updates an existing textExercise. @param exerciseId of the exercise @param textExercise the textExercise to re-evaluate and update @param deleteFeedbackAfterGradingInstructionUpdate boolean flag that indicates whether the associated feedback should be deleted or not @return the ResponseEntity with status 200 (OK) and with body the updated textExercise, or with status 400 (Bad Request) if the textExercise is not valid, or with status 409 (Conflict) if given exerciseId is not same as in the object of the request body, or with status 500 (Internal Server Error) if the textExercise couldn't be updated @throws URISyntaxException if the Location URI syntax is incorrect
[ "PUT", "/", "text", "-", "exercises", "/", "{", "exerciseId", "}", "/", "re", "-", "evaluate", ":", "Re", "-", "evaluates", "and", "updates", "an", "existing", "textExercise", ".", "@param", "exerciseId", "of", "the", "exercise", "@param", "textExercise", "the", "textExercise", "to", "re", "-", "evaluate", "and", "update", "@param", "deleteFeedbackAfterGradingInstructionUpdate", "boolean", "flag", "that", "indicates", "whether", "the", "associated", "feedback", "should", "be", "deleted", "or", "not", "@return", "the", "ResponseEntity", "with", "status", "200", "(", "OK", ")", "and", "with", "body", "the", "updated", "textExercise", "or", "with", "status", "400", "(", "Bad", "Request", ")", "if", "the", "textExercise", "is", "not", "valid", "or", "with", "status", "409", "(", "Conflict", ")", "if", "given", "exerciseId", "is", "not", "same", "as", "in", "the", "object", "of", "the", "request", "body", "or", "with", "status", "500", "(", "Internal", "Server", "Error", ")", "if", "the", "textExercise", "couldn", "'", "t", "be", "updated", "@throws", "URISyntaxException", "if", "the", "Location", "URI", "syntax", "is", "incorrect" ]
@PutMapping(Endpoints.REEVALUATE_EXERCISE) @PreAuthorize("hasRole('EDITOR')") public ResponseEntity<TextExercise> reEvaluateAndUpdateTextExercise(@PathVariable long exerciseId, @RequestBody TextExercise textExercise, @RequestParam(value = "deleteFeedback", required = false) Boolean deleteFeedbackAfterGradingInstructionUpdate) throws URISyntaxException { log.debug("REST request to re-evaluate TextExercise : {}", textExercise); textExerciseRepository.findByIdWithStudentParticipationsAndSubmissionsElseThrow(exerciseId); authCheckService.checkGivenExerciseIdSameForExerciseInRequestBodyElseThrow(exerciseId, textExercise); Course course = courseService.retrieveCourseOverExerciseGroupOrCourseId(textExercise); User user = userRepository.getUserWithGroupsAndAuthorities(); authCheckService.checkHasAtLeastRoleInCourseElseThrow(Role.EDITOR, course, user); exerciseService.reEvaluateExercise(textExercise, deleteFeedbackAfterGradingInstructionUpdate); return updateTextExercise(textExercise, null); }
[ "@", "PutMapping", "(", "Endpoints", ".", "REEVALUATE_EXERCISE", ")", "@", "PreAuthorize", "(", "\"hasRole('EDITOR')\"", ")", "public", "ResponseEntity", "<", "TextExercise", ">", "reEvaluateAndUpdateTextExercise", "(", "@", "PathVariable", "long", "exerciseId", ",", "@", "RequestBody", "TextExercise", "textExercise", ",", "@", "RequestParam", "(", "value", "=", "\"deleteFeedback\"", ",", "required", "=", "false", ")", "Boolean", "deleteFeedbackAfterGradingInstructionUpdate", ")", "throws", "URISyntaxException", "{", "log", ".", "debug", "(", "\"REST request to re-evaluate TextExercise : {}\"", ",", "textExercise", ")", ";", "textExerciseRepository", ".", "findByIdWithStudentParticipationsAndSubmissionsElseThrow", "(", "exerciseId", ")", ";", "authCheckService", ".", "checkGivenExerciseIdSameForExerciseInRequestBodyElseThrow", "(", "exerciseId", ",", "textExercise", ")", ";", "Course", "course", "=", "courseService", ".", "retrieveCourseOverExerciseGroupOrCourseId", "(", "textExercise", ")", ";", "User", "user", "=", "userRepository", ".", "getUserWithGroupsAndAuthorities", "(", ")", ";", "authCheckService", ".", "checkHasAtLeastRoleInCourseElseThrow", "(", "Role", ".", "EDITOR", ",", "course", ",", "user", ")", ";", "exerciseService", ".", "reEvaluateExercise", "(", "textExercise", ",", "deleteFeedbackAfterGradingInstructionUpdate", ")", ";", "return", "updateTextExercise", "(", "textExercise", ",", "null", ")", ";", "}" ]
PUT /text-exercises/{exerciseId}/re-evaluate : Re-evaluates and updates an existing textExercise.
[ "PUT", "/", "text", "-", "exercises", "/", "{", "exerciseId", "}", "/", "re", "-", "evaluate", ":", "Re", "-", "evaluates", "and", "updates", "an", "existing", "textExercise", "." ]
[ "// check that the exercise is exist for given id", "// Check that the user is authorized to update the exercise" ]
[ { "param": "exerciseId", "type": "long" }, { "param": "textExercise", "type": "TextExercise" }, { "param": "deleteFeedbackAfterGradingInstructionUpdate", "type": "Boolean" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "exerciseId", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "textExercise", "type": "TextExercise", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "deleteFeedbackAfterGradingInstructionUpdate", "type": "Boolean", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 6426, 3233, 12, 10357, 18, 9719, 2669, 57, 1777, 67, 2294, 654, 7266, 1090, 13, 203, 565, 632, 1386, 18987, 2932, 5332, 2996, 2668, 13208, 23291, 13, 203, 565, 1071, 2306, 1943, 32, 1528, 424, 20603, 34, 283, 15369, 1876, 1891, 1528, 424, 20603, 26964, 743, 3092, 1525, 24165, 548, 16, 632, 28843, 3867, 424, 20603, 977, 424, 20603, 16, 203, 5411, 632, 691, 786, 12, 1132, 273, 315, 3733, 15888, 3113, 1931, 273, 629, 13, 3411, 1430, 15888, 4436, 30420, 310, 11983, 1891, 13, 1216, 19883, 288, 203, 3639, 613, 18, 4148, 2932, 12030, 590, 358, 283, 17, 21024, 3867, 424, 20603, 294, 3728, 16, 977, 424, 20603, 1769, 203, 203, 3639, 368, 866, 716, 326, 24165, 353, 1005, 364, 864, 612, 203, 3639, 977, 424, 20603, 3305, 18, 4720, 5132, 1190, 19943, 319, 1988, 24629, 1012, 1876, 1676, 7300, 12427, 8282, 12, 8913, 30708, 548, 1769, 203, 203, 3639, 1357, 1564, 1179, 18, 1893, 6083, 424, 20603, 548, 8650, 1290, 424, 20603, 382, 28843, 12427, 8282, 12, 8913, 30708, 548, 16, 977, 424, 20603, 1769, 203, 203, 3639, 385, 3117, 4362, 273, 4362, 1179, 18, 17466, 39, 3117, 4851, 424, 20603, 1114, 1162, 39, 3117, 548, 12, 955, 424, 20603, 1769, 203, 203, 3639, 368, 2073, 716, 326, 729, 353, 10799, 358, 1089, 326, 24165, 203, 3639, 2177, 729, 273, 729, 3305, 18, 588, 1299, 1190, 3621, 1876, 3594, 1961, 5621, 203, 3639, 1357, 1564, 1179, 18, 1893, 5582, 25070, 2996, 382, 39, 3117, 12427, 8282, 12, 2996, 18, 13208, 16, 4362, 16, 729, 1769, 203, 203, 3639, 24165, 1179, 18, 266, 15369, 424, 20603, 12, 955, 424, 20603, 16, 1430, 15888, 4436, 30420, 310, 11983, 1891, 1769, 203, 203, 3639, 327, 1089, 1528, 424, 20603, 12, 955, 424, 20603, 16, 446, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 11443, 342, 955, 17, 8913, 71, 6141, 4938, 8913, 30708, 548, 4004, 266, 17, 21024, 294, 868, 17, 14168, 815, 471, 4533, 392, 2062, 977, 424, 20603, 18, 203, 377, 380, 203, 377, 380, 632, 891, 24165, 548, 4766, 282, 434, 326, 24165, 203, 377, 380, 632, 891, 977, 424, 20603, 4766, 326, 977, 424, 20603, 358, 283, 17, 21024, 471, 1089, 203, 377, 380, 632, 891, 1430, 15888, 4436, 30420, 310, 11983, 1891, 225, 1250, 2982, 716, 8527, 2856, 326, 3627, 10762, 1410, 506, 4282, 578, 486, 203, 377, 380, 203, 377, 380, 632, 2463, 326, 2306, 1943, 598, 1267, 4044, 261, 3141, 13, 471, 598, 1417, 326, 3526, 977, 424, 20603, 16, 578, 203, 377, 380, 598, 1267, 7409, 261, 2 ]
9eaa68917a9f67d11333c790b90c8ce530c631b8
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/service/metis/ReactionService.java
[ "MIT" ]
Java
createReaction
Reaction
public Reaction createReaction(Reaction reaction) { Posting posting = reaction.getPost() == null ? reaction.getAnswerPost() : reaction.getPost(); // checks User user = this.userRepository.getUserWithGroupsAndAuthorities(); if (reaction.getId() != null) { throw new BadRequestAlertException("A new reaction cannot already have an ID", METIS_REACTION_ENTITY_NAME, "idexists"); } // set user to current user reaction.setUser(user); // we query the repository dependent on the type of posting and update this posting Reaction savedReaction; if (posting instanceof Post) { Post post = postService.findById(posting.getId()); reaction.setPost(post); // save reaction savedReaction = reactionRepository.save(reaction); // save post postService.updateWithReaction(post, reaction); } else { AnswerPost answerPost = answerPostService.findById(posting.getId()); reaction.setAnswerPost(answerPost); // save reaction savedReaction = reactionRepository.save(reaction); // save answer post answerPostService.updateWithReaction(answerPost, reaction); } return savedReaction; }
/** * Checks reaction validity, determines the reaction's user, * retrieves the associated posting and persists the mutual association * * @param reaction reaction to create * @return created reaction that was persisted */
Checks reaction validity, determines the reaction's user, retrieves the associated posting and persists the mutual association @param reaction reaction to create @return created reaction that was persisted
[ "Checks", "reaction", "validity", "determines", "the", "reaction", "'", "s", "user", "retrieves", "the", "associated", "posting", "and", "persists", "the", "mutual", "association", "@param", "reaction", "reaction", "to", "create", "@return", "created", "reaction", "that", "was", "persisted" ]
public Reaction createReaction(Reaction reaction) { Posting posting = reaction.getPost() == null ? reaction.getAnswerPost() : reaction.getPost(); User user = this.userRepository.getUserWithGroupsAndAuthorities(); if (reaction.getId() != null) { throw new BadRequestAlertException("A new reaction cannot already have an ID", METIS_REACTION_ENTITY_NAME, "idexists"); } reaction.setUser(user); Reaction savedReaction; if (posting instanceof Post) { Post post = postService.findById(posting.getId()); reaction.setPost(post); savedReaction = reactionRepository.save(reaction); postService.updateWithReaction(post, reaction); } else { AnswerPost answerPost = answerPostService.findById(posting.getId()); reaction.setAnswerPost(answerPost); savedReaction = reactionRepository.save(reaction); answerPostService.updateWithReaction(answerPost, reaction); } return savedReaction; }
[ "public", "Reaction", "createReaction", "(", "Reaction", "reaction", ")", "{", "Posting", "posting", "=", "reaction", ".", "getPost", "(", ")", "==", "null", "?", "reaction", ".", "getAnswerPost", "(", ")", ":", "reaction", ".", "getPost", "(", ")", ";", "User", "user", "=", "this", ".", "userRepository", ".", "getUserWithGroupsAndAuthorities", "(", ")", ";", "if", "(", "reaction", ".", "getId", "(", ")", "!=", "null", ")", "{", "throw", "new", "BadRequestAlertException", "(", "\"A new reaction cannot already have an ID\"", ",", "METIS_REACTION_ENTITY_NAME", ",", "\"idexists\"", ")", ";", "}", "reaction", ".", "setUser", "(", "user", ")", ";", "Reaction", "savedReaction", ";", "if", "(", "posting", "instanceof", "Post", ")", "{", "Post", "post", "=", "postService", ".", "findById", "(", "posting", ".", "getId", "(", ")", ")", ";", "reaction", ".", "setPost", "(", "post", ")", ";", "savedReaction", "=", "reactionRepository", ".", "save", "(", "reaction", ")", ";", "postService", ".", "updateWithReaction", "(", "post", ",", "reaction", ")", ";", "}", "else", "{", "AnswerPost", "answerPost", "=", "answerPostService", ".", "findById", "(", "posting", ".", "getId", "(", ")", ")", ";", "reaction", ".", "setAnswerPost", "(", "answerPost", ")", ";", "savedReaction", "=", "reactionRepository", ".", "save", "(", "reaction", ")", ";", "answerPostService", ".", "updateWithReaction", "(", "answerPost", ",", "reaction", ")", ";", "}", "return", "savedReaction", ";", "}" ]
Checks reaction validity, determines the reaction's user, retrieves the associated posting and persists the mutual association
[ "Checks", "reaction", "validity", "determines", "the", "reaction", "'", "s", "user", "retrieves", "the", "associated", "posting", "and", "persists", "the", "mutual", "association" ]
[ "// checks", "// set user to current user", "// we query the repository dependent on the type of posting and update this posting", "// save reaction", "// save post", "// save reaction", "// save answer post" ]
[ { "param": "reaction", "type": "Reaction" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "reaction", "type": "Reaction", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 868, 1128, 752, 21581, 12, 21581, 12836, 13, 288, 203, 3639, 5616, 310, 1603, 310, 273, 12836, 18, 588, 3349, 1435, 422, 446, 692, 12836, 18, 588, 13203, 3349, 1435, 294, 12836, 18, 588, 3349, 5621, 203, 203, 3639, 368, 4271, 203, 3639, 2177, 729, 273, 333, 18, 1355, 3305, 18, 588, 1299, 1190, 3621, 1876, 3594, 1961, 5621, 203, 3639, 309, 261, 266, 1128, 18, 26321, 1435, 480, 446, 13, 288, 203, 5411, 604, 394, 23223, 13298, 503, 2932, 37, 394, 12836, 2780, 1818, 1240, 392, 1599, 3113, 6791, 5127, 67, 862, 12249, 67, 11101, 67, 1985, 16, 315, 77, 561, 1486, 8863, 203, 3639, 289, 203, 203, 3639, 368, 444, 729, 358, 783, 729, 203, 3639, 12836, 18, 542, 1299, 12, 1355, 1769, 203, 203, 3639, 368, 732, 843, 326, 3352, 10460, 603, 326, 618, 434, 1603, 310, 471, 1089, 333, 1603, 310, 203, 3639, 868, 1128, 5198, 21581, 31, 203, 3639, 309, 261, 2767, 310, 1276, 5616, 13, 288, 203, 5411, 5616, 1603, 273, 1603, 1179, 18, 4720, 5132, 12, 2767, 310, 18, 26321, 10663, 203, 5411, 12836, 18, 542, 3349, 12, 2767, 1769, 203, 5411, 368, 1923, 12836, 203, 5411, 5198, 21581, 273, 12836, 3305, 18, 5688, 12, 266, 1128, 1769, 203, 5411, 368, 1923, 1603, 203, 5411, 1603, 1179, 18, 2725, 1190, 21581, 12, 2767, 16, 12836, 1769, 203, 3639, 289, 203, 3639, 469, 288, 203, 5411, 21019, 3349, 5803, 3349, 273, 5803, 3349, 1179, 18, 4720, 5132, 12, 2767, 310, 18, 26321, 10663, 203, 5411, 12836, 18, 542, 13203, 3349, 12, 13490, 3349, 1769, 203, 5411, 368, 1923, 12836, 203, 5411, 5198, 21581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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 13074, 12836, 13800, 16, 12949, 326, 12836, 1807, 729, 16, 203, 377, 380, 9023, 326, 3627, 1603, 310, 471, 13508, 1486, 326, 4318, 1462, 6384, 203, 377, 380, 203, 377, 380, 632, 891, 12836, 12836, 358, 752, 203, 377, 380, 632, 2463, 2522, 12836, 716, 1703, 14249, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
9eaa68917a9f67d11333c790b90c8ce530c631b8
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/service/metis/ReactionService.java
[ "MIT" ]
Java
deleteReactionById
null
public void deleteReactionById(Long reactionId) { User user = userRepository.getUserWithGroupsAndAuthorities(); Reaction reaction = reactionRepository.findByIdElseThrow(reactionId); // check if user that wants to delete reaction is user that created the reaction if (!user.equals(reaction.getUser())) { throw new AccessForbiddenException("Reaction", reaction.getId()); } reactionRepository.deleteById(reactionId); }
/** * Determines authority to delete reaction and deletes the reaction * * @param reactionId id of the reaction to delete */
Determines authority to delete reaction and deletes the reaction @param reactionId id of the reaction to delete
[ "Determines", "authority", "to", "delete", "reaction", "and", "deletes", "the", "reaction", "@param", "reactionId", "id", "of", "the", "reaction", "to", "delete" ]
public void deleteReactionById(Long reactionId) { User user = userRepository.getUserWithGroupsAndAuthorities(); Reaction reaction = reactionRepository.findByIdElseThrow(reactionId); if (!user.equals(reaction.getUser())) { throw new AccessForbiddenException("Reaction", reaction.getId()); } reactionRepository.deleteById(reactionId); }
[ "public", "void", "deleteReactionById", "(", "Long", "reactionId", ")", "{", "User", "user", "=", "userRepository", ".", "getUserWithGroupsAndAuthorities", "(", ")", ";", "Reaction", "reaction", "=", "reactionRepository", ".", "findByIdElseThrow", "(", "reactionId", ")", ";", "if", "(", "!", "user", ".", "equals", "(", "reaction", ".", "getUser", "(", ")", ")", ")", "{", "throw", "new", "AccessForbiddenException", "(", "\"Reaction\"", ",", "reaction", ".", "getId", "(", ")", ")", ";", "}", "reactionRepository", ".", "deleteById", "(", "reactionId", ")", ";", "}" ]
Determines authority to delete reaction and deletes the reaction @param reactionId id of the reaction to delete
[ "Determines", "authority", "to", "delete", "reaction", "and", "deletes", "the", "reaction", "@param", "reactionId", "id", "of", "the", "reaction", "to", "delete" ]
[ "// check if user that wants to delete reaction is user that created the reaction" ]
[ { "param": "reactionId", "type": "Long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "reactionId", "type": "Long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 918, 1430, 21581, 5132, 12, 3708, 12836, 548, 13, 288, 203, 3639, 2177, 729, 273, 729, 3305, 18, 588, 1299, 1190, 3621, 1876, 3594, 1961, 5621, 203, 3639, 868, 1128, 12836, 273, 12836, 3305, 18, 4720, 5132, 12427, 8282, 12, 266, 1128, 548, 1769, 203, 203, 3639, 368, 866, 309, 729, 716, 14805, 358, 1430, 12836, 353, 729, 716, 2522, 326, 12836, 203, 3639, 309, 16051, 1355, 18, 14963, 12, 266, 1128, 18, 588, 1299, 1435, 3719, 288, 203, 5411, 604, 394, 5016, 16553, 503, 2932, 21581, 3113, 12836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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 30778, 11675, 358, 1430, 12836, 471, 9792, 326, 12836, 203, 377, 380, 203, 377, 380, 632, 891, 12836, 548, 612, 434, 326, 12836, 358, 1430, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
fd9718da832315ef7cef8cec42e1f493fd5844ee
ls1intum/Artemis
src/test/java/de/tum/in/www1/artemis/NotificationSettingsResourceIntegrationTest.java
[ "MIT" ]
Java
initTestCase
null
@BeforeEach public void initTestCase() { List<User> users = database.addUsers(2, 1, 1, 1); User student1 = users.get(0); users.set(0, student1); userRepository.save(student1); settingA = new NotificationSetting(student1, true, false, "notification.lecture-notification.attachment-changes"); settingsB = new NotificationSetting(student1, false, false, "notification.exercise-notification.exercise-open-for-practice"); }
/** * Prepares the common variables and data for testing */
Prepares the common variables and data for testing
[ "Prepares", "the", "common", "variables", "and", "data", "for", "testing" ]
@BeforeEach public void initTestCase() { List<User> users = database.addUsers(2, 1, 1, 1); User student1 = users.get(0); users.set(0, student1); userRepository.save(student1); settingA = new NotificationSetting(student1, true, false, "notification.lecture-notification.attachment-changes"); settingsB = new NotificationSetting(student1, false, false, "notification.exercise-notification.exercise-open-for-practice"); }
[ "@", "BeforeEach", "public", "void", "initTestCase", "(", ")", "{", "List", "<", "User", ">", "users", "=", "database", ".", "addUsers", "(", "2", ",", "1", ",", "1", ",", "1", ")", ";", "User", "student1", "=", "users", ".", "get", "(", "0", ")", ";", "users", ".", "set", "(", "0", ",", "student1", ")", ";", "userRepository", ".", "save", "(", "student1", ")", ";", "settingA", "=", "new", "NotificationSetting", "(", "student1", ",", "true", ",", "false", ",", "\"notification.lecture-notification.attachment-changes\"", ")", ";", "settingsB", "=", "new", "NotificationSetting", "(", "student1", ",", "false", ",", "false", ",", "\"notification.exercise-notification.exercise-open-for-practice\"", ")", ";", "}" ]
Prepares the common variables and data for testing
[ "Prepares", "the", "common", "variables", "and", "data", "for", "testing" ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 4649, 3442, 203, 565, 1071, 918, 1208, 4709, 2449, 1435, 288, 203, 3639, 987, 32, 1299, 34, 3677, 273, 2063, 18, 1289, 6588, 12, 22, 16, 404, 16, 404, 16, 404, 1769, 203, 203, 3639, 2177, 18110, 21, 273, 3677, 18, 588, 12, 20, 1769, 203, 3639, 3677, 18, 542, 12, 20, 16, 18110, 21, 1769, 203, 3639, 729, 3305, 18, 5688, 12, 26240, 21, 1769, 203, 203, 3639, 3637, 37, 273, 394, 8050, 5568, 12, 26240, 21, 16, 638, 16, 629, 16, 315, 9927, 18, 1582, 594, 17, 9927, 18, 11461, 17, 6329, 8863, 203, 3639, 1947, 38, 273, 394, 8050, 5568, 12, 26240, 21, 16, 629, 16, 629, 16, 315, 9927, 18, 8913, 30708, 17, 9927, 18, 8913, 30708, 17, 3190, 17, 1884, 17, 84, 14266, 1812, 8863, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 2962, 84, 4807, 326, 2975, 3152, 471, 501, 364, 7769, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
fd9718da832315ef7cef8cec42e1f493fd5844ee
ls1intum/Artemis
src/test/java/de/tum/in/www1/artemis/NotificationSettingsResourceIntegrationTest.java
[ "MIT" ]
Java
tearDown
null
@AfterEach public void tearDown() { database.resetDatabase(); notificationSettingRepository.deleteAll(); }
/** * Cleans the test environment to make sure different test do not influence each other */
Cleans the test environment to make sure different test do not influence each other
[ "Cleans", "the", "test", "environment", "to", "make", "sure", "different", "test", "do", "not", "influence", "each", "other" ]
@AfterEach public void tearDown() { database.resetDatabase(); notificationSettingRepository.deleteAll(); }
[ "@", "AfterEach", "public", "void", "tearDown", "(", ")", "{", "database", ".", "resetDatabase", "(", ")", ";", "notificationSettingRepository", ".", "deleteAll", "(", ")", ";", "}" ]
Cleans the test environment to make sure different test do not influence each other
[ "Cleans", "the", "test", "environment", "to", "make", "sure", "different", "test", "do", "not", "influence", "each", "other" ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 4436, 3442, 203, 565, 1071, 918, 268, 2091, 4164, 1435, 288, 203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3330, 358, 1221, 3071, 3775, 1842, 741, 486, 13947, 23209, 1517, 1308, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
fd9718da832315ef7cef8cec42e1f493fd5844ee
ls1intum/Artemis
src/test/java/de/tum/in/www1/artemis/NotificationSettingsResourceIntegrationTest.java
[ "MIT" ]
Java
testGetNotificationSettingsForCurrentUserWith_DB_NOT_EMPTY
null
@Test @WithMockUser(username = "student1", roles = "USER") public void testGetNotificationSettingsForCurrentUserWith_DB_NOT_EMPTY() throws Exception { notificationSettingRepository.save(settingA); notificationSettingRepository.save(settingsB); List<NotificationSetting> notificationSettings = request.getList("/api/notification-settings", HttpStatus.OK, NotificationSetting.class); assertThat(notificationSettings).as("notificationSettings A with recipient equal to current user is returned").contains(settingA); assertThat(notificationSettings).as("notificationSettings B with recipient equal to current user is returned").contains(settingsB); }
/** * Tests the getNotificationSettingsForCurrentUser method if the user already has saved settings in the DB */
Tests the getNotificationSettingsForCurrentUser method if the user already has saved settings in the DB
[ "Tests", "the", "getNotificationSettingsForCurrentUser", "method", "if", "the", "user", "already", "has", "saved", "settings", "in", "the", "DB" ]
@Test @WithMockUser(username = "student1", roles = "USER") public void testGetNotificationSettingsForCurrentUserWith_DB_NOT_EMPTY() throws Exception { notificationSettingRepository.save(settingA); notificationSettingRepository.save(settingsB); List<NotificationSetting> notificationSettings = request.getList("/api/notification-settings", HttpStatus.OK, NotificationSetting.class); assertThat(notificationSettings).as("notificationSettings A with recipient equal to current user is returned").contains(settingA); assertThat(notificationSettings).as("notificationSettings B with recipient equal to current user is returned").contains(settingsB); }
[ "@", "Test", "@", "WithMockUser", "(", "username", "=", "\"student1\"", ",", "roles", "=", "\"USER\"", ")", "public", "void", "testGetNotificationSettingsForCurrentUserWith_DB_NOT_EMPTY", "(", ")", "throws", "Exception", "{", "notificationSettingRepository", ".", "save", "(", "settingA", ")", ";", "notificationSettingRepository", ".", "save", "(", "settingsB", ")", ";", "List", "<", "NotificationSetting", ">", "notificationSettings", "=", "request", ".", "getList", "(", "\"/api/notification-settings\"", ",", "HttpStatus", ".", "OK", ",", "NotificationSetting", ".", "class", ")", ";", "assertThat", "(", "notificationSettings", ")", ".", "as", "(", "\"notificationSettings A with recipient equal to current user is returned\"", ")", ".", "contains", "(", "settingA", ")", ";", "assertThat", "(", "notificationSettings", ")", ".", "as", "(", "\"notificationSettings B with recipient equal to current user is returned\"", ")", ".", "contains", "(", "settingsB", ")", ";", "}" ]
Tests the getNotificationSettingsForCurrentUser method if the user already has saved settings in the DB
[ "Tests", "the", "getNotificationSettingsForCurrentUser", "method", "if", "the", "user", "already", "has", "saved", "settings", "in", "the", "DB" ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 4709, 203, 565, 632, 1190, 9865, 1299, 12, 5053, 273, 315, 26240, 21, 3113, 4900, 273, 315, 4714, 7923, 203, 565, 1071, 918, 1842, 967, 4386, 2628, 1290, 3935, 1299, 1190, 67, 2290, 67, 4400, 67, 13625, 1435, 1216, 1185, 288, 203, 3639, 3851, 5568, 3305, 18, 5688, 12, 8920, 37, 1769, 203, 3639, 3851, 5568, 3305, 18, 5688, 12, 4272, 38, 1769, 203, 203, 3639, 987, 32, 4386, 5568, 34, 3851, 2628, 273, 590, 18, 588, 682, 2932, 19, 2425, 19, 9927, 17, 4272, 3113, 21153, 18, 3141, 16, 8050, 5568, 18, 1106, 1769, 203, 203, 3639, 1815, 18163, 12, 9927, 2628, 2934, 345, 2932, 9927, 2628, 432, 598, 8027, 3959, 358, 783, 729, 353, 2106, 20387, 12298, 12, 8920, 37, 1769, 203, 3639, 1815, 18163, 12, 9927, 2628, 2934, 345, 2932, 9927, 2628, 605, 598, 8027, 3959, 358, 783, 729, 353, 2106, 20387, 12298, 12, 4272, 38, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 7766, 87, 326, 336, 4386, 2628, 1290, 3935, 1299, 707, 309, 326, 729, 1818, 711, 5198, 1947, 316, 326, 2383, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
fd9718da832315ef7cef8cec42e1f493fd5844ee
ls1intum/Artemis
src/test/java/de/tum/in/www1/artemis/NotificationSettingsResourceIntegrationTest.java
[ "MIT" ]
Java
testGetNotificationSettingsForCurrentUserWith_DB_EMTPY
null
@Test @WithMockUser(username = "student1", roles = "USER") public void testGetNotificationSettingsForCurrentUserWith_DB_EMTPY() throws Exception { List<NotificationSetting> notificationSettings = request.getList("/api/notification-settings", HttpStatus.OK, NotificationSetting.class); assertThat(notificationSettings.size()).isEqualTo(DEFAULT_NOTIFICATION_SETTINGS.size()); }
/** * Tests the getNotificationSettingsForCurrentUser method if the user has not yet saved the settings * The default settings should be returned */
Tests the getNotificationSettingsForCurrentUser method if the user has not yet saved the settings The default settings should be returned
[ "Tests", "the", "getNotificationSettingsForCurrentUser", "method", "if", "the", "user", "has", "not", "yet", "saved", "the", "settings", "The", "default", "settings", "should", "be", "returned" ]
@Test @WithMockUser(username = "student1", roles = "USER") public void testGetNotificationSettingsForCurrentUserWith_DB_EMTPY() throws Exception { List<NotificationSetting> notificationSettings = request.getList("/api/notification-settings", HttpStatus.OK, NotificationSetting.class); assertThat(notificationSettings.size()).isEqualTo(DEFAULT_NOTIFICATION_SETTINGS.size()); }
[ "@", "Test", "@", "WithMockUser", "(", "username", "=", "\"student1\"", ",", "roles", "=", "\"USER\"", ")", "public", "void", "testGetNotificationSettingsForCurrentUserWith_DB_EMTPY", "(", ")", "throws", "Exception", "{", "List", "<", "NotificationSetting", ">", "notificationSettings", "=", "request", ".", "getList", "(", "\"/api/notification-settings\"", ",", "HttpStatus", ".", "OK", ",", "NotificationSetting", ".", "class", ")", ";", "assertThat", "(", "notificationSettings", ".", "size", "(", ")", ")", ".", "isEqualTo", "(", "DEFAULT_NOTIFICATION_SETTINGS", ".", "size", "(", ")", ")", ";", "}" ]
Tests the getNotificationSettingsForCurrentUser method if the user has not yet saved the settings The default settings should be returned
[ "Tests", "the", "getNotificationSettingsForCurrentUser", "method", "if", "the", "user", "has", "not", "yet", "saved", "the", "settings", "The", "default", "settings", "should", "be", "returned" ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 4709, 203, 565, 632, 1190, 9865, 1299, 12, 5053, 273, 315, 26240, 21, 3113, 4900, 273, 315, 4714, 7923, 203, 565, 1071, 918, 1842, 967, 4386, 2628, 1290, 3935, 1299, 1190, 67, 2290, 67, 3375, 11130, 61, 1435, 1216, 1185, 288, 203, 3639, 987, 32, 4386, 5568, 34, 3851, 2628, 273, 590, 18, 588, 682, 2932, 19, 2425, 19, 9927, 17, 4272, 3113, 21153, 18, 3141, 16, 8050, 5568, 18, 1106, 1769, 203, 3639, 1815, 18163, 12, 9927, 2628, 18, 1467, 1435, 2934, 291, 5812, 774, 12, 5280, 67, 4400, 14865, 67, 19428, 18, 1467, 10663, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 7766, 87, 326, 336, 4386, 2628, 1290, 3935, 1299, 707, 309, 326, 729, 711, 486, 4671, 5198, 326, 1947, 203, 377, 380, 1021, 805, 1947, 1410, 506, 2106, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
fd9718da832315ef7cef8cec42e1f493fd5844ee
ls1intum/Artemis
src/test/java/de/tum/in/www1/artemis/NotificationSettingsResourceIntegrationTest.java
[ "MIT" ]
Java
testSaveNotificationSettingsForCurrentUser_OK
null
@Test @WithMockUser(username = "student1", roles = "USER") public void testSaveNotificationSettingsForCurrentUser_OK() throws Exception { NotificationSetting[] newlyChangedSettingsToSave = { settingA, settingsB }; NotificationSetting[] notificationSettingsResponse = request.putWithResponseBody("/api/notification-settings", newlyChangedSettingsToSave, NotificationSetting[].class, HttpStatus.OK); boolean foundA = false; boolean foundB = false; for (NotificationSetting setting : notificationSettingsResponse) { if (setting.getSettingId().equals(settingA.getSettingId())) { foundA = true; } if (setting.getSettingId().equals(settingA.getSettingId())) { foundB = true; } } assertThat(foundA && foundB).as("Saved and received Notification Settings A & B correctly").isTrue(); }
/** * Tests the saveNotificationSettingsForCurrentUser method under normal (successful) conditions */
Tests the saveNotificationSettingsForCurrentUser method under normal (successful) conditions
[ "Tests", "the", "saveNotificationSettingsForCurrentUser", "method", "under", "normal", "(", "successful", ")", "conditions" ]
@Test @WithMockUser(username = "student1", roles = "USER") public void testSaveNotificationSettingsForCurrentUser_OK() throws Exception { NotificationSetting[] newlyChangedSettingsToSave = { settingA, settingsB }; NotificationSetting[] notificationSettingsResponse = request.putWithResponseBody("/api/notification-settings", newlyChangedSettingsToSave, NotificationSetting[].class, HttpStatus.OK); boolean foundA = false; boolean foundB = false; for (NotificationSetting setting : notificationSettingsResponse) { if (setting.getSettingId().equals(settingA.getSettingId())) { foundA = true; } if (setting.getSettingId().equals(settingA.getSettingId())) { foundB = true; } } assertThat(foundA && foundB).as("Saved and received Notification Settings A & B correctly").isTrue(); }
[ "@", "Test", "@", "WithMockUser", "(", "username", "=", "\"student1\"", ",", "roles", "=", "\"USER\"", ")", "public", "void", "testSaveNotificationSettingsForCurrentUser_OK", "(", ")", "throws", "Exception", "{", "NotificationSetting", "[", "]", "newlyChangedSettingsToSave", "=", "{", "settingA", ",", "settingsB", "}", ";", "NotificationSetting", "[", "]", "notificationSettingsResponse", "=", "request", ".", "putWithResponseBody", "(", "\"/api/notification-settings\"", ",", "newlyChangedSettingsToSave", ",", "NotificationSetting", "[", "]", ".", "class", ",", "HttpStatus", ".", "OK", ")", ";", "boolean", "foundA", "=", "false", ";", "boolean", "foundB", "=", "false", ";", "for", "(", "NotificationSetting", "setting", ":", "notificationSettingsResponse", ")", "{", "if", "(", "setting", ".", "getSettingId", "(", ")", ".", "equals", "(", "settingA", ".", "getSettingId", "(", ")", ")", ")", "{", "foundA", "=", "true", ";", "}", "if", "(", "setting", ".", "getSettingId", "(", ")", ".", "equals", "(", "settingA", ".", "getSettingId", "(", ")", ")", ")", "{", "foundB", "=", "true", ";", "}", "}", "assertThat", "(", "foundA", "&&", "foundB", ")", ".", "as", "(", "\"Saved and received Notification Settings A & B correctly\"", ")", ".", "isTrue", "(", ")", ";", "}" ]
Tests the saveNotificationSettingsForCurrentUser method under normal (successful) conditions
[ "Tests", "the", "saveNotificationSettingsForCurrentUser", "method", "under", "normal", "(", "successful", ")", "conditions" ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 4709, 203, 565, 632, 1190, 9865, 1299, 12, 5053, 273, 315, 26240, 21, 3113, 4900, 273, 315, 4714, 7923, 203, 565, 1071, 918, 1842, 4755, 4386, 2628, 1290, 3935, 1299, 67, 3141, 1435, 1216, 1185, 288, 203, 3639, 8050, 5568, 8526, 10894, 5033, 2628, 774, 4755, 273, 288, 3637, 37, 16, 1947, 38, 289, 31, 203, 203, 3639, 8050, 5568, 8526, 3851, 2628, 1064, 273, 590, 18, 458, 1190, 23269, 2932, 19, 2425, 19, 9927, 17, 4272, 3113, 10894, 5033, 2628, 774, 4755, 16, 8050, 5568, 63, 8009, 1106, 16, 203, 7734, 21153, 18, 3141, 1769, 203, 203, 3639, 1250, 1392, 37, 273, 629, 31, 203, 3639, 1250, 1392, 38, 273, 629, 31, 203, 3639, 364, 261, 4386, 5568, 3637, 294, 3851, 2628, 1064, 13, 288, 203, 5411, 309, 261, 8920, 18, 588, 5568, 548, 7675, 14963, 12, 8920, 37, 18, 588, 5568, 548, 1435, 3719, 288, 203, 7734, 1392, 37, 273, 638, 31, 203, 5411, 289, 203, 5411, 309, 261, 8920, 18, 588, 5568, 548, 7675, 14963, 12, 8920, 37, 18, 588, 5568, 548, 1435, 3719, 288, 203, 7734, 1392, 38, 273, 638, 31, 203, 5411, 289, 203, 3639, 289, 203, 203, 3639, 1815, 18163, 12, 7015, 37, 597, 1392, 38, 2934, 345, 2932, 16776, 471, 5079, 8050, 8709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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 7766, 87, 326, 1923, 4386, 2628, 1290, 3935, 1299, 707, 3613, 2212, 261, 18418, 13, 4636, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
fd9718da832315ef7cef8cec42e1f493fd5844ee
ls1intum/Artemis
src/test/java/de/tum/in/www1/artemis/NotificationSettingsResourceIntegrationTest.java
[ "MIT" ]
Java
testSaveNotificationSettingsForCurrentUser_BAD_REQUEST
null
@Test @WithMockUser(username = "student1", roles = "USER") public void testSaveNotificationSettingsForCurrentUser_BAD_REQUEST() throws Exception { request.putWithResponseBody("/api/notification-settings", null, NotificationSetting[].class, HttpStatus.BAD_REQUEST); }
/** * Tests the saveNotificationSettingsForCurrentUser method if a bad request occurs */
Tests the saveNotificationSettingsForCurrentUser method if a bad request occurs
[ "Tests", "the", "saveNotificationSettingsForCurrentUser", "method", "if", "a", "bad", "request", "occurs" ]
@Test @WithMockUser(username = "student1", roles = "USER") public void testSaveNotificationSettingsForCurrentUser_BAD_REQUEST() throws Exception { request.putWithResponseBody("/api/notification-settings", null, NotificationSetting[].class, HttpStatus.BAD_REQUEST); }
[ "@", "Test", "@", "WithMockUser", "(", "username", "=", "\"student1\"", ",", "roles", "=", "\"USER\"", ")", "public", "void", "testSaveNotificationSettingsForCurrentUser_BAD_REQUEST", "(", ")", "throws", "Exception", "{", "request", ".", "putWithResponseBody", "(", "\"/api/notification-settings\"", ",", "null", ",", "NotificationSetting", "[", "]", ".", "class", ",", "HttpStatus", ".", "BAD_REQUEST", ")", ";", "}" ]
Tests the saveNotificationSettingsForCurrentUser method if a bad request occurs
[ "Tests", "the", "saveNotificationSettingsForCurrentUser", "method", "if", "a", "bad", "request", "occurs" ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 4709, 203, 565, 632, 1190, 9865, 1299, 12, 5053, 273, 315, 26240, 21, 3113, 4900, 273, 315, 4714, 7923, 203, 565, 1071, 918, 1842, 4755, 4386, 2628, 1290, 3935, 1299, 67, 16234, 67, 5519, 1435, 1216, 1185, 288, 203, 3639, 590, 18, 458, 1190, 23269, 2932, 19, 2425, 19, 9927, 17, 4272, 3113, 446, 16, 8050, 5568, 63, 8009, 1106, 16, 21153, 18, 16234, 67, 5519, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 7766, 87, 326, 1923, 4386, 2628, 1290, 3935, 1299, 707, 309, 279, 5570, 590, 9938, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
42c526f14891b523d2d2be669468b7b1a1abe50a
ls1intum/Artemis
src/test/java/de/tum/in/www1/artemis/TextClusterResourceIntegrationTest.java
[ "MIT" ]
Java
initTestCase
null
@BeforeEach public void initTestCase() throws Error { Course course = database.createCourseWithInstructorAndTextExercise("instructor1"); exercise = course.getExercises().iterator().next(); StudentParticipation studentParticipation = studentParticipationRepository.findAll().get(0); TextSubmission textSubmission = ModelFactory.generateTextSubmission("This is Part 1, and this is Part 2. There is also Part 3.", Language.ENGLISH, true); textSubmissionRepository.save(textSubmission); database.addResultToSubmission(textSubmission, AssessmentType.AUTOMATIC); Set<TextBlock> textBlocks = Set.of(new TextBlock().text("This is Part 1,").startIndex(0).endIndex(15).automatic(), new TextBlock().text("and this is Part 2.").startIndex(16).endIndex(35).automatic(), new TextBlock().text("There is also Part 3.").startIndex(36).endIndex(57).automatic()); int[] clusterSizes = { 3 }; List<TextCluster> clusters = textExerciseUtilService.addTextBlocksToCluster(textBlocks, clusterSizes, (TextExercise) exercise); clusters.get(0).setDisabled(true); textBlocks.forEach(block -> { block.setSubmission(textSubmission); block.setCluster(clusters.get(0)); block.computeId(); }); textSubmission.setParticipation(studentParticipation); textSubmissionRepository.save(textSubmission); textClusterRepository.saveAll(clusters); textBlockRepository.saveAll(textBlocks); }
/** * Initializes the database with a course that contains a tutor and a text submission */
Initializes the database with a course that contains a tutor and a text submission
[ "Initializes", "the", "database", "with", "a", "course", "that", "contains", "a", "tutor", "and", "a", "text", "submission" ]
@BeforeEach public void initTestCase() throws Error { Course course = database.createCourseWithInstructorAndTextExercise("instructor1"); exercise = course.getExercises().iterator().next(); StudentParticipation studentParticipation = studentParticipationRepository.findAll().get(0); TextSubmission textSubmission = ModelFactory.generateTextSubmission("This is Part 1, and this is Part 2. There is also Part 3.", Language.ENGLISH, true); textSubmissionRepository.save(textSubmission); database.addResultToSubmission(textSubmission, AssessmentType.AUTOMATIC); Set<TextBlock> textBlocks = Set.of(new TextBlock().text("This is Part 1,").startIndex(0).endIndex(15).automatic(), new TextBlock().text("and this is Part 2.").startIndex(16).endIndex(35).automatic(), new TextBlock().text("There is also Part 3.").startIndex(36).endIndex(57).automatic()); int[] clusterSizes = { 3 }; List<TextCluster> clusters = textExerciseUtilService.addTextBlocksToCluster(textBlocks, clusterSizes, (TextExercise) exercise); clusters.get(0).setDisabled(true); textBlocks.forEach(block -> { block.setSubmission(textSubmission); block.setCluster(clusters.get(0)); block.computeId(); }); textSubmission.setParticipation(studentParticipation); textSubmissionRepository.save(textSubmission); textClusterRepository.saveAll(clusters); textBlockRepository.saveAll(textBlocks); }
[ "@", "BeforeEach", "public", "void", "initTestCase", "(", ")", "throws", "Error", "{", "Course", "course", "=", "database", ".", "createCourseWithInstructorAndTextExercise", "(", "\"instructor1\"", ")", ";", "exercise", "=", "course", ".", "getExercises", "(", ")", ".", "iterator", "(", ")", ".", "next", "(", ")", ";", "StudentParticipation", "studentParticipation", "=", "studentParticipationRepository", ".", "findAll", "(", ")", ".", "get", "(", "0", ")", ";", "TextSubmission", "textSubmission", "=", "ModelFactory", ".", "generateTextSubmission", "(", "\"This is Part 1, and this is Part 2. There is also Part 3.\"", ",", "Language", ".", "ENGLISH", ",", "true", ")", ";", "textSubmissionRepository", ".", "save", "(", "textSubmission", ")", ";", "database", ".", "addResultToSubmission", "(", "textSubmission", ",", "AssessmentType", ".", "AUTOMATIC", ")", ";", "Set", "<", "TextBlock", ">", "textBlocks", "=", "Set", ".", "of", "(", "new", "TextBlock", "(", ")", ".", "text", "(", "\"This is Part 1,\"", ")", ".", "startIndex", "(", "0", ")", ".", "endIndex", "(", "15", ")", ".", "automatic", "(", ")", ",", "new", "TextBlock", "(", ")", ".", "text", "(", "\"and this is Part 2.\"", ")", ".", "startIndex", "(", "16", ")", ".", "endIndex", "(", "35", ")", ".", "automatic", "(", ")", ",", "new", "TextBlock", "(", ")", ".", "text", "(", "\"There is also Part 3.\"", ")", ".", "startIndex", "(", "36", ")", ".", "endIndex", "(", "57", ")", ".", "automatic", "(", ")", ")", ";", "int", "[", "]", "clusterSizes", "=", "{", "3", "}", ";", "List", "<", "TextCluster", ">", "clusters", "=", "textExerciseUtilService", ".", "addTextBlocksToCluster", "(", "textBlocks", ",", "clusterSizes", ",", "(", "TextExercise", ")", "exercise", ")", ";", "clusters", ".", "get", "(", "0", ")", ".", "setDisabled", "(", "true", ")", ";", "textBlocks", ".", "forEach", "(", "block", "->", "{", "block", ".", "setSubmission", "(", "textSubmission", ")", ";", "block", ".", "setCluster", "(", "clusters", ".", "get", "(", "0", ")", ")", ";", "block", ".", "computeId", "(", ")", ";", "}", ")", ";", "textSubmission", ".", "setParticipation", "(", "studentParticipation", ")", ";", "textSubmissionRepository", ".", "save", "(", "textSubmission", ")", ";", "textClusterRepository", ".", "saveAll", "(", "clusters", ")", ";", "textBlockRepository", ".", "saveAll", "(", "textBlocks", ")", ";", "}" ]
Initializes the database with a course that contains a tutor and a text submission
[ "Initializes", "the", "database", "with", "a", "course", "that", "contains", "a", "tutor", "and", "a", "text", "submission" ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 4649, 3442, 203, 565, 1071, 918, 1208, 4709, 2449, 1435, 1216, 1068, 288, 203, 3639, 385, 3117, 4362, 273, 2063, 18, 2640, 39, 3117, 1190, 382, 2732, 1876, 1528, 424, 20603, 2932, 267, 2732, 21, 8863, 203, 203, 3639, 24165, 273, 4362, 18, 588, 424, 12610, 6141, 7675, 9838, 7675, 4285, 5621, 203, 3639, 934, 1100, 319, 1988, 24629, 367, 18110, 1988, 24629, 367, 273, 18110, 1988, 24629, 367, 3305, 18, 4720, 1595, 7675, 588, 12, 20, 1769, 203, 203, 3639, 3867, 17865, 977, 17865, 273, 3164, 1733, 18, 7163, 1528, 17865, 2932, 2503, 353, 6393, 404, 16, 471, 333, 353, 6393, 576, 18, 6149, 353, 2546, 6393, 890, 1199, 16, 9889, 18, 16324, 13462, 16, 638, 1769, 203, 3639, 977, 17865, 3305, 18, 5688, 12, 955, 17865, 1769, 203, 203, 3639, 2063, 18, 1289, 1253, 774, 17865, 12, 955, 17865, 16, 25241, 559, 18, 37, 1693, 1872, 11781, 1769, 203, 203, 3639, 1000, 32, 1528, 1768, 34, 977, 6450, 273, 1000, 18, 792, 12, 2704, 3867, 1768, 7675, 955, 2932, 2503, 353, 6393, 404, 10837, 2934, 1937, 1016, 12, 20, 2934, 409, 1016, 12, 3600, 2934, 5854, 4941, 9334, 203, 7734, 394, 3867, 1768, 7675, 955, 2932, 464, 333, 353, 6393, 576, 1199, 2934, 1937, 1016, 12, 2313, 2934, 409, 1016, 12, 4763, 2934, 5854, 4941, 9334, 203, 7734, 394, 3867, 1768, 7675, 955, 2932, 9828, 353, 2546, 6393, 890, 1199, 2934, 1937, 1016, 12, 5718, 2934, 409, 1016, 12, 10321, 2934, 5854, 4941, 10663, 203, 3639, 509, 8526, 2855, 11923, 273, 288, 890, 289, 31, 203, 3639, 987, 32, 1528, 3629, 34, 9566, 273, 977, 424, 20603, 1304, 1179, 18, 1289, 1528, 6450, 774, 3629, 12, 955, 6450, 16, 2855, 11923, 16, 261, 1528, 424, 20603, 13, 24165, 1769, 203, 203, 3639, 9566, 18, 588, 12, 20, 2934, 542, 8853, 12, 3767, 1769, 203, 3639, 977, 6450, 18, 1884, 3442, 12, 2629, 317, 288, 203, 5411, 1203, 18, 542, 17865, 12, 955, 17865, 1769, 203, 5411, 1203, 18, 542, 3629, 12, 16806, 18, 588, 12, 20, 10019, 203, 5411, 1203, 18, 9200, 548, 5621, 203, 3639, 15549, 203, 203, 3639, 977, 17865, 18, 542, 1988, 24629, 367, 12, 26240, 1988, 24629, 367, 1769, 203, 3639, 977, 17865, 3305, 18, 5688, 12, 955, 17865, 1769, 203, 3639, 977, 3629, 3305, 18, 5688, 1595, 12, 16806, 1769, 203, 3639, 977, 1768, 3305, 18, 5688, 1595, 12, 955, 6450, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0,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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 10188, 3128, 326, 2063, 598, 279, 4362, 716, 1914, 279, 268, 3408, 471, 279, 977, 8515, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
42c526f14891b523d2d2be669468b7b1a1abe50a
ls1intum/Artemis
src/test/java/de/tum/in/www1/artemis/TextClusterResourceIntegrationTest.java
[ "MIT" ]
Java
testGetClusterStats_forAllValuesSet
null
@Test @WithMockUser(username = "instructor1", roles = "INSTRUCTOR") public void testGetClusterStats_forAllValuesSet() throws Exception { List<TextClusterStatisticsDTO> textClusterStatistics = request.getList("/api/text-exercises/" + exercise.getId() + "/cluster-statistics", HttpStatus.OK, TextClusterStatisticsDTO.class); assertThat(textClusterStatistics).isNotNull(); TextClusterStatisticsDTO firstElement = textClusterStatistics.get(0); Long clusterSize = firstElement.getClusterSize(); Long automaticFeedbacksNum = firstElement.getNumberOfAutomaticFeedbacks(); boolean disabled = firstElement.isDisabled(); assertThat(clusterSize).isEqualTo(3); assertThat(automaticFeedbacksNum).isEqualTo(0); assertThat(disabled).isTrue(); }
/** * Checks the response data from retrieving cluster statistics is returned properly */
Checks the response data from retrieving cluster statistics is returned properly
[ "Checks", "the", "response", "data", "from", "retrieving", "cluster", "statistics", "is", "returned", "properly" ]
@Test @WithMockUser(username = "instructor1", roles = "INSTRUCTOR") public void testGetClusterStats_forAllValuesSet() throws Exception { List<TextClusterStatisticsDTO> textClusterStatistics = request.getList("/api/text-exercises/" + exercise.getId() + "/cluster-statistics", HttpStatus.OK, TextClusterStatisticsDTO.class); assertThat(textClusterStatistics).isNotNull(); TextClusterStatisticsDTO firstElement = textClusterStatistics.get(0); Long clusterSize = firstElement.getClusterSize(); Long automaticFeedbacksNum = firstElement.getNumberOfAutomaticFeedbacks(); boolean disabled = firstElement.isDisabled(); assertThat(clusterSize).isEqualTo(3); assertThat(automaticFeedbacksNum).isEqualTo(0); assertThat(disabled).isTrue(); }
[ "@", "Test", "@", "WithMockUser", "(", "username", "=", "\"instructor1\"", ",", "roles", "=", "\"INSTRUCTOR\"", ")", "public", "void", "testGetClusterStats_forAllValuesSet", "(", ")", "throws", "Exception", "{", "List", "<", "TextClusterStatisticsDTO", ">", "textClusterStatistics", "=", "request", ".", "getList", "(", "\"/api/text-exercises/\"", "+", "exercise", ".", "getId", "(", ")", "+", "\"/cluster-statistics\"", ",", "HttpStatus", ".", "OK", ",", "TextClusterStatisticsDTO", ".", "class", ")", ";", "assertThat", "(", "textClusterStatistics", ")", ".", "isNotNull", "(", ")", ";", "TextClusterStatisticsDTO", "firstElement", "=", "textClusterStatistics", ".", "get", "(", "0", ")", ";", "Long", "clusterSize", "=", "firstElement", ".", "getClusterSize", "(", ")", ";", "Long", "automaticFeedbacksNum", "=", "firstElement", ".", "getNumberOfAutomaticFeedbacks", "(", ")", ";", "boolean", "disabled", "=", "firstElement", ".", "isDisabled", "(", ")", ";", "assertThat", "(", "clusterSize", ")", ".", "isEqualTo", "(", "3", ")", ";", "assertThat", "(", "automaticFeedbacksNum", ")", ".", "isEqualTo", "(", "0", ")", ";", "assertThat", "(", "disabled", ")", ".", "isTrue", "(", ")", ";", "}" ]
Checks the response data from retrieving cluster statistics is returned properly
[ "Checks", "the", "response", "data", "from", "retrieving", "cluster", "statistics", "is", "returned", "properly" ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 4709, 203, 565, 632, 1190, 9865, 1299, 12, 5053, 273, 315, 267, 2732, 21, 3113, 4900, 273, 315, 706, 13915, 916, 7923, 203, 565, 1071, 918, 1842, 967, 3629, 4195, 67, 1884, 1595, 1972, 694, 1435, 1216, 1185, 288, 203, 3639, 987, 32, 1528, 3629, 8569, 19792, 34, 977, 3629, 8569, 273, 590, 18, 588, 682, 2932, 19, 2425, 19, 955, 17, 8913, 71, 6141, 4898, 397, 24165, 18, 26321, 1435, 397, 2206, 7967, 17, 14438, 3113, 21153, 18, 3141, 16, 203, 7734, 3867, 3629, 8569, 19792, 18, 1106, 1769, 203, 203, 3639, 1815, 18163, 12, 955, 3629, 8569, 2934, 291, 5962, 5621, 203, 203, 3639, 3867, 3629, 8569, 19792, 1122, 1046, 273, 977, 3629, 8569, 18, 588, 12, 20, 1769, 203, 3639, 3407, 2855, 1225, 273, 1122, 1046, 18, 588, 3629, 1225, 5621, 203, 3639, 3407, 5859, 15888, 87, 2578, 273, 1122, 1046, 18, 588, 9226, 7150, 4941, 15888, 87, 5621, 203, 3639, 1250, 5673, 273, 1122, 1046, 18, 291, 8853, 5621, 203, 203, 3639, 1815, 18163, 12, 7967, 1225, 2934, 291, 5812, 774, 12, 23, 1769, 203, 3639, 1815, 18163, 12, 5854, 4941, 15888, 87, 2578, 2934, 291, 5812, 774, 12, 20, 1769, 203, 3639, 1815, 18163, 12, 9278, 2934, 291, 5510, 5621, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
42c526f14891b523d2d2be669468b7b1a1abe50a
ls1intum/Artemis
src/test/java/de/tum/in/www1/artemis/TextClusterResourceIntegrationTest.java
[ "MIT" ]
Java
testGetClusterStats_withEnabledCluster
null
@Test @WithMockUser(username = "instructor1", roles = "INSTRUCTOR") public void testGetClusterStats_withEnabledCluster() throws Exception { TextCluster cluster = textClusterRepository.findAll().get(0); cluster.setDisabled(false); textClusterRepository.save(cluster); List<TextClusterStatisticsDTO> textClusterStatistics = request.getList("/api/text-exercises/" + exercise.getId() + "/cluster-statistics", HttpStatus.OK, TextClusterStatisticsDTO.class); TextClusterStatisticsDTO stat = textClusterStatistics.get(0); boolean disabled = stat.isDisabled(); assertThat(disabled).isFalse(); }
/** * Test getting cluster statistics with pre-enabled clusters */
Test getting cluster statistics with pre-enabled clusters
[ "Test", "getting", "cluster", "statistics", "with", "pre", "-", "enabled", "clusters" ]
@Test @WithMockUser(username = "instructor1", roles = "INSTRUCTOR") public void testGetClusterStats_withEnabledCluster() throws Exception { TextCluster cluster = textClusterRepository.findAll().get(0); cluster.setDisabled(false); textClusterRepository.save(cluster); List<TextClusterStatisticsDTO> textClusterStatistics = request.getList("/api/text-exercises/" + exercise.getId() + "/cluster-statistics", HttpStatus.OK, TextClusterStatisticsDTO.class); TextClusterStatisticsDTO stat = textClusterStatistics.get(0); boolean disabled = stat.isDisabled(); assertThat(disabled).isFalse(); }
[ "@", "Test", "@", "WithMockUser", "(", "username", "=", "\"instructor1\"", ",", "roles", "=", "\"INSTRUCTOR\"", ")", "public", "void", "testGetClusterStats_withEnabledCluster", "(", ")", "throws", "Exception", "{", "TextCluster", "cluster", "=", "textClusterRepository", ".", "findAll", "(", ")", ".", "get", "(", "0", ")", ";", "cluster", ".", "setDisabled", "(", "false", ")", ";", "textClusterRepository", ".", "save", "(", "cluster", ")", ";", "List", "<", "TextClusterStatisticsDTO", ">", "textClusterStatistics", "=", "request", ".", "getList", "(", "\"/api/text-exercises/\"", "+", "exercise", ".", "getId", "(", ")", "+", "\"/cluster-statistics\"", ",", "HttpStatus", ".", "OK", ",", "TextClusterStatisticsDTO", ".", "class", ")", ";", "TextClusterStatisticsDTO", "stat", "=", "textClusterStatistics", ".", "get", "(", "0", ")", ";", "boolean", "disabled", "=", "stat", ".", "isDisabled", "(", ")", ";", "assertThat", "(", "disabled", ")", ".", "isFalse", "(", ")", ";", "}" ]
Test getting cluster statistics with pre-enabled clusters
[ "Test", "getting", "cluster", "statistics", "with", "pre", "-", "enabled", "clusters" ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 4709, 203, 565, 632, 1190, 9865, 1299, 12, 5053, 273, 315, 267, 2732, 21, 3113, 4900, 273, 315, 706, 13915, 916, 7923, 203, 565, 1071, 918, 1842, 967, 3629, 4195, 67, 1918, 1526, 3629, 1435, 1216, 1185, 288, 203, 3639, 3867, 3629, 2855, 273, 977, 3629, 3305, 18, 4720, 1595, 7675, 588, 12, 20, 1769, 203, 3639, 2855, 18, 542, 8853, 12, 5743, 1769, 203, 3639, 977, 3629, 3305, 18, 5688, 12, 7967, 1769, 203, 203, 3639, 987, 32, 1528, 3629, 8569, 19792, 34, 977, 3629, 8569, 273, 590, 18, 588, 682, 2932, 19, 2425, 19, 955, 17, 8913, 71, 6141, 4898, 397, 24165, 18, 26321, 1435, 397, 2206, 7967, 17, 14438, 3113, 21153, 18, 3141, 16, 203, 7734, 3867, 3629, 8569, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 7766, 8742, 2855, 7691, 598, 675, 17, 5745, 9566, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
42c526f14891b523d2d2be669468b7b1a1abe50a
ls1intum/Artemis
src/test/java/de/tum/in/www1/artemis/TextClusterResourceIntegrationTest.java
[ "MIT" ]
Java
testGetClusterStats_withAddedAutoFeedback
null
@Test @WithMockUser(username = "instructor1", roles = "INSTRUCTOR") public void testGetClusterStats_withAddedAutoFeedback() throws Exception { Result result = resultRepository.findAll().get(0); TextBlock textBlock = textBlockRepository.findAll().get(0); Feedback feedback = new Feedback().type(FeedbackType.AUTOMATIC).detailText("feedback").result(result).reference(textBlock.getId()); feedbackRepository.save(feedback); List<TextClusterStatisticsDTO> textClusterStatistics = request.getList("/api/text-exercises/" + exercise.getId() + "/cluster-statistics", HttpStatus.OK, TextClusterStatisticsDTO.class); TextClusterStatisticsDTO stat = textClusterStatistics.get(0); Long automaticFeedbacksNum = stat.getNumberOfAutomaticFeedbacks(); assertThat(automaticFeedbacksNum).isEqualTo(1); }
/** * Test getting cluster statistics with at least one textblock having an automatic feedback */
Test getting cluster statistics with at least one textblock having an automatic feedback
[ "Test", "getting", "cluster", "statistics", "with", "at", "least", "one", "textblock", "having", "an", "automatic", "feedback" ]
@Test @WithMockUser(username = "instructor1", roles = "INSTRUCTOR") public void testGetClusterStats_withAddedAutoFeedback() throws Exception { Result result = resultRepository.findAll().get(0); TextBlock textBlock = textBlockRepository.findAll().get(0); Feedback feedback = new Feedback().type(FeedbackType.AUTOMATIC).detailText("feedback").result(result).reference(textBlock.getId()); feedbackRepository.save(feedback); List<TextClusterStatisticsDTO> textClusterStatistics = request.getList("/api/text-exercises/" + exercise.getId() + "/cluster-statistics", HttpStatus.OK, TextClusterStatisticsDTO.class); TextClusterStatisticsDTO stat = textClusterStatistics.get(0); Long automaticFeedbacksNum = stat.getNumberOfAutomaticFeedbacks(); assertThat(automaticFeedbacksNum).isEqualTo(1); }
[ "@", "Test", "@", "WithMockUser", "(", "username", "=", "\"instructor1\"", ",", "roles", "=", "\"INSTRUCTOR\"", ")", "public", "void", "testGetClusterStats_withAddedAutoFeedback", "(", ")", "throws", "Exception", "{", "Result", "result", "=", "resultRepository", ".", "findAll", "(", ")", ".", "get", "(", "0", ")", ";", "TextBlock", "textBlock", "=", "textBlockRepository", ".", "findAll", "(", ")", ".", "get", "(", "0", ")", ";", "Feedback", "feedback", "=", "new", "Feedback", "(", ")", ".", "type", "(", "FeedbackType", ".", "AUTOMATIC", ")", ".", "detailText", "(", "\"feedback\"", ")", ".", "result", "(", "result", ")", ".", "reference", "(", "textBlock", ".", "getId", "(", ")", ")", ";", "feedbackRepository", ".", "save", "(", "feedback", ")", ";", "List", "<", "TextClusterStatisticsDTO", ">", "textClusterStatistics", "=", "request", ".", "getList", "(", "\"/api/text-exercises/\"", "+", "exercise", ".", "getId", "(", ")", "+", "\"/cluster-statistics\"", ",", "HttpStatus", ".", "OK", ",", "TextClusterStatisticsDTO", ".", "class", ")", ";", "TextClusterStatisticsDTO", "stat", "=", "textClusterStatistics", ".", "get", "(", "0", ")", ";", "Long", "automaticFeedbacksNum", "=", "stat", ".", "getNumberOfAutomaticFeedbacks", "(", ")", ";", "assertThat", "(", "automaticFeedbacksNum", ")", ".", "isEqualTo", "(", "1", ")", ";", "}" ]
Test getting cluster statistics with at least one textblock having an automatic feedback
[ "Test", "getting", "cluster", "statistics", "with", "at", "least", "one", "textblock", "having", "an", "automatic", "feedback" ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 4709, 203, 565, 632, 1190, 9865, 1299, 12, 5053, 273, 315, 267, 2732, 21, 3113, 4900, 273, 315, 706, 13915, 916, 7923, 203, 565, 1071, 918, 1842, 967, 3629, 4195, 67, 1918, 8602, 4965, 15888, 1435, 1216, 1185, 288, 203, 3639, 3438, 563, 273, 563, 3305, 18, 4720, 1595, 7675, 588, 12, 20, 1769, 203, 3639, 3867, 1768, 977, 1768, 273, 977, 1768, 3305, 18, 4720, 1595, 7675, 588, 12, 20, 1769, 203, 3639, 14013, 823, 10762, 273, 394, 14013, 823, 7675, 723, 12, 15888, 559, 18, 37, 1693, 1872, 11781, 2934, 8992, 1528, 2932, 12571, 20387, 2088, 12, 2088, 2934, 6180, 12, 955, 1768, 18, 26321, 10663, 203, 3639, 10762, 3305, 18, 5688, 12, 12571, 1769, 203, 203, 3639, 987, 32, 1528, 3629, 8569, 19792, 34, 977, 3629, 8569, 273, 590, 18, 588, 682, 2932, 19, 2425, 19, 955, 17, 8913, 71, 6141, 4898, 397, 24165, 18, 26321, 1435, 397, 2206, 7967, 17, 14438, 3113, 21153, 18, 3141, 16, 203, 7734, 3867, 3629, 8569, 19792, 18, 1106, 1769, 203, 203, 3639, 3867, 3629, 8569, 19792, 610, 273, 977, 3629, 8569, 18, 588, 12, 20, 1769, 203, 3639, 3407, 5859, 15888, 87, 2578, 273, 610, 18, 588, 9226, 7150, 4941, 15888, 87, 5621, 203, 203, 3639, 1815, 18163, 12, 5854, 4941, 15888, 87, 2578, 2934, 291, 5812, 774, 12, 21, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
42c526f14891b523d2d2be669468b7b1a1abe50a
ls1intum/Artemis
src/test/java/de/tum/in/www1/artemis/TextClusterResourceIntegrationTest.java
[ "MIT" ]
Java
testToggleClusterDisabledPredicate_withDisabledAndEnabledCluster
null
@Test @WithMockUser(username = "instructor1", roles = "INSTRUCTOR") public void testToggleClusterDisabledPredicate_withDisabledAndEnabledCluster() throws Exception { TextCluster cluster = textClusterRepository.findAll().get(0); // set predicate to false request.patch("/api/text-exercises/" + exercise.getId() + "/text-clusters/" + cluster.getId() + "?disabled=false", "{}", HttpStatus.OK); // fetch statistics List<TextClusterStatisticsDTO> textClusterStatisticsFalse = request.getList("/api/text-exercises/" + exercise.getId() + "/cluster-statistics", HttpStatus.OK, TextClusterStatisticsDTO.class); assertThat(textClusterStatisticsFalse).isNotNull(); TextClusterStatisticsDTO textClusterStatisticFalse = textClusterStatisticsFalse.get(0); assertThat(textClusterStatisticFalse.isDisabled()).isFalse(); // set predicate to true request.patch("/api/text-exercises/" + exercise.getId() + "/text-clusters/" + cluster.getId() + "?disabled=true", "{}", HttpStatus.OK); // fetch statistics List<TextClusterStatisticsDTO> textClusterStatisticsTrue = request.getList("/api/text-exercises/" + exercise.getId() + "/cluster-statistics", HttpStatus.OK, TextClusterStatisticsDTO.class); assertThat(textClusterStatisticsTrue).isNotNull(); TextClusterStatisticsDTO textClusterStatsTrue = textClusterStatisticsTrue.get(0); assertThat(textClusterStatsTrue.isDisabled()).isTrue(); }
/** * Test toggleClusterDisabledPredicate combined with getting cluster statistics * The value is toggled from first false and then to true */
Test toggleClusterDisabledPredicate combined with getting cluster statistics The value is toggled from first false and then to true
[ "Test", "toggleClusterDisabledPredicate", "combined", "with", "getting", "cluster", "statistics", "The", "value", "is", "toggled", "from", "first", "false", "and", "then", "to", "true" ]
@Test @WithMockUser(username = "instructor1", roles = "INSTRUCTOR") public void testToggleClusterDisabledPredicate_withDisabledAndEnabledCluster() throws Exception { TextCluster cluster = textClusterRepository.findAll().get(0); request.patch("/api/text-exercises/" + exercise.getId() + "/text-clusters/" + cluster.getId() + "?disabled=false", "{}", HttpStatus.OK); List<TextClusterStatisticsDTO> textClusterStatisticsFalse = request.getList("/api/text-exercises/" + exercise.getId() + "/cluster-statistics", HttpStatus.OK, TextClusterStatisticsDTO.class); assertThat(textClusterStatisticsFalse).isNotNull(); TextClusterStatisticsDTO textClusterStatisticFalse = textClusterStatisticsFalse.get(0); assertThat(textClusterStatisticFalse.isDisabled()).isFalse(); request.patch("/api/text-exercises/" + exercise.getId() + "/text-clusters/" + cluster.getId() + "?disabled=true", "{}", HttpStatus.OK); List<TextClusterStatisticsDTO> textClusterStatisticsTrue = request.getList("/api/text-exercises/" + exercise.getId() + "/cluster-statistics", HttpStatus.OK, TextClusterStatisticsDTO.class); assertThat(textClusterStatisticsTrue).isNotNull(); TextClusterStatisticsDTO textClusterStatsTrue = textClusterStatisticsTrue.get(0); assertThat(textClusterStatsTrue.isDisabled()).isTrue(); }
[ "@", "Test", "@", "WithMockUser", "(", "username", "=", "\"instructor1\"", ",", "roles", "=", "\"INSTRUCTOR\"", ")", "public", "void", "testToggleClusterDisabledPredicate_withDisabledAndEnabledCluster", "(", ")", "throws", "Exception", "{", "TextCluster", "cluster", "=", "textClusterRepository", ".", "findAll", "(", ")", ".", "get", "(", "0", ")", ";", "request", ".", "patch", "(", "\"/api/text-exercises/\"", "+", "exercise", ".", "getId", "(", ")", "+", "\"/text-clusters/\"", "+", "cluster", ".", "getId", "(", ")", "+", "\"?disabled=false\"", ",", "\"{}\"", ",", "HttpStatus", ".", "OK", ")", ";", "List", "<", "TextClusterStatisticsDTO", ">", "textClusterStatisticsFalse", "=", "request", ".", "getList", "(", "\"/api/text-exercises/\"", "+", "exercise", ".", "getId", "(", ")", "+", "\"/cluster-statistics\"", ",", "HttpStatus", ".", "OK", ",", "TextClusterStatisticsDTO", ".", "class", ")", ";", "assertThat", "(", "textClusterStatisticsFalse", ")", ".", "isNotNull", "(", ")", ";", "TextClusterStatisticsDTO", "textClusterStatisticFalse", "=", "textClusterStatisticsFalse", ".", "get", "(", "0", ")", ";", "assertThat", "(", "textClusterStatisticFalse", ".", "isDisabled", "(", ")", ")", ".", "isFalse", "(", ")", ";", "request", ".", "patch", "(", "\"/api/text-exercises/\"", "+", "exercise", ".", "getId", "(", ")", "+", "\"/text-clusters/\"", "+", "cluster", ".", "getId", "(", ")", "+", "\"?disabled=true\"", ",", "\"{}\"", ",", "HttpStatus", ".", "OK", ")", ";", "List", "<", "TextClusterStatisticsDTO", ">", "textClusterStatisticsTrue", "=", "request", ".", "getList", "(", "\"/api/text-exercises/\"", "+", "exercise", ".", "getId", "(", ")", "+", "\"/cluster-statistics\"", ",", "HttpStatus", ".", "OK", ",", "TextClusterStatisticsDTO", ".", "class", ")", ";", "assertThat", "(", "textClusterStatisticsTrue", ")", ".", "isNotNull", "(", ")", ";", "TextClusterStatisticsDTO", "textClusterStatsTrue", "=", "textClusterStatisticsTrue", ".", "get", "(", "0", ")", ";", "assertThat", "(", "textClusterStatsTrue", ".", "isDisabled", "(", ")", ")", ".", "isTrue", "(", ")", ";", "}" ]
Test toggleClusterDisabledPredicate combined with getting cluster statistics The value is toggled from first false and then to true
[ "Test", "toggleClusterDisabledPredicate", "combined", "with", "getting", "cluster", "statistics", "The", "value", "is", "toggled", "from", "first", "false", "and", "then", "to", "true" ]
[ "// set predicate to false", "// fetch statistics", "// set predicate to true", "// fetch statistics" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 4709, 203, 565, 632, 1190, 9865, 1299, 12, 5053, 273, 315, 267, 2732, 21, 3113, 4900, 273, 315, 706, 13915, 916, 7923, 203, 565, 1071, 918, 1842, 17986, 3629, 8853, 8634, 67, 1918, 8853, 1876, 1526, 3629, 1435, 1216, 1185, 288, 203, 3639, 3867, 3629, 2855, 273, 977, 3629, 3305, 18, 4720, 1595, 7675, 588, 12, 20, 1769, 203, 3639, 368, 444, 5641, 358, 629, 203, 3639, 590, 18, 2272, 2932, 19, 2425, 19, 955, 17, 8913, 71, 6141, 4898, 397, 24165, 18, 26321, 1435, 397, 2206, 955, 17, 16806, 4898, 397, 2855, 18, 26321, 1435, 397, 18101, 9278, 33, 5743, 3113, 13034, 16, 21153, 18, 3141, 1769, 203, 203, 3639, 368, 2158, 7691, 203, 3639, 987, 32, 1528, 3629, 8569, 19792, 34, 977, 3629, 8569, 8381, 273, 590, 18, 588, 682, 2932, 19, 2425, 19, 955, 17, 8913, 71, 6141, 4898, 397, 24165, 18, 26321, 1435, 397, 2206, 7967, 17, 14438, 3113, 21153, 18, 3141, 16, 203, 7734, 3867, 3629, 8569, 19792, 18, 1106, 1769, 203, 203, 3639, 1815, 18163, 12, 955, 3629, 8569, 8381, 2934, 291, 5962, 5621, 203, 3639, 3867, 3629, 8569, 19792, 977, 3629, 20673, 8381, 273, 977, 3629, 8569, 8381, 18, 588, 12, 20, 1769, 203, 3639, 1815, 18163, 12, 955, 3629, 20673, 8381, 18, 291, 8853, 1435, 2934, 291, 8381, 5621, 203, 203, 3639, 368, 444, 5641, 358, 638, 203, 3639, 590, 18, 2272, 2932, 19, 2425, 19, 955, 17, 8913, 71, 6141, 4898, 397, 24165, 18, 26321, 1435, 397, 2206, 955, 17, 16806, 4898, 397, 2855, 18, 26321, 1435, 397, 18101, 9278, 33, 3767, 3113, 13034, 16, 21153, 18, 3141, 1769, 203, 203, 3639, 368, 2158, 7691, 203, 3639, 987, 32, 1528, 3629, 8569, 19792, 34, 977, 3629, 8569, 5510, 273, 590, 18, 588, 682, 2932, 19, 2425, 19, 955, 17, 8913, 71, 6141, 4898, 397, 24165, 18, 26321, 1435, 397, 2206, 7967, 17, 14438, 3113, 21153, 18, 3141, 16, 203, 7734, 3867, 3629, 8569, 19792, 18, 1106, 1769, 203, 203, 3639, 1815, 18163, 12, 955, 3629, 8569, 5510, 2934, 291, 5962, 5621, 203, 3639, 3867, 3629, 8569, 19792, 977, 3629, 4195, 5510, 273, 977, 3629, 8569, 5510, 18, 588, 12, 20, 1769, 203, 3639, 1815, 18163, 12, 955, 3629, 4195, 5510, 18, 291, 8853, 1435, 2934, 291, 5510, 5621, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 7766, 10486, 3629, 8853, 8634, 8224, 598, 8742, 2855, 7691, 203, 377, 380, 1021, 460, 353, 6316, 75, 1259, 628, 1122, 629, 471, 1508, 358, 638, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
34c82e8c8305b036709b63fa4771bb6e541b58d2
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/service/ModelAssessmentKnowledgeService.java
[ "MIT" ]
Java
deleteKnowledge
null
public void deleteKnowledge(Long knowledgeId) { Set<ModelingExercise> exerciseSet = modelingExerciseRepository.findAllByKnowledgeId(knowledgeId); // If no other exercises use the same knowledge then remove knowledge if (exerciseSet.isEmpty()) { modelAssesmentKnowledgeRepository.deleteById(knowledgeId); } }
/** * delete only when no exercises use the knowledge * * @param knowledgeId */
delete only when no exercises use the knowledge @param knowledgeId
[ "delete", "only", "when", "no", "exercises", "use", "the", "knowledge", "@param", "knowledgeId" ]
public void deleteKnowledge(Long knowledgeId) { Set<ModelingExercise> exerciseSet = modelingExerciseRepository.findAllByKnowledgeId(knowledgeId); if (exerciseSet.isEmpty()) { modelAssesmentKnowledgeRepository.deleteById(knowledgeId); } }
[ "public", "void", "deleteKnowledge", "(", "Long", "knowledgeId", ")", "{", "Set", "<", "ModelingExercise", ">", "exerciseSet", "=", "modelingExerciseRepository", ".", "findAllByKnowledgeId", "(", "knowledgeId", ")", ";", "if", "(", "exerciseSet", ".", "isEmpty", "(", ")", ")", "{", "modelAssesmentKnowledgeRepository", ".", "deleteById", "(", "knowledgeId", ")", ";", "}", "}" ]
delete only when no exercises use the knowledge @param knowledgeId
[ "delete", "only", "when", "no", "exercises", "use", "the", "knowledge", "@param", "knowledgeId" ]
[ "// If no other exercises use the same knowledge then remove knowledge" ]
[ { "param": "knowledgeId", "type": "Long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "knowledgeId", "type": "Long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 918, 1430, 47, 14390, 12, 3708, 20272, 548, 13, 288, 203, 3639, 1000, 32, 1488, 310, 424, 20603, 34, 24165, 694, 273, 938, 310, 424, 20603, 3305, 18, 4720, 1595, 858, 47, 14390, 548, 12, 79, 14390, 548, 1769, 203, 3639, 368, 971, 1158, 1308, 431, 12610, 6141, 999, 326, 1967, 20272, 1508, 1206, 20272, 203, 3639, 309, 261, 8913, 30708, 694, 18, 291, 1921, 10756, 288, 203, 5411, 938, 2610, 281, 475, 47, 14390, 3305, 18, 3733, 5132, 12, 79, 14390, 548, 1769, 203, 3639, 289, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 1430, 1338, 1347, 1158, 431, 12610, 6141, 999, 326, 20272, 203, 377, 380, 203, 377, 380, 632, 891, 20272, 548, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
34c82e8c8305b036709b63fa4771bb6e541b58d2
ls1intum/Artemis
src/main/java/de/tum/in/www1/artemis/service/ModelAssessmentKnowledgeService.java
[ "MIT" ]
Java
createNewKnowledge
ModelAssessmentKnowledge
public ModelAssessmentKnowledge createNewKnowledge() { ModelAssessmentKnowledge knowledge = new ModelAssessmentKnowledge(); modelAssesmentKnowledgeRepository.save(knowledge); return knowledge; }
/** * Create new knowledge if exercise is created from scratch * * @return ModelAssessmentKnowledge */
Create new knowledge if exercise is created from scratch @return ModelAssessmentKnowledge
[ "Create", "new", "knowledge", "if", "exercise", "is", "created", "from", "scratch", "@return", "ModelAssessmentKnowledge" ]
public ModelAssessmentKnowledge createNewKnowledge() { ModelAssessmentKnowledge knowledge = new ModelAssessmentKnowledge(); modelAssesmentKnowledgeRepository.save(knowledge); return knowledge; }
[ "public", "ModelAssessmentKnowledge", "createNewKnowledge", "(", ")", "{", "ModelAssessmentKnowledge", "knowledge", "=", "new", "ModelAssessmentKnowledge", "(", ")", ";", "modelAssesmentKnowledgeRepository", ".", "save", "(", "knowledge", ")", ";", "return", "knowledge", ";", "}" ]
Create new knowledge if exercise is created from scratch @return ModelAssessmentKnowledge
[ "Create", "new", "knowledge", "if", "exercise", "is", "created", "from", "scratch", "@return", "ModelAssessmentKnowledge" ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 3164, 15209, 47, 14390, 15291, 47, 14390, 1435, 288, 203, 3639, 3164, 15209, 47, 14390, 20272, 273, 394, 3164, 15209, 47, 14390, 5621, 203, 3639, 938, 2610, 281, 475, 47, 14390, 3305, 18, 5688, 12, 79, 14390, 1769, 203, 3639, 327, 20272, 31, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 1788, 394, 20272, 309, 24165, 353, 2522, 628, 15289, 203, 377, 380, 203, 377, 380, 632, 2463, 3164, 15209, 47, 14390, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
332064d33c9c5305df92a483147da8c4b57ceefb
ls1intum/Artemis
src/test/java/de/tum/in/www1/artemis/util/ModelFactory.java
[ "MIT" ]
Java
generateStudentParticipationWithoutUser
StudentParticipation
public static StudentParticipation generateStudentParticipationWithoutUser(InitializationState initializationState, Exercise exercise) { StudentParticipation studentParticipation = new StudentParticipation(); studentParticipation.setInitializationState(initializationState); studentParticipation.setInitializationDate(ZonedDateTime.now().minusDays(5)); studentParticipation.setExercise(exercise); return studentParticipation; }
/** * Generates a minimal student participation without a specific user attached. * @param initializationState the state of the participation * @param exercise the referenced exercise of the participation * @return the StudentParticipation created */
Generates a minimal student participation without a specific user attached. @param initializationState the state of the participation @param exercise the referenced exercise of the participation @return the StudentParticipation created
[ "Generates", "a", "minimal", "student", "participation", "without", "a", "specific", "user", "attached", ".", "@param", "initializationState", "the", "state", "of", "the", "participation", "@param", "exercise", "the", "referenced", "exercise", "of", "the", "participation", "@return", "the", "StudentParticipation", "created" ]
public static StudentParticipation generateStudentParticipationWithoutUser(InitializationState initializationState, Exercise exercise) { StudentParticipation studentParticipation = new StudentParticipation(); studentParticipation.setInitializationState(initializationState); studentParticipation.setInitializationDate(ZonedDateTime.now().minusDays(5)); studentParticipation.setExercise(exercise); return studentParticipation; }
[ "public", "static", "StudentParticipation", "generateStudentParticipationWithoutUser", "(", "InitializationState", "initializationState", ",", "Exercise", "exercise", ")", "{", "StudentParticipation", "studentParticipation", "=", "new", "StudentParticipation", "(", ")", ";", "studentParticipation", ".", "setInitializationState", "(", "initializationState", ")", ";", "studentParticipation", ".", "setInitializationDate", "(", "ZonedDateTime", ".", "now", "(", ")", ".", "minusDays", "(", "5", ")", ")", ";", "studentParticipation", ".", "setExercise", "(", "exercise", ")", ";", "return", "studentParticipation", ";", "}" ]
Generates a minimal student participation without a specific user attached.
[ "Generates", "a", "minimal", "student", "participation", "without", "a", "specific", "user", "attached", "." ]
[]
[ { "param": "initializationState", "type": "InitializationState" }, { "param": "exercise", "type": "Exercise" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "initializationState", "type": "InitializationState", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "exercise", "type": "Exercise", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 760, 934, 1100, 319, 1988, 24629, 367, 2103, 19943, 319, 1988, 24629, 367, 8073, 1299, 12, 17701, 1119, 10313, 1119, 16, 1312, 20603, 24165, 13, 288, 203, 3639, 934, 1100, 319, 1988, 24629, 367, 18110, 1988, 24629, 367, 273, 394, 934, 1100, 319, 1988, 24629, 367, 5621, 203, 3639, 18110, 1988, 24629, 367, 18, 542, 17701, 1119, 12, 6769, 1588, 1119, 1769, 203, 3639, 18110, 1988, 24629, 367, 18, 542, 17701, 1626, 12, 62, 20461, 18, 3338, 7675, 19601, 9384, 12, 25, 10019, 203, 3639, 18110, 1988, 24629, 367, 18, 542, 424, 20603, 12, 8913, 30708, 1769, 203, 3639, 327, 18110, 1988, 24629, 367, 31, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 31902, 279, 16745, 18110, 30891, 367, 2887, 279, 2923, 729, 7495, 18, 203, 377, 380, 632, 891, 10313, 1119, 326, 919, 434, 326, 30891, 367, 203, 377, 380, 632, 891, 24165, 326, 8042, 24165, 434, 326, 30891, 367, 203, 377, 380, 632, 2463, 326, 934, 1100, 319, 1988, 24629, 367, 2522, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]