Skip to content

Commit

Permalink
Handle new test case prefixes used for Artemis' Task feature (#17)
Browse files Browse the repository at this point in the history
* fix handling new test case prefixes

* fix deleted code for debug purposes

* ignore prefix case
  • Loading branch information
Fenmore authored Jan 9, 2024
1 parent 1ec50e3 commit 058d440
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 33 deletions.
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ A for a small group might look like this (in german):
Mandatory bestanden ■■■■■■■■□□ 75% 12/16
Ø Punktzahl ■■■■■■□□□□ 59% 5.9/10.0
Ø bestandene functional Tests ■■■■■■■□□□ 71% 8.5/12.0
Ø bestandene Modelling-Checks ■■■■■■■□□□ 69% 3.4/5.0
Ø bestandene Modelling-Checks ■■■■■■■□□□ 63% 1.2/2.0
Ø bestandene Optional-Checks ■■■■■■■□□□ 73% 2.2/3.0
Ø manueller Abzug ■■■■■■■□□□ 67% 2.1/3.0
Expand All @@ -31,13 +32,16 @@ A for a small group might look like this (in german):
■■■□□□□□□□ 25% 4/16 (FUNCTIONAL) Test Name 3
■■■□□□□□□□ 25% 4/16 (FUNCTIONAL) Test Name 4
HÄUFIG FEHLGESCHLAGENE MODELLING-CHECKS
HÄUFIG FEHLGESCHLAGENE MODELING-CHECKS
■■■■□□□□□□ 44% 7/16 Modeling-Check: Best Practices
■■■□□□□□□□ 31% 5/16 Modeling-Check: Comments
■■■□□□□□□□ 31% 5/16 Modeling-Check: Exception Handling
■■■□□□□□□□ 25% 4/16 Modeling-Check: Complexity
■■■□□□□□□□ 25% 4/16 Modeling-Check: Structure
■■■■□□□□□□ 44% 7/16 Graded Modeling-Check: Exception Handling
■■■□□□□□□□ 31% 5/16 Graded Modeling-Check: Magic Numbers
HÄUFIG FEHLGESCHLAGENE OPTIONAL-CHECKS
■■■□□□□□□□ 31% 5/16 OPTIONAL Modeling-Check: Deprecated
■■■□□□□□□□ 25% 4/16 OPTIONAL Modeling-Check: Boolean Complexity
■■■□□□□□□□ 25% 4/16 OPTIONAL Modeling-Check: Best Practices
HÄUFIGE KORREKTUR ANMERKUNGEN (mind. eine Anmerkung pro Abgabe)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
/* Licensed under EPL-2.0 2024. */
package edu.kit.kastel.sdq.scorestats.config;

import edu.kit.kastel.sdq.scorestats.core.assessment.FeedbackGroupMatcher;
import edu.kit.kastel.sdq.scorestats.core.assessment.PrefixMatcher;

public enum AutomaticFeedbackType {
MANDATORY("(MANDATORY)"),
FUNCTIONAL("(FUNCTIONAL)"),
MODELLING_CHECK("Modeling-Check");
MANDATORY("^\\(?(?i)MANDATORY(?-i)\\)?.*"),
FUNCTIONAL("^\\(?(?i)FUNCTIONAL(?-i)\\)?.*"),
MODELING_CHECK("^((?i)Graded )?Modeling-Check(?-i).*"),
OPTIONAL_CHECK("^\\(?(?i)OPTIONAL(?-i)\\)?.*");

private final String prefix;
private final String regex;

AutomaticFeedbackType(String prefix) {
this.prefix = prefix;
}
AutomaticFeedbackType(String regex) {
this.regex = regex;
}

public FeedbackGroupMatcher matcher() {
return new PrefixMatcher(this.prefix);
}
public FeedbackGroupMatcher matcher() {
return new PrefixMatcher(this.regex);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Licensed under EPL-2.0 2023. */
/* Licensed under EPL-2.0 2023-2024. */
package edu.kit.kastel.sdq.scorestats.config;

import java.io.File;
Expand Down Expand Up @@ -38,12 +38,14 @@ public ReportBuilder createReport(Arguments arguments, Course course, Exercise e
report.count(new FeedbackGroupPassedCount<>(AutomaticFeedbackType.MANDATORY)), //
report.average(new ScoreAverage<>()), //
report.average(new FeedbackGroupPassedAverage<>(AutomaticFeedbackType.FUNCTIONAL)), //
report.average(new FeedbackGroupPassedAverage<>(AutomaticFeedbackType.MODELLING_CHECK)), //
report.average(new FeedbackGroupPassedAverage<>(AutomaticFeedbackType.MODELING_CHECK)), //
report.average(new FeedbackGroupPassedAverage<>(AutomaticFeedbackType.OPTIONAL_CHECK)), //
config == null ? null : report.average(new ManualDeductionAverage<>()), //

report.frequency(new FeedbackGroupFailedFrequency<>(AutomaticFeedbackType.MANDATORY)), //
report.frequency(new FeedbackGroupFailedFrequency<>(AutomaticFeedbackType.FUNCTIONAL)), //
report.frequency(new FeedbackGroupFailedFrequency<>(AutomaticFeedbackType.MODELLING_CHECK)), //
report.frequency(new FeedbackGroupFailedFrequency<>(AutomaticFeedbackType.MODELING_CHECK)), //
report.frequency(new FeedbackGroupFailedFrequency<>(AutomaticFeedbackType.OPTIONAL_CHECK)), //

config == null ? null : report.frequency(new MistakeTypeFrequencyPerSubmission<>()), //
config == null ? null : report.frequency(new MistakeTypeFrequencyPerAnnotation<>()), //
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Licensed under EPL-2.0 2023. */
/* Licensed under EPL-2.0 2023-2024. */
package edu.kit.kastel.sdq.scorestats.config;

import java.util.List;
Expand Down Expand Up @@ -33,20 +33,22 @@ public class ReportOutput implements Output {
private final Ratio averageScore;
private final Ratio averagePassedFunctional;
private final Ratio averagePassedModellingChecks;
private final Ratio averagePassedOptionalChecks;
private final Ratio averageManualDeduction;
private final FrequencyResult<String> mandatoryFrequency;
private final FrequencyResult<String> functionalFrequency;
private final FrequencyResult<String> modellingFrequency;
private final FrequencyResult<String> optionalFrequency;
private final FrequencyResult<IMistakeType> annotationsFrequencyPerSubmission;
private final FrequencyResult<IMistakeType> annotationsFrequencyPerAnnotations;
private final List<IAnnotation> customAnnotations;
private final Arguments arguments;

public ReportOutput(Arguments arguments, Course course, Exercise exercise, Ratio participation, Ratio mandatoryPassed, Ratio averageScore,
Ratio averagePassedFunctional, Ratio averagePassedModellingChecks, Ratio averageManualDeduction, FrequencyResult<String> mandatoryFrequency,
FrequencyResult<String> functionalFrequency, FrequencyResult<String> modellingFrequency,
FrequencyResult<IMistakeType> annotationsFrequencyPerSubmission, FrequencyResult<IMistakeType> annotationsFrequencyPerAnnotations,
List<IAnnotation> customAnnotations) {
Ratio averagePassedFunctional, Ratio averagePassedModellingChecks, Ratio averagePassedOptionalChecks, Ratio averageManualDeduction,
FrequencyResult<String> mandatoryFrequency, FrequencyResult<String> functionalFrequency, FrequencyResult<String> modellingFrequency,
FrequencyResult<String> optionalFrequency, FrequencyResult<IMistakeType> annotationsFrequencyPerSubmission,
FrequencyResult<IMistakeType> annotationsFrequencyPerAnnotations, List<IAnnotation> customAnnotations) {
this.arguments = Objects.requireNonNull(arguments);
this.course = Objects.requireNonNull(course);
this.exercise = Objects.requireNonNull(exercise);
Expand All @@ -55,10 +57,12 @@ public ReportOutput(Arguments arguments, Course course, Exercise exercise, Ratio
this.averageScore = averageScore;
this.averagePassedFunctional = averagePassedFunctional;
this.averagePassedModellingChecks = averagePassedModellingChecks;
this.averagePassedOptionalChecks = averagePassedOptionalChecks;
this.averageManualDeduction = averageManualDeduction;
this.mandatoryFrequency = mandatoryFrequency;
this.functionalFrequency = functionalFrequency;
this.modellingFrequency = modellingFrequency;
this.optionalFrequency = optionalFrequency;
this.annotationsFrequencyPerSubmission = annotationsFrequencyPerSubmission;
this.annotationsFrequencyPerAnnotations = annotationsFrequencyPerAnnotations;
this.customAnnotations = customAnnotations;
Expand Down Expand Up @@ -91,10 +95,15 @@ public String print() {
}

if (this.averagePassedModellingChecks != null) {
document.append(new SummaryLine("Ø bestandene Modelling-Checks", 1,
document.append(new SummaryLine("Ø bestandene Modeling-Checks", 1,
new RatioRow(this.averagePassedModellingChecks.numerator(), (int) this.averagePassedModellingChecks.denominator())));
}

if (this.averagePassedOptionalChecks != null) {
document.append(new SummaryLine("Ø bestandene Optional-Checks", 1,
new RatioRow(this.averagePassedOptionalChecks.numerator(), (int) this.averagePassedOptionalChecks.denominator())));
}

document.append(new LineSeparator());

if (this.averageManualDeduction != null) {
Expand All @@ -115,10 +124,15 @@ public String print() {
}

if (this.modellingFrequency != null) {
document.append(new Heading(1, "HÄUFIG FEHLGESCHLAGENE MODELLING-CHECKS"),
document.append(new Heading(1, "HÄUFIG FEHLGESCHLAGENE MODELING-CHECKS"),
new FeedbackFrequencyList(1, this.modellingFrequency, this.arguments.outputLimit), new LineSeparator());
}

if (this.optionalFrequency != null) {
document.append(new Heading(1, "HÄUFIG FEHLGESCHLAGENE OPTIONAL-CHECKS"),
new FeedbackFrequencyList(1, this.optionalFrequency, this.arguments.outputLimit), new LineSeparator());
}

if (this.annotationsFrequencyPerSubmission != null) {
document.append(new Heading(1, "HÄUFIGE KORREKTUR ANMERKUNGEN (mind. eine Anmerkung pro Abgabe)"),
new MistakeTypeFrequencyList(1, this.annotationsFrequencyPerSubmission, this.arguments.outputLimit), new LineSeparator());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Licensed under EPL-2.0 2023. */
/* Licensed under EPL-2.0 2023-2024. */
package edu.kit.kastel.sdq.scorestats.core.assessment;

import edu.kit.kastel.sdq.artemis4j.api.artemis.assessment.Feedback;
Expand All @@ -10,14 +10,15 @@
*/
public final class PrefixMatcher implements FeedbackGroupMatcher {

private final String prefix;
private final String regex;

public PrefixMatcher(String prefix) {
this.prefix = prefix;
public PrefixMatcher(String regex) {
this.regex = regex;
}

/**
* Returns {@code true} if {@link Feedback#getTestName()} begins with the prefix.
* Returns {@code true} if {@link Feedback#getTestName()} begins with the
* prefix.
*
* @param feedback the feedback
* @return {@code true} if {@link Feedback#getTestName()} begins with the prefix
Expand All @@ -28,6 +29,6 @@ public boolean matches(Feedback feedback) {
throw new IllegalArgumentException();
}

return feedback.getTestName().startsWith(this.prefix);
return feedback.getTestName().matches(this.regex);
}
}

0 comments on commit 058d440

Please sign in to comment.