Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Programming exercises: Add server support for feedback suggestions #7136

Merged
Merged
Show file tree
Hide file tree
Changes from 165 commits
Commits
Show all changes
227 commits
Select commit Hold shift + click to select a range
9e6a7b9
Basic programming feedback suggestion card layout
pal03377 Aug 25, 2023
7b37b58
Better Suggestion badge for feedback suggestion cards
pal03377 Aug 25, 2023
9ea12ef
Add Accept and Discard buttons
pal03377 Aug 26, 2023
cbd820d
Add file browser badges for suggestions
pal03377 Aug 26, 2023
081b104
Fixing issues with saving inline feedback
pal03377 Aug 26, 2023
9f2e4c6
Make the programming feedback assessment editor more solid
pal03377 Aug 27, 2023
86c2fa9
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Aug 27, 2023
afd07b2
Add suggestion badge to accepted and modified feedback suggestions
pal03377 Aug 27, 2023
deb5678
Use suggestion badge component for text feedback
pal03377 Aug 27, 2023
5c64eab
Update file badges less often
pal03377 Aug 27, 2023
8b09917
Add file badge tooltips
pal03377 Aug 27, 2023
d0ef16c
Show unreferenced feedback suggestions
pal03377 Aug 27, 2023
2c2899e
Change ID for unreferenced feedback
pal03377 Aug 27, 2023
3a49e76
Improvements from self-code-review ✨
pal03377 Aug 28, 2023
f81f3d3
Write client tests: part 1
pal03377 Aug 28, 2023
944b153
Write client tests: part 2
pal03377 Aug 28, 2023
c5bb462
Text fix by reordering
pal03377 Aug 28, 2023
c4d004b
Fix Codacy issue
pal03377 Aug 28, 2023
16cf83a
Dark file badge in dark mode
pal03377 Aug 28, 2023
2025583
More feedback suggestion examples for debugging
pal03377 Aug 28, 2023
eb8bc8d
Hide feedback suggestion badges to students
pal03377 Aug 28, 2023
0462d0c
Increase test coverage
pal03377 Aug 28, 2023
3dee732
Test expectation fix
pal03377 Aug 28, 2023
5125ea9
Improve suggestion badge texts
pal03377 Aug 28, 2023
299c9e4
Fix line widget update on feedbackS changes
pal03377 Aug 28, 2023
56a0b35
Don't show feedback suggestions that are in the same file & line as e…
pal03377 Aug 28, 2023
8049cd6
Treat suggestions like normal feedback from the TA in the student fee…
pal03377 Aug 28, 2023
423c669
Prevent double-feedback when adding suggestions where there already e…
pal03377 Aug 28, 2023
aeca0cd
Change feedback height on resize
pal03377 Aug 29, 2023
6cb50cf
Change condition for de-duplication
pal03377 Aug 29, 2023
a0cf5d1
Adjust accept/discard button sizes
pal03377 Aug 29, 2023
c55af90
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Aug 29, 2023
494f65c
Remove default IDs to prevent problems with testing
pal03377 Aug 30, 2023
9f05d12
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Aug 30, 2023
cac3bba
Adjust feedback suggestions background in light more slightly
pal03377 Aug 30, 2023
6400b6a
Merge remote-tracking branch 'origin/feature/programming-exercises/fe…
pal03377 Aug 30, 2023
79e4cd9
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Aug 30, 2023
5e98ece
Fix removeSuggestion for feedback without an ID
pal03377 Aug 30, 2023
ab101ef
Fix test should correctly remove feedback suggestions
pal03377 Aug 30, 2023
b286d9f
Merge & resolve athena.service.ts conflicts
pal03377 Aug 30, 2023
d029258
Small fixes
pal03377 Aug 30, 2023
5245472
Bugfix: Make feedback work for file names containing underscore
pal03377 Aug 31, 2023
800605e
Add tests for filenames including an underscore
pal03377 Aug 31, 2023
62e1223
Review: Replace deprecated function
pal03377 Aug 31, 2023
93f90d0
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Aug 31, 2023
deb80bd
Fix code-editor-ace.component tests by adding a mock
pal03377 Aug 31, 2023
380e753
Start DTOs
pal03377 Aug 31, 2023
14af999
Mock ResizeObserver in other place where necessary
pal03377 Aug 31, 2023
c67f08f
Add more programming DTOs
pal03377 Aug 31, 2023
4d97e42
Add some more simple tests to increase the coverage
pal03377 Sep 1, 2023
9d0adfd
Fix Athena test mocks
pal03377 Sep 1, 2023
989de14
Review: Implement suggestions by Benedikt
pal03377 Sep 1, 2023
b4533ac
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Sep 1, 2023
b27c030
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Sep 2, 2023
87b67fb
Add repository zip file endpoints for Athena
pal03377 Sep 2, 2023
d6cf7e5
Put resource urls into DTOs for Athena
pal03377 Sep 2, 2023
280fa97
Move repository export into AthenaRepositoryExportService
pal03377 Sep 3, 2023
0108306
Add migration to master xml
pal03377 Sep 3, 2023
2587215
Generalize Athena services
pal03377 Sep 3, 2023
68e2892
Client adaptions to new server response format for feedback suggestions
pal03377 Sep 3, 2023
2461262
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Sep 3, 2023
c1a8979
Client adaptions to new server response format for feedback suggestions
pal03377 Sep 3, 2023
10056cc
Schedule Athena for programming exercises
pal03377 Sep 3, 2023
8512004
Add setting for feedback suggestions on exercise update page
pal03377 Sep 3, 2023
761b4a5
Only show "Enable Athena" checkbox if server supports it
pal03377 Sep 3, 2023
ab2150f
Make module selection dynamic based on the exercise type
pal03377 Sep 3, 2023
bbbda2e
Add endpoint for programming feedback suggestions
pal03377 Sep 3, 2023
38638d1
Merge + Solve conflicts with #6925
pal03377 Sep 3, 2023
13fe2ac
Make Exercise.feedbackSuggestionsEnabled optional in the client
pal03377 Sep 3, 2023
2549c62
Merge branch 'feature/programming-exercises/feedback-suggestions-serv…
pal03377 Sep 3, 2023
44d03ae
Fix basic merge conflicts
pal03377 Sep 3, 2023
87dd1ba
Convert programming feedback suggestions to Feedback objects on the c…
pal03377 Sep 3, 2023
c03c06f
Correct Athena Service URL
pal03377 Sep 3, 2023
d6c02f8
Merge branch 'feature/programming-exercises/feedback-suggestions-serv…
pal03377 Sep 3, 2023
1709f5a
Review: Small formatting change
pal03377 Sep 3, 2023
f3ab669
Attempt at fixing tests
pal03377 Sep 3, 2023
0cb3688
Fix more tests
pal03377 Sep 3, 2023
777d649
Merge branch 'feature/programming-exercises/feedback-suggestions-serv…
pal03377 Sep 3, 2023
01de8d0
Replace remaining URLs for /api/public
pal03377 Sep 3, 2023
1471a5b
Merge branch 'feature/programming-exercises/feedback-suggestions-serv…
pal03377 Sep 3, 2023
559d00e
fix server urls
pal03377 Sep 3, 2023
4bb3e5d
Merge branch 'feature/programming-exercises/feedback-suggestions-serv…
pal03377 Sep 3, 2023
8b27c68
Fix artemisServerUrl value
pal03377 Sep 3, 2023
7be5dec
Merge branch 'feature/programming-exercises/feedback-suggestions-serv…
pal03377 Sep 3, 2023
197941a
Allow EnforceNoting by adding `@ManualConfig`
pal03377 Sep 3, 2023
e47dbf5
Merge branch 'feature/programming-exercises/feedback-suggestions-serv…
pal03377 Sep 3, 2023
9c89027
Code-review myself
pal03377 Sep 3, 2023
0db6604
Merge branch 'feature/programming-exercises/feedback-suggestions-serv…
pal03377 Sep 3, 2023
5cd9012
Fix cypress test
pal03377 Sep 3, 2023
4d6dfb3
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Sep 3, 2023
ad9e0f1
Fix URLs for tests
pal03377 Sep 3, 2023
47c46fd
Add tests
pal03377 Sep 4, 2023
ba6f718
Satisfy server-style tests
pal03377 Sep 4, 2023
53d7ca0
Make AthenaResource more abstract
pal03377 Sep 4, 2023
e119569
Add interface comment for TeamScale
pal03377 Sep 4, 2023
58b4381
Fix more tests
pal03377 Sep 4, 2023
2081896
Temp: Attempt deleting old blocking files on the Bamboo agent
pal03377 Sep 4, 2023
8968b55
Remove temporary cleanup
pal03377 Sep 4, 2023
8daeb08
Temporarily remove AthenaRepositoryExportServiceTest to see if the pr…
pal03377 Sep 4, 2023
b8c77bb
Add AthenaRepositoryExportServiceTest again
pal03377 Sep 4, 2023
680a395
Remove enabling "automatic assessment suggestions" in Cypress because…
pal03377 Sep 4, 2023
1c06661
Prevent server restart in AthenaRepositoryExportServiceTest
pal03377 Sep 4, 2023
ef6342c
Merge branch 'feature/programming-exercises/feedback-suggestions-serv…
pal03377 Sep 4, 2023
2971490
Change return types for athena.service.ts
pal03377 Sep 4, 2023
52857a6
Auto-accept text feedback
pal03377 Sep 4, 2023
308b417
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Sep 6, 2023
4a263a6
Merge branch 'feature/programming-exercises/feedback-suggestions-serv…
pal03377 Sep 6, 2023
bfe4f40
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Sep 7, 2023
3e74575
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Sep 9, 2023
505beb7
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Sep 9, 2023
a7475bc
Remove wrong feedback sending for example submission
pal03377 Sep 10, 2023
4103720
Send feedback for programming exercises
pal03377 Sep 10, 2023
ed8497b
Schedule Athena for programming exercises instantly as well
pal03377 Sep 10, 2023
c46e2aa
Add temporarily ignored mock suggestions for programming exercises
pal03377 Sep 10, 2023
4bfa841
Fix problems with feedback sending
pal03377 Sep 10, 2023
2ae82c5
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Sep 11, 2023
ca9f127
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Sep 11, 2023
c13d62f
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Sep 11, 2023
b795d95
Merge branch 'feature/programming-exercises/feedback-suggestions-toge…
pal03377 Sep 11, 2023
3591555
Merge branch 'feature/programming-exercises/feedback-suggestions' int…
pal03377 Sep 11, 2023
c1075c4
Merge branch 'feature/programming-exercises/feedback-suggestions' int…
pal03377 Sep 11, 2023
c3fa067
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Sep 12, 2023
2f09ee8
Implement review suggestions by Markus
pal03377 Sep 14, 2023
e160935
Merge branch 'feature/programming-exercises/feedback-suggestions' int…
pal03377 Sep 15, 2023
94f32f3
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Sep 16, 2023
5c98770
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Sep 17, 2023
4f823a7
Merge branch 'feature/programming-exercises/feedback-suggestions' int…
pal03377 Sep 17, 2023
39d185a
Merge branch 'develop' into feature/programming-exercises/feedback-su…
MarkusPaulsen Sep 21, 2023
c1c0def
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Sep 27, 2023
88dd466
Merge branch 'feature/programming-exercises/feedback-suggestions' int…
pal03377 Sep 27, 2023
b4932cc
Remove mock data for merging
pal03377 Sep 28, 2023
8fb21bf
Implement Patrick's suggestions
pal03377 Sep 28, 2023
8d97684
Fix cypress test
pal03377 Sep 28, 2023
ff380d5
Merge branch 'develop' into feature/programming-exercises/feedback-su…
bassner Sep 29, 2023
d476108
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Sep 29, 2023
34dcaaa
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Sep 30, 2023
27654e1
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Oct 1, 2023
067e894
Merge branch 'feature/programming-exercises/feedback-suggestions' int…
pal03377 Oct 1, 2023
bf1a703
Fix server build
pal03377 Oct 1, 2023
b50882c
Use default feedback suggestion badge text for text exercises
pal03377 Oct 1, 2023
7bf65ba
Merge branch 'feature/programming-exercises/feedback-suggestions' int…
pal03377 Oct 1, 2023
e5f84e9
Remove mock data
pal03377 Oct 1, 2023
6c41b5f
Improve spacing above feedback suggestion card
pal03377 Oct 1, 2023
dbdad3b
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Oct 4, 2023
fc254fb
Add feedback suggestions confirmation dialog
pal03377 Oct 6, 2023
51ea03f
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Oct 6, 2023
e17e94f
Improve pending feedback suggestions confirmation dialog feeling
pal03377 Oct 6, 2023
f437f89
Add TODO for grading instructions
pal03377 Oct 6, 2023
bd48b11
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Oct 9, 2023
92525a1
Only load suggestions for new assessments
pal03377 Oct 9, 2023
eb5bc7e
Support unreferenced text feedback suggestions
pal03377 Oct 9, 2023
27740d2
Use manual feedback type for feedback suggestions (makes more sense)
pal03377 Oct 9, 2023
2ba873c
Fix client tests
pal03377 Oct 10, 2023
342e009
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Oct 10, 2023
2a27238
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Oct 18, 2023
7f29fcb
Add grading criteria support
pal03377 Oct 23, 2023
5f50cc7
Make feedback_suggestions_enabled non-nullable
pal03377 Oct 23, 2023
08d44da
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Oct 23, 2023
fb9716d
Fix typo
pal03377 Oct 23, 2023
63c16f3
Fetch structured grading instructions
pal03377 Oct 23, 2023
f008b5a
Fix issues with lazy loaded grading criteria
pal03377 Oct 23, 2023
e635abc
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Oct 23, 2023
97d078c
Fix authentication issues in tests
pal03377 Oct 24, 2023
8929a25
Merge remote-tracking branch 'origin/feature/programming-exercises/fe…
pal03377 Oct 24, 2023
d4d0384
Also test grading criteria DTO conversion in one Athena test
pal03377 Oct 24, 2023
8bd0fc4
Save changed exercise in test
pal03377 Oct 24, 2023
2399053
Remove unused file
pal03377 Oct 25, 2023
b1a6c2d
Use client feedback suggestions models in tests directly
pal03377 Oct 25, 2023
1dd7a70
Add code editor assessment tests
pal03377 Oct 25, 2023
3d8870f
Add code editor assessment tests
pal03377 Oct 25, 2023
9751001
Enable Athena for exercise where Athena-specific functionality is tested
pal03377 Oct 25, 2023
e7e8486
Improve test coverage
pal03377 Oct 25, 2023
c99b070
Change feedback DTOs to only contain the grading instruction ID
pal03377 Oct 26, 2023
090e469
Make structuredGradingInstructionId nullable
pal03377 Oct 26, 2023
29aac4d
Also test grading instruction DTO conversion
pal03377 Oct 27, 2023
069cfda
Remove annotation
pal03377 Oct 27, 2023
1aa74a2
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Oct 27, 2023
76f7484
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Oct 28, 2023
9266e2c
Solve merge conflicts
pal03377 Oct 28, 2023
8d32c4c
Teamscale
pal03377 Oct 28, 2023
c7f5ffa
Fix build after merge
pal03377 Oct 28, 2023
9f9623f
Test programming assessment Athena feedback sending
pal03377 Oct 28, 2023
0f9b5b7
Test Athena export endpoints
pal03377 Oct 29, 2023
b1bb7b0
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Oct 29, 2023
a9a5195
Add interface comments to GradingCriterionDTO and GradingInstructionDTO
pal03377 Oct 29, 2023
b00a7bc
Test structured grading instruction finding in Athena service
pal03377 Oct 29, 2023
9b8c248
Test some access controls
pal03377 Oct 29, 2023
026a695
Remove unnecessary teardown
pal03377 Oct 29, 2023
9e378e6
Implement Felix's feedback 1
pal03377 Oct 30, 2023
a394719
Add Programming Submission Selection
pal03377 Nov 3, 2023
86846f7
Fix bugs from new programming submission selection
pal03377 Nov 3, 2023
a27947c
Implement Felix's feedback 2
pal03377 Nov 3, 2023
221ade8
Fix AthenaRepositoryExportService test
pal03377 Nov 3, 2023
b6a32ae
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Nov 3, 2023
476a834
Implement Tobias' feedback
pal03377 Nov 3, 2023
7d9c7e9
Merge remote-tracking branch 'origin/feature/programming-exercises/fe…
pal03377 Nov 3, 2023
3ec3452
Fix client tests
pal03377 Nov 3, 2023
0ed976c
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Nov 3, 2023
c53f6cd
Adapt server tests to new http error code
pal03377 Nov 3, 2023
4c9fb36
Implement Felix's feedback 3
pal03377 Nov 4, 2023
d567f21
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Nov 4, 2023
bbde7d2
Fix server style
pal03377 Nov 4, 2023
799c1c0
Fix server tests
pal03377 Nov 4, 2023
40b40e3
Try using Object instead of interfaces again to test if that's the re…
pal03377 Nov 4, 2023
d27c58d
Revert "Try using Object instead of interfaces again to test if that'…
pal03377 Nov 4, 2023
ad67db4
Verify all mock request expectations
pal03377 Nov 4, 2023
ef6eae3
Fix AthenaSubmissionSendingServiceTest submissions not being found be…
pal03377 Nov 5, 2023
fe3fc07
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Nov 5, 2023
51aafa8
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Nov 7, 2023
680323d
Fix missing results for text exercise submissions
pal03377 Nov 8, 2023
39226f5
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Nov 8, 2023
ef2b02e
Always mark adapted feedback suggestions as such, even with the defau…
pal03377 Nov 8, 2023
71051cf
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Nov 8, 2023
cd7c7f0
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Nov 12, 2023
8053092
Remove redundant @NotNull
pal03377 Nov 12, 2023
5d3f666
Fix adapted suggestion marking
pal03377 Nov 13, 2023
5b07a8b
Fix test
pal03377 Nov 13, 2023
b87d54d
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Nov 13, 2023
7a10928
Fix marking inline suggestions as "adapted"
pal03377 Nov 13, 2023
ebce340
More expectation that's not used to fix flaky test
pal03377 Nov 13, 2023
a44ea49
Merge branch 'develop' into feature/programming-exercises/feedback-su…
krusche Nov 16, 2023
cd4ffff
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Nov 19, 2023
71aea89
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Nov 20, 2023
01cb04e
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Nov 21, 2023
a85364a
Merge branch 'develop' into feature/programming-exercises/feedback-su…
pal03377 Nov 23, 2023
f0f44a2
Allow null values for feedback_suggestions_enabled column
pal03377 Nov 24, 2023
dd07677
Merge branch 'develop' into feature/programming-exercises/feedback-su…
maximiliansoelch Nov 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/dev/setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,10 @@ You can override the following configuration options in this file.
athena:
url: http://localhost:5000
secret: abcdef12345
modules:
# See https://github.com/ls1intum/Athena for a list of available modules
text: module_text_cofee
programming: module_programming_themisml

Change all entries with ``<...>`` with proper values, e.g. your TUM
Online account credentials to connect to the given instances of JIRA,
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/de/tum/in/www1/artemis/config/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ public final class Constants {

public static final String APOLLON_CONVERSION_API_PATH = "/api/apollon/convert-to-pdf";

public static final String ATHENA_PROGRAMMING_EXERCISE_REPOSITORY_API_PATH = "/api/public/athena/programming-exercises/";

// short names should have at least 3 characters and must start with a letter
public static final String SHORT_NAME_REGEX = "^[a-zA-Z][a-zA-Z0-9]{2,}";

Expand Down
11 changes: 11 additions & 0 deletions src/main/java/de/tum/in/www1/artemis/domain/Exercise.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ public abstract class Exercise extends BaseExercise implements LearningObject {
@Column(name = "second_correction_enabled")
private Boolean secondCorrectionEnabled = false;

@Column(name = "feedback_suggestions_enabled") // enables Athena
private boolean feedbackSuggestionsEnabled = false;

@ManyToOne
@JsonView(QuizView.Before.class)
private Course course;
Expand Down Expand Up @@ -766,6 +769,14 @@ public void setSecondCorrectionEnabled(boolean secondCorrectionEnabled) {
this.secondCorrectionEnabled = secondCorrectionEnabled;
}

public boolean getFeedbackSuggestionsEnabled() {
return Boolean.TRUE.equals(feedbackSuggestionsEnabled);
pal03377 marked this conversation as resolved.
Show resolved Hide resolved
}

public void setFeedbackSuggestionsEnabled(boolean feedbackSuggestionsEnabled) {
this.feedbackSuggestionsEnabled = feedbackSuggestionsEnabled;
}

public List<GradingCriterion> getGradingCriteria() {
return gradingCriteria;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import javax.persistence.*;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;

import de.tum.in.www1.artemis.domain.enumeration.AssessmentType;
Expand Down Expand Up @@ -35,17 +34,12 @@ public void setExampleSolution(String exampleSolution) {
this.exampleSolution = exampleSolution;
}

@JsonIgnore
public boolean isFeedbackSuggestionsEnabled() {
return getAssessmentType() == AssessmentType.SEMI_AUTOMATIC;
}

/**
* Disable feedback suggestions for this exercise by setting the assessment type to MANUAL.
* Only changes the assessment type if feedback suggestions are currently enabled.
*/
public void disableFeedbackSuggestions() {
pal03377 marked this conversation as resolved.
Show resolved Hide resolved
if (isFeedbackSuggestionsEnabled()) {
if (this.getFeedbackSuggestionsEnabled()) {
setAssessmentType(AssessmentType.MANUAL);
pal03377 marked this conversation as resolved.
Show resolved Hide resolved
}
}
pal03377 marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,24 @@ default boolean toggleSecondCorrection(Exercise exercise) {
""")
Set<Exercise> getAllExercisesUserParticipatedInWithEagerParticipationsSubmissionsResultsFeedbacksByUserId(long userId);

/**
* Finds all exercises filtered by feedback suggestions and due date.
*
* @param feedbackSuggestionsEnabled - filter by feedback suggestions enabled
* @param dueDate - filter by due date
* @return List of Exercises
*/
List<Exercise> findByFeedbackSuggestionsEnabledAndDueDateIsAfter(boolean feedbackSuggestionsEnabled, ZonedDateTime dueDate);
pal03377 marked this conversation as resolved.
Show resolved Hide resolved

/**
* Find all exercises feedback suggestions (Athena) and with *Due Date* in the future.
*
* @return List of Exercises
*/
default List<Exercise> findAllFeedbackSuggestionsEnabledExercisesWithFutureDueDate() {
return findByFeedbackSuggestionsEnabledAndDueDateIsAfter(true, ZonedDateTime.now());
}

/**
* For an explanation, see {@link de.tum.in.www1.artemis.web.rest.ExamResource#getAllExercisesWithPotentialPlagiarismForExam(long,long)}
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,24 @@
return findById(programmingExerciseId).orElseThrow(() -> new EntityNotFoundException("Programming Exercise", programmingExerciseId));
}

/**
* Find a programming exercise by its id, with grading criteria loaded, and throw an EntityNotFoundException if it cannot be found
*
* @param exerciseId of the programming exercise.
* @return The programming exercise related to the given id
*/
@NotNull
pal03377 marked this conversation as resolved.
Show resolved Hide resolved
@Query("""
SELECT DISTINCT e FROM ProgrammingExercise e
LEFT JOIN FETCH e.gradingCriteria
WHERE e.id = :#{#exerciseId}
pal03377 marked this conversation as resolved.
Show resolved Hide resolved
""")
Optional<ProgrammingExercise> findByIdWithGradingCriteria(Long exerciseId);
pal03377 marked this conversation as resolved.
Show resolved Hide resolved

default ProgrammingExercise findByIdWithGradingCriteriaElseThrow(long exerciseId) {

Check warning on line 456 in src/main/java/de/tum/in/www1/artemis/repository/ProgrammingExerciseRepository.java

View check run for this annotation

Teamscale / teamscale-findings

src/main/java/de/tum/in/www1/artemis/repository/ProgrammingExerciseRepository.java#L456

In this file 36 interface comments are missing. Consider adding explanatory comments or restricting the visibility. View in Teamscale: https://teamscale.io/activity.html#details/GitHub-ls1intum-Artemis?t=feature%2Fprogramming-exercises%2Ffeedback-suggestions-server%3A1698145467000
return findByIdWithGradingCriteria(exerciseId).orElseThrow(() -> new EntityNotFoundException("Programming Exercise", exerciseId));
}

/**
* Find a programming exercise with auxiliary repositories by its id and throw an EntityNotFoundException if it cannot be found
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@
@Repository
public interface ProgrammingSubmissionRepository extends JpaRepository<ProgrammingSubmission, Long> {

/**
* Load programming submission only
*
* @param submissionId the submissionId
* @return programming submission
*/
@NotNull
default ProgrammingSubmission findByIdElseThrow(long submissionId) {
return findById(submissionId).orElseThrow(() -> new EntityNotFoundException("ProgrammingSubmission", submissionId));
}

@EntityGraph(type = LOAD, attributePaths = { "results.feedbacks" })
ProgrammingSubmission findFirstByParticipationIdAndCommitHashOrderByIdDesc(Long participationId, String commitHash);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import java.util.Optional;
import java.util.Set;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.EntityGraph;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
Expand Down Expand Up @@ -441,6 +443,23 @@ default Submission findByIdWithResultsElseThrow(long submissionId) {
return findWithEagerResultsAndAssessorById(submissionId).orElseThrow(() -> new EntityNotFoundException("Submission", +submissionId));
}

/**
* Gets all Submissions which are submitted
*
* @param exerciseId the ID of the exercise
* @param pageable the pagination information for the query
* @return Set of Submissions
*/
Page<Submission> findByParticipation_ExerciseIdAndSubmittedIsTrue(long exerciseId, Pageable pageable);
pal03377 marked this conversation as resolved.
Show resolved Hide resolved

/**
* Gets all submitted Submissions
*
* @param exerciseId the ID of the exercise
* @return Set of Submissions
*/
Set<Submission> findByParticipation_ExerciseIdAndSubmittedIsTrue(long exerciseId);

default Submission findByIdElseThrow(long submissionId) {
return findById(submissionId).orElseThrow(() -> new EntityNotFoundException("Submission", submissionId));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import static org.springframework.data.jpa.repository.EntityGraph.EntityGraphType.LOAD;

import java.time.ZonedDateTime;
import java.util.List;
import java.util.Optional;

Expand All @@ -16,7 +15,6 @@
import org.springframework.stereotype.Repository;

import de.tum.in.www1.artemis.domain.TextExercise;
import de.tum.in.www1.artemis.domain.enumeration.AssessmentType;
import de.tum.in.www1.artemis.web.rest.errors.EntityNotFoundException;

/**
Expand All @@ -35,8 +33,6 @@
@EntityGraph(type = LOAD, attributePaths = { "teamAssignmentConfig", "categories", "competencies" })
Optional<TextExercise> findWithEagerTeamAssignmentConfigAndCategoriesAndCompetenciesById(Long exerciseId);

List<TextExercise> findByAssessmentTypeAndDueDateIsAfter(AssessmentType assessmentType, ZonedDateTime dueDate);

@Query("select textExercise from TextExercise textExercise left join fetch textExercise.exampleSubmissions exampleSubmissions left join fetch exampleSubmissions.submission submission left join fetch submission.results result left join fetch result.feedbacks left join fetch submission.blocks left join fetch result.assessor left join fetch textExercise.teamAssignmentConfig where textExercise.id = :#{#exerciseId}")
Optional<TextExercise> findByIdWithExampleSubmissionsAndResults(@Param("exerciseId") Long exerciseId);

Expand All @@ -48,6 +44,18 @@
return findById(exerciseId).orElseThrow(() -> new EntityNotFoundException("Text Exercise", exerciseId));
}

@Query("""
SELECT DISTINCT e FROM TextExercise e
LEFT JOIN FETCH e.gradingCriteria
WHERE e.id = :#{#exerciseId}
pal03377 marked this conversation as resolved.
Show resolved Hide resolved
""")
Optional<TextExercise> findByIdWithGradingCriteria(long exerciseId);

Check warning on line 52 in src/main/java/de/tum/in/www1/artemis/repository/TextExerciseRepository.java

View check run for this annotation

Teamscale / teamscale-findings

src/main/java/de/tum/in/www1/artemis/repository/TextExerciseRepository.java#L52

In this file 9 interface comments are missing. Consider adding explanatory comments or restricting the visibility. View in Teamscale: Line 31: https://teamscale.io/findings.html#details/GitHub-ls1intum-Artemis?t=feature%2Fprogramming-exercises%2Ffeedback-suggestions-server%3AHEAD&id=CA9F276A346B99B27226EC2E6FEAE5AE Line 34: https://teamscale.io/findings.html#details/GitHub-ls1intum-Artemis?t=feature%2Fprogramming-exercises%2Ffeedback-suggestions-server%3AHEAD&id=4307947CB2DABDAB345A75B62F1C760C Line 37: https://teamscale.io/findings.html#details/GitHub-ls1intum-Artemis?t=feature%2Fprogramming-exercises%2Ffeedback-suggestions-server%3AHEAD&id=94184F1E42118EBBB2E785246F2FB9D4 Line 40: https://teamscale.io/findings.html#details/GitHub-ls1intum-Artemis?t=feature%2Fprogramming-exercises%2Ffeedback-suggestions-server%3AHEAD&id=F42073DCC29816BAFD8D67B31B57A9F4 Line 43: https://teamscale.io/findings.html#details/GitHub-ls1intum-Artemis?t=feature%2Fprogramming-exercises%2Ffeedback-suggestions-server%3AHEAD&id=373202DB092C98C4AF7E248F06BE4352 Line 52: https://teamscale.io/findings.html#details/GitHub-ls1intum-Artemis?t=feature%2Fprogramming-exercises%2Ffeedback-suggestions-server%3AHEAD&id=20440FA1E25B5D4E7FC8746C2859139C Line 55: https://teamscale.io/findings.html#details/GitHub-ls1intum-Artemis?t=feature%2Fprogramming-exercises%2Ffeedback-suggestions-server%3AHEAD&id=DCA7D13C788CD9988DF2458DA1E6F1CF Line 60: https://teamscale.io/findings.html#details/GitHub-ls1intum-Artemis?t=feature%2Fprogramming-exercises%2Ffeedback-suggestions-server%3AHEAD&id=F64A2A38DDA1DC7CD70113D72A72BE8E Line 65: https://teamscale.io/findings.html#details/GitHub-ls1intum-Artemis?t=feature%2Fprogramming-exercises%2Ffeedback-suggestions-server%3AHEAD&id=0E62B318E55EDB5318FA4797A9521137

@NotNull
default TextExercise findByIdWithGradingCriteriaElseThrow(long exerciseId) {
return findByIdWithGradingCriteria(exerciseId).orElseThrow(() -> new EntityNotFoundException("Text Exercise", exerciseId));
}

@NotNull
default TextExercise findByIdWithExampleSubmissionsAndResultsElseThrow(long exerciseId) {
return findByIdWithExampleSubmissionsAndResults(exerciseId).orElseThrow(() -> new EntityNotFoundException("Text Exercise", exerciseId));
Expand All @@ -57,13 +65,4 @@
default TextExercise findByIdWithStudentParticipationsAndSubmissionsElseThrow(long exerciseId) {
return findWithStudentParticipationsAndSubmissionsById(exerciseId).orElseThrow(() -> new EntityNotFoundException("Text Exercise", exerciseId));
}

/**
* Find all exercises with *Due Date* in the future.
*
* @return List of Text Exercises
*/
default List<TextExercise> findAllAutomaticAssessmentTextExercisesWithFutureDueDate() {
return findByAssessmentTypeAndDueDateIsAfter(AssessmentType.SEMI_AUTOMATIC, ZonedDateTime.now());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

import javax.validation.constraints.NotNull;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.EntityGraph;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
Expand Down Expand Up @@ -67,16 +65,6 @@ default TextSubmission findByIdElseThrow(long submissionId) {
@EntityGraph(type = LOAD, attributePaths = { "blocks" })
Set<TextSubmission> findByParticipation_ExerciseIdAndSubmittedIsTrue(long exerciseId);

/**
* Gets all TextSubmissions which are submitted and loads all blocks
*
* @param exerciseId the ID of the exercise
* @param pageable the pagination information for the query
* @return Set of Text Submissions
*/
@EntityGraph(type = LOAD, attributePaths = { "blocks" })
Page<TextSubmission> findByParticipation_ExerciseIdAndSubmittedIsTrue(long exerciseId, Pageable pageable);

@NotNull
default TextSubmission getTextSubmissionWithResultAndTextBlocksAndFeedbackByResultIdElseThrow(long resultId) {
return findWithEagerResultAndTextBlocksAndFeedbackByResults_Id(resultId) // TODO should be EntityNotFoundException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ else if (textExercise.isExamExercise()) {
*/
public Optional<TextSubmission> getRandomTextSubmissionEligibleForNewAssessment(TextExercise textExercise, boolean skipAssessmentQueue, boolean examMode, int correctionRound) {
// If automatic assessment is enabled and available, try to learn the most possible amount during the first correction round
if (textExercise.isFeedbackSuggestionsEnabled() && athenaSubmissionSelectionService.isPresent() && !skipAssessmentQueue && correctionRound == 0) {
if (textExercise.getFeedbackSuggestionsEnabled() && athenaSubmissionSelectionService.isPresent() && !skipAssessmentQueue && correctionRound == 0) {
pal03377 marked this conversation as resolved.
Show resolved Hide resolved
var assessableSubmissions = getAssessableSubmissions(textExercise, examMode, correctionRound);
var athenaSubmissionId = athenaSubmissionSelectionService.get().getProposedSubmissionId(textExercise, assessableSubmissions.stream().map(Submission::getId).toList());
if (athenaSubmissionId.isPresent()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
package de.tum.in.www1.artemis.service.connectors.athena;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import de.tum.in.www1.artemis.domain.*;
import de.tum.in.www1.artemis.repository.ProgrammingExerciseRepository;
import de.tum.in.www1.artemis.repository.TextBlockRepository;
import de.tum.in.www1.artemis.repository.TextExerciseRepository;
import de.tum.in.www1.artemis.service.dto.athena.*;

/**
* Service to convert exercises, submissions and feedback to DTOs for Athena.
*/
@Service
public class AthenaDTOConverter {

@Value("${server.url}")
private String artemisServerUrl;
pal03377 marked this conversation as resolved.
Show resolved Hide resolved

private final TextBlockRepository textBlockRepository;

private final TextExerciseRepository textExerciseRepository;

private final ProgrammingExerciseRepository programmingExerciseRepository;

public AthenaDTOConverter(TextBlockRepository textBlockRepository, TextExerciseRepository textExerciseRepository, ProgrammingExerciseRepository programmingExerciseRepository) {
this.textBlockRepository = textBlockRepository;
this.textExerciseRepository = textExerciseRepository;
this.programmingExerciseRepository = programmingExerciseRepository;
}

/**
* Convert an exercise to a DTO for Athena.
*
* @param exercise the exercise to convert
* @return *ExerciseDTO for Athena
*/
public Object ofExercise(Exercise exercise) {
tobias-lippert marked this conversation as resolved.
Show resolved Hide resolved
switch (exercise.getExerciseType()) {
case TEXT -> {
// Fetch text exercise with grade criteria
var textExercise = textExerciseRepository.findByIdWithGradingCriteriaElseThrow(exercise.getId());
return TextExerciseDTO.of(textExercise);
}
case PROGRAMMING -> {
// Fetch programming exercise with grading criteria
var programmingExercise = programmingExerciseRepository.findByIdWithGradingCriteriaElseThrow(exercise.getId());
return ProgrammingExerciseDTO.of(programmingExercise, artemisServerUrl);
}
}
throw new IllegalArgumentException("Exercise type not supported: " + exercise.getExerciseType());
}

/**
* Convert a submission to a DTO for Athena.
*
* @param exerciseId the id of the exercise the submission belongs to
* @param submission the submission to convert
* @return *SubmissionDTO for Athena
*/
public Object ofSubmission(long exerciseId, Submission submission) {
if (submission instanceof TextSubmission) {
pal03377 marked this conversation as resolved.
Show resolved Hide resolved
pal03377 marked this conversation as resolved.
Show resolved Hide resolved
return TextSubmissionDTO.of(exerciseId, (TextSubmission) submission);
}
else if (submission instanceof ProgrammingSubmission) {
return ProgrammingSubmissionDTO.of(exerciseId, (ProgrammingSubmission) submission, artemisServerUrl);
}
throw new IllegalArgumentException("Submission type not supported: " + submission.getType());
}

/**
* Convert a feedback to a DTO for Athena.
*
* @param exercise the exercise the feedback belongs to
* @param submissionId the id of the submission the feedback belongs to
* @param feedback the feedback to convert
* @return *FeedbackDTO for Athena
*/
public Object ofFeedback(Exercise exercise, long submissionId, Feedback feedback) {
switch (exercise.getExerciseType()) {
case TEXT -> {
TextBlock feedbackTextBlock = null;
if (feedback.getReference() != null) {
feedbackTextBlock = textBlockRepository.findById(feedback.getReference()).orElse(null);
}
return TextFeedbackDTO.of(exercise.getId(), submissionId, feedback, feedbackTextBlock);
}
case PROGRAMMING -> {
return ProgrammingFeedbackDTO.of(exercise.getId(), submissionId, feedback);
}
}
throw new IllegalArgumentException("Feedback type not supported: " + exercise.getId());
}
}
Loading
Loading