File tree Expand file tree Collapse file tree 2 files changed +21
-3
lines changed
tmc-plugin/src/fi/helsinki/cs/tmc Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -70,11 +70,18 @@ protected CourseDb getCourseDb() {
70
70
71
71
@ Override
72
72
public boolean enable (Project ... projects ) {
73
- if (projects .length > 1 ) {
73
+ if (projects .length != 1 ) {
74
74
return false ; // One at a time please
75
- } else {
76
- return super .enable (projects );
77
75
}
76
+
77
+ TmcProjectInfo projectInfo = projectMediator .wrapProject (projects [0 ]);
78
+ Exercise exercise = projectMediator .tryGetExerciseForProject (projectInfo , courseDb );
79
+
80
+ if (exercise != null && !exercise .isCodeReviewRequestsEnabled ()) {
81
+ return false ;
82
+ }
83
+
84
+ return super .enable (projects );
78
85
}
79
86
80
87
@ Override
Original file line number Diff line number Diff line change @@ -57,6 +57,9 @@ public class Exercise implements Serializable {
57
57
@ SerializedName ("valgrind_strategy" )
58
58
private ValgrindStrategy valgrindStrategy = ValgrindStrategy .FAIL ;
59
59
60
+ @ SerializedName ("code_review_requests_enabled" )
61
+ private boolean codeReviewRequestsEnabled ;
62
+
60
63
public enum ValgrindStrategy {
61
64
@ SerializedName ("" )
62
65
NONE ,
@@ -262,6 +265,14 @@ public ValgrindStrategy getValgrindStrategy() {
262
265
return valgrindStrategy ;
263
266
}
264
267
268
+ public boolean isCodeReviewRequestsEnabled () {
269
+ return codeReviewRequestsEnabled ;
270
+ }
271
+
272
+ public void setCodeReviewRequestsEnabled (boolean codeReviewRequestsEnabled ) {
273
+ this .codeReviewRequestsEnabled = codeReviewRequestsEnabled ;
274
+ }
275
+
265
276
@ Override
266
277
public String toString () {
267
278
return name ;
You can’t perform that action at this time.
0 commit comments