Skip to content

Commit

Permalink
refactor(crowdsource): delete platform from peer review events (#1710)
Browse files Browse the repository at this point in the history
  • Loading branch information
jo-elimu authored Jul 11, 2024
2 parents 6a2611f + e6b6c1b commit eda9285
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 34 deletions.
19 changes: 0 additions & 19 deletions src/main/java/ai/elimu/model/contributor/PeerReviewEvent.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
package ai.elimu.model.contributor;

import ai.elimu.model.BaseEntity;
import ai.elimu.model.enums.Platform;
import java.util.Calendar;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;
import javax.persistence.Temporal;
Expand Down Expand Up @@ -39,13 +35,6 @@ public class PeerReviewEvent extends BaseEntity {
@NotNull
@Temporal(TemporalType.TIMESTAMP)
private Calendar time;

/**
* The platform that the {@link Contributor} used when performing the peer-review.
*/
@NotNull
@Enumerated(EnumType.STRING)
private Platform platform;

public Contributor getContributor() {
return contributor;
Expand Down Expand Up @@ -78,12 +67,4 @@ public Calendar getTime() {
public void setTime(Calendar time) {
this.time = time;
}

public Platform getPlatform() {
return platform;
}

public void setPlatform(Platform platform) {
this.platform = platform;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import ai.elimu.model.contributor.AudioContributionEvent;
import ai.elimu.model.contributor.AudioPeerReviewEvent;
import ai.elimu.model.enums.PeerReviewStatus;
import ai.elimu.model.enums.Platform;
import ai.elimu.util.DiscordHelper;
import ai.elimu.web.context.EnvironmentContextLoaderListener;
import java.util.Calendar;
Expand Down Expand Up @@ -62,7 +61,6 @@ public String handleSubmit(
audioPeerReviewEvent.setApproved(approved);
audioPeerReviewEvent.setComment(StringUtils.abbreviate(comment, 1000));
audioPeerReviewEvent.setTime(Calendar.getInstance());
audioPeerReviewEvent.setPlatform(Platform.WEBAPP);
audioPeerReviewEventDao.create(audioPeerReviewEvent);

if (!EnvironmentContextLoaderListener.PROPERTIES.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import ai.elimu.model.contributor.LetterSoundCorrespondenceContributionEvent;
import ai.elimu.model.contributor.LetterSoundCorrespondencePeerReviewEvent;
import ai.elimu.model.enums.PeerReviewStatus;
import ai.elimu.model.enums.Platform;
import ai.elimu.util.DiscordHelper;
import ai.elimu.web.context.EnvironmentContextLoaderListener;
import java.util.Calendar;
Expand Down Expand Up @@ -61,7 +60,6 @@ public String handleSubmit(
letterSoundPeerReviewEvent.setApproved(approved);
letterSoundPeerReviewEvent.setComment(StringUtils.abbreviate(comment, 1000));
letterSoundPeerReviewEvent.setTime(Calendar.getInstance());
letterSoundPeerReviewEvent.setPlatform(Platform.WEBAPP);
letterSoundPeerReviewEventDao.create(letterSoundPeerReviewEvent);

if (!EnvironmentContextLoaderListener.PROPERTIES.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import ai.elimu.model.contributor.NumberContributionEvent;
import ai.elimu.model.contributor.NumberPeerReviewEvent;
import ai.elimu.model.enums.PeerReviewStatus;
import ai.elimu.model.enums.Platform;
import ai.elimu.util.DiscordHelper;
import ai.elimu.web.context.EnvironmentContextLoaderListener;
import java.util.Calendar;
Expand Down Expand Up @@ -59,7 +58,6 @@ public String handleSubmit(
numberPeerReviewEvent.setApproved(approved);
numberPeerReviewEvent.setComment(StringUtils.abbreviate(comment, 1000));
numberPeerReviewEvent.setTime(Calendar.getInstance());
numberPeerReviewEvent.setPlatform(Platform.WEBAPP);
numberPeerReviewEventDao.create(numberPeerReviewEvent);

if (!EnvironmentContextLoaderListener.PROPERTIES.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import ai.elimu.model.contributor.StoryBookContributionEvent;
import ai.elimu.model.contributor.StoryBookPeerReviewEvent;
import ai.elimu.model.enums.PeerReviewStatus;
import ai.elimu.model.enums.Platform;
import ai.elimu.util.DiscordHelper;
import ai.elimu.web.context.EnvironmentContextLoaderListener;
import java.util.Calendar;
Expand Down Expand Up @@ -59,7 +58,6 @@ public String handleSubmit(
storyBookPeerReviewEvent.setApproved(approved);
storyBookPeerReviewEvent.setComment(StringUtils.abbreviate(comment, 1000));
storyBookPeerReviewEvent.setTime(Calendar.getInstance());
storyBookPeerReviewEvent.setPlatform(Platform.WEBAPP);
storyBookPeerReviewEventDao.create(storyBookPeerReviewEvent);

if (!EnvironmentContextLoaderListener.PROPERTIES.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import ai.elimu.model.contributor.WordContributionEvent;
import ai.elimu.model.contributor.WordPeerReviewEvent;
import ai.elimu.model.enums.PeerReviewStatus;
import ai.elimu.model.enums.Platform;
import ai.elimu.util.DiscordHelper;
import ai.elimu.web.context.EnvironmentContextLoaderListener;
import java.util.Calendar;
Expand Down Expand Up @@ -59,7 +58,6 @@ public String handleSubmit(
wordPeerReviewEvent.setApproved(approved);
wordPeerReviewEvent.setComment(StringUtils.abbreviate(comment, 1000));
wordPeerReviewEvent.setTime(Calendar.getInstance());
wordPeerReviewEvent.setPlatform(Platform.WEBAPP);
wordPeerReviewEventDao.create(wordPeerReviewEvent);

if (!EnvironmentContextLoaderListener.PROPERTIES.isEmpty()) {
Expand Down
5 changes: 0 additions & 5 deletions src/main/resources/META-INF/jpa-schema-export.sql
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@
id bigint not null auto_increment,
approved bit,
comment varchar(1000),
platform varchar(255),
time datetime,
contributor_id bigint,
audioContributionEvent_id bigint,
Expand Down Expand Up @@ -415,7 +414,6 @@
id bigint not null auto_increment,
approved bit,
comment varchar(1000),
platform varchar(255),
time datetime,
contributor_id bigint,
letterSoundCorrespondenceContributionEvent_id bigint,
Expand Down Expand Up @@ -456,7 +454,6 @@
id bigint not null auto_increment,
approved bit,
comment varchar(1000),
platform varchar(255),
time datetime,
contributor_id bigint,
numberContributionEvent_id bigint,
Expand Down Expand Up @@ -565,7 +562,6 @@
id bigint not null auto_increment,
approved bit,
comment varchar(1000),
platform varchar(255),
time datetime,
contributor_id bigint,
storyBookContributionEvent_id bigint,
Expand Down Expand Up @@ -683,7 +679,6 @@
id bigint not null auto_increment,
approved bit,
comment varchar(1000),
platform varchar(255),
time datetime,
contributor_id bigint,
wordContributionEvent_id bigint,
Expand Down
7 changes: 7 additions & 0 deletions src/main/resources/db/migration/2004005.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# 2.4.5

ALTER TABLE `AudioPeerReviewEvent` DROP COLUMN `platform`;
ALTER TABLE `LetterSoundCorrespondencePeerReviewEvent` DROP COLUMN `platform`;
ALTER TABLE `NumberPeerReviewEvent` DROP COLUMN `platform`;
ALTER TABLE `StoryBookPeerReviewEvent` DROP COLUMN `platform`;
ALTER TABLE `WordPeerReviewEvent` DROP COLUMN `platform`;

0 comments on commit eda9285

Please sign in to comment.