Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

Commit

Permalink
Added information about count of locked/finished submissions (#136)
Browse files Browse the repository at this point in the history
* Added information about count count locked/finished submissions

* small cleanup of the assessment-counter-code

* Removed debugging
  • Loading branch information
Shirkanesi authored Dec 1, 2021
1 parent 0225e3a commit 9f54dc1
Showing 1 changed file with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.ui.part.ViewPart;

import edu.kit.kastel.eclipse.grading.view.activator.Activator;
import edu.kit.kastel.eclipse.grading.view.controllers.AssessmentViewController;
import edu.kit.kastel.eclipse.grading.view.utilities.AssessmentUtilities;
import edu.kit.kastel.sdq.eclipse.grading.api.artemis.mapping.SubmissionFilter;
import edu.kit.kastel.sdq.eclipse.grading.api.backendstate.Transition;
import edu.kit.kastel.sdq.eclipse.grading.api.controller.ISystemwideController;
import edu.kit.kastel.sdq.eclipse.grading.api.model.IMistakeType;
import edu.kit.kastel.sdq.eclipse.grading.api.model.IRatingGroup;

Expand All @@ -49,6 +51,7 @@ public class ArtemisGradingView extends ViewPart {
private Combo examCombo;
private Combo exerciseCombo;
private Combo courseCombo;
private Label correctionCountLbl;

public ArtemisGradingView() {
this.viewController = new AssessmentViewController();
Expand Down Expand Up @@ -242,10 +245,14 @@ private void createAssessmentTab(TabFolder tabFolder) {
Composite assessmentComposite = new Composite(scrolledCompositeAssessment, SWT.NONE);
assessmentComposite.setLayout(new GridLayout(2, false));

correctionCountLbl = new Label(assessmentComposite, SWT.NONE);
correctionCountLbl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
correctionCountLbl.setText("");

Label lblCourse = new Label(assessmentComposite, SWT.NONE);
lblCourse.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblCourse.setText("Course");

this.courseCombo = new Combo(assessmentComposite, SWT.READ_ONLY);
this.courseCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

Expand Down Expand Up @@ -476,6 +483,24 @@ private void updatePenalty(String ratingGroupName) {
private void updateState() {
this.possibleActions.values().forEach(set -> set.forEach(control -> control.setEnabled(false)));
this.viewController.getPossiblyTransitions().forEach(transition -> this.possibleActions.get(transition).forEach(control -> control.setEnabled(true)));
this.updateCorrectedSubmissionCount();
}

/**
* Updates the text above exam & exercise-selection according to the amount of assessed submissions (by the current tutor)
* for the currently selected exercise (if selected; otherwise just an empty string)
* Method is triggered by all invocations of updateState, hence a variety of {@link Transition}s could trigger a change.
* (e.g. selecting another exercise, starting an assessment, submitting an assessment, ...)
*/
private void updateCorrectedSubmissionCount() {
if (this.exerciseCombo.getSelectionIndex() != -1) {
ISystemwideController sc = Activator.getDefault().getSystemwideController();
correctionCountLbl.setText(String.format("Started submissions: %d Submitted: %d",
sc.getBegunSubmissionsProjectNames(SubmissionFilter.ALL).size(),
sc.getBegunSubmissionsProjectNames(SubmissionFilter.SAVED_AND_SUBMITTED).size()));
} else {
correctionCountLbl.setText("");
}
}

private void addControlToPossibleActions(Control control, Transition transition) {
Expand Down

0 comments on commit 9f54dc1

Please sign in to comment.