Skip to content

Commit

Permalink
Development: Deprecate participation<—>results
Browse files Browse the repository at this point in the history
  • Loading branch information
krusche committed Nov 26, 2024
1 parent 1539df5 commit 83ac531
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 3 deletions.
20 changes: 20 additions & 0 deletions src/main/java/de/tum/cit/aet/artemis/assessment/domain/Result.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,12 @@ public class Result extends DomainObject implements Comparable<Result> {
@JsonView(QuizView.Before.class)
private List<Feedback> feedbacks = new ArrayList<>();

/**
* @deprecated: Will be removed for 8.0, please use submission.participation instead
*/
@ManyToOne
@JsonView(QuizView.Before.class)
@Deprecated(since = "7.7", forRemoval = true)
private Participation participation;

@ManyToOne(fetch = FetchType.LAZY)
Expand Down Expand Up @@ -385,15 +389,31 @@ private boolean feedbackTextHasChanged(String existingText, String newText) {
return !Objects.equals(existingText, newText);
}

/**
* @deprecated: Will be removed for 8.0, please use submission.participation instead
* @return the participation
*/
@Deprecated(since = "7.7", forRemoval = true)
public Participation getParticipation() {
return participation;
}

/**
* @deprecated: Will be removed for 8.0, please use submission.participation instead
* @param participation the participation to set
* @return the result
*/
@Deprecated(since = "7.7", forRemoval = true)
public Result participation(Participation participation) {
this.participation = participation;
return this;
}

/**
* @deprecated: Will be removed for 8.0, please use submission.participation instead
* @param participation the participation to set
*/
@Deprecated(since = "7.7", forRemoval = true)
public void setParticipation(Participation participation) {
this.participation = participation;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,19 @@ public abstract class Participation extends DomainObject implements Participatio
protected Exercise exercise;

/**
* Results are not cascaded through the participation because ideally we want the relationship between participations, submissions and results as follows: each participation
* has multiple submissions. For each submission there can be a result. Therefore, the result is persisted with the submission. Refer to Submission.result for cascading
* settings.
* @deprecated: Will be removed for 8.0, please use submissions.results instead
*
* Results are not cascaded through the participation because ideally we want the relationship between participations, submissions and results as follows: each
* participation
* has multiple submissions. For each submission there can be a result. Therefore, the result is persisted with the submission. Refer to Submission.result for
* cascading
* settings.
*/
@OneToMany(mappedBy = "participation")
@JsonIgnoreProperties(value = "participation", allowSetters = true)
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@JsonView(QuizView.Before.class)
@Deprecated(since = "7.7", forRemoval = true)
private Set<Result> results = new HashSet<>();

/**
Expand Down Expand Up @@ -201,26 +206,52 @@ public void setPracticeMode(boolean practiceMode) {
this.testRun = practiceMode;
}

/**
* @deprecated: Will be removed for 8.0, please use submissions.results instead
* @return the results
*/
@Deprecated(since = "7.7", forRemoval = true)
public Set<Result> getResults() {
return results;
}

/**
* @deprecated: Will be removed for 8.0, please use submissions.results instead
* @param results the results
* @return the results
*/
@Deprecated(since = "7.7", forRemoval = true)
public Participation results(Set<Result> results) {
this.results = results;
return this;
}

/**
* @deprecated: Will be removed for 8.0, please use submissions.results instead
* @param result the result
*/
@Deprecated(since = "7.7", forRemoval = true)
@Override
public void addResult(Result result) {
this.results.add(result);
result.setParticipation(this);
}

/**
* @deprecated: Will be removed for 8.0, please use submissions.results instead
* @param result the result
*/
@Deprecated(since = "7.7", forRemoval = true)
public void removeResult(Result result) {
this.results.remove(result);
result.setParticipation(null);
}

/**
* @deprecated: Will be removed for 8.0, please use submissions.results instead
* @param results the results
*/
@Deprecated(since = "7.7", forRemoval = true)
public void setResults(Set<Result> results) {
this.results = results;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ export abstract class Participation implements BaseEntity {
public initializationDate?: dayjs.Dayjs;
public individualDueDate?: dayjs.Dayjs;
public presentationScore?: number;
/**
* @deprecated This property will be removed in Artemis 8.0. Use `submissions.results` instead.
*/
public results?: Result[];
public submissions?: Submission[];
public exercise?: Exercise;
Expand Down
3 changes: 3 additions & 0 deletions src/main/webapp/app/entities/result.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ export class Result implements BaseEntity {
public submission?: Submission;
public assessor?: User;
public feedbacks?: Feedback[];
/**
* @deprecated This property will be removed in Artemis 8.0. Use `submission.participation` instead.
*/
public participation?: Participation;

// helper attributes
Expand Down

0 comments on commit 83ac531

Please sign in to comment.