Search in sources :

Example 1 with SimilarElementCount

use of de.tum.in.www1.artemis.domain.modeling.SimilarElementCount in project ArTEMiS by ls1intum.

the class ModelingSubmissionService method setNumberOfAffectedSubmissionsPerElement.

/**
 * Sets number of potential automatic Feedback's for each model element belonging to the `Result`'s submission.
 * This number determines how many other submissions would be affected if the user were to submit a certain element feedback.
 * For each ModelElement of the submission, this method finds how many other ModelElements exist in the same cluster.
 * This number is represented with the `numberOfAffectedSubmissions` field which is set here for each
 * ModelElement of this submission
 *
 * @param submission Result for the Submission acting as a reference for the modeling submission to be searched.
 */
public void setNumberOfAffectedSubmissionsPerElement(@NotNull ModelingSubmission submission) {
    List<ModelElementRepository.ModelElementCount> elementCounts = modelElementRepository.countOtherElementsInSameClusterForSubmissionId(submission.getId());
    submission.setSimilarElements(elementCounts.stream().map(modelElementCount -> {
        SimilarElementCount similarElementCount = new SimilarElementCount();
        similarElementCount.setElementId(modelElementCount.getElementId());
        similarElementCount.setNumberOfOtherElements(modelElementCount.getNumberOfOtherElements());
        return similarElementCount;
    }).collect(Collectors.toSet()));
}
Also used : SimilarElementCount(de.tum.in.www1.artemis.domain.modeling.SimilarElementCount)

Example 2 with SimilarElementCount

use of de.tum.in.www1.artemis.domain.modeling.SimilarElementCount in project Artemis by ls1intum.

the class ModelingSubmissionService method setNumberOfAffectedSubmissionsPerElement.

/**
 * Sets number of potential automatic Feedback's for each model element belonging to the `Result`'s submission.
 * This number determines how many other submissions would be affected if the user were to submit a certain element feedback.
 * For each ModelElement of the submission, this method finds how many other ModelElements exist in the same cluster.
 * This number is represented with the `numberOfAffectedSubmissions` field which is set here for each
 * ModelElement of this submission
 *
 * @param submission Result for the Submission acting as a reference for the modeling submission to be searched.
 */
public void setNumberOfAffectedSubmissionsPerElement(@NotNull ModelingSubmission submission) {
    List<ModelElementRepository.ModelElementCount> elementCounts = modelElementRepository.countOtherElementsInSameClusterForSubmissionId(submission.getId());
    submission.setSimilarElements(elementCounts.stream().map(modelElementCount -> {
        SimilarElementCount similarElementCount = new SimilarElementCount();
        similarElementCount.setElementId(modelElementCount.getElementId());
        similarElementCount.setNumberOfOtherElements(modelElementCount.getNumberOfOtherElements());
        return similarElementCount;
    }).collect(Collectors.toSet()));
}
Also used : SimilarElementCount(de.tum.in.www1.artemis.domain.modeling.SimilarElementCount)

Aggregations

SimilarElementCount (de.tum.in.www1.artemis.domain.modeling.SimilarElementCount)2