Skip to content

Commit

Permalink
refactor(crowdsource): remove platform from contribution events (#1708)
Browse files Browse the repository at this point in the history
  • Loading branch information
nya-elimu authored Jul 11, 2024
2 parents b865b3a + ba7f64d commit 0b66ac2
Show file tree
Hide file tree
Showing 26 changed files with 10 additions and 95 deletions.
16 changes: 0 additions & 16 deletions src/main/java/ai/elimu/model/contributor/ContributionEvent.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package ai.elimu.model.contributor;

import ai.elimu.model.BaseEntity;
import ai.elimu.model.enums.Platform;
import java.util.Calendar;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
Expand Down Expand Up @@ -37,13 +36,6 @@ public class ContributionEvent extends BaseEntity {
*/
@NotNull
private Long timeSpentMs;

/**
* The platform that the {@link Contributor} used when making the contribution.
*/
@NotNull
@Enumerated(EnumType.STRING)
private Platform platform;

public String getComment() {
return comment;
Expand Down Expand Up @@ -84,12 +76,4 @@ public Long getTimeSpentMs() {
public void setTimeSpentMs(Long timeSpentMs) {
this.timeSpentMs = timeSpentMs;
}

public Platform getPlatform() {
return platform;
}

public void setPlatform(Platform platform) {
this.platform = platform;
}
}
6 changes: 0 additions & 6 deletions src/main/java/ai/elimu/util/db/DbContentImportHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import ai.elimu.model.contributor.NumberContributionEvent;
import ai.elimu.model.contributor.StoryBookContributionEvent;
import ai.elimu.model.contributor.WordContributionEvent;
import ai.elimu.model.enums.Platform;
import ai.elimu.model.enums.Role;
import ai.elimu.model.v2.enums.Environment;
import ai.elimu.model.v2.enums.Language;
Expand Down Expand Up @@ -151,7 +150,6 @@ public synchronized void performDatabaseContentImport(Environment environment, L
letterContributionEvent.setRevisionNumber(1);
letterContributionEvent.setTime(Calendar.getInstance());
letterContributionEvent.setTimeSpentMs((long)(Math.random() * 10) * 60000L);
letterContributionEvent.setPlatform(Platform.WEBAPP);
letterContributionEventDao.create(letterContributionEvent);
}

Expand Down Expand Up @@ -179,7 +177,6 @@ public synchronized void performDatabaseContentImport(Environment environment, L
letterSoundContributionEvent.setRevisionNumber(1);
letterSoundContributionEvent.setTime(Calendar.getInstance());
letterSoundContributionEvent.setTimeSpentMs((long)(Math.random() * 10) * 60000L);
letterSoundContributionEvent.setPlatform(Platform.WEBAPP);
letterSoundContributionEventDao.create(letterSoundContributionEvent);
}

Expand All @@ -198,7 +195,6 @@ public synchronized void performDatabaseContentImport(Environment environment, L
wordContributionEvent.setRevisionNumber(1);
wordContributionEvent.setTime(Calendar.getInstance());
wordContributionEvent.setTimeSpentMs((long)(Math.random() * 10) * 60000L);
wordContributionEvent.setPlatform(Platform.WEBAPP);
wordContributionEventDao.create(wordContributionEvent);
}

Expand All @@ -217,7 +213,6 @@ public synchronized void performDatabaseContentImport(Environment environment, L
numberContributionEvent.setRevisionNumber(1);
numberContributionEvent.setTime(Calendar.getInstance());
numberContributionEvent.setTimeSpentMs((long)(Math.random() * 10) * 60000L);
numberContributionEvent.setPlatform(Platform.WEBAPP);
numberContributionEventDao.create(numberContributionEvent);
}

Expand Down Expand Up @@ -308,7 +303,6 @@ public synchronized void performDatabaseContentImport(Environment environment, L
storyBookContributionEvent.setRevisionNumber(1);
storyBookContributionEvent.setTime(Calendar.getInstance());
storyBookContributionEvent.setTimeSpentMs((long)(Math.random() * 10) * 60000L);
storyBookContributionEvent.setPlatform(Platform.WEBAPP);
storyBookContributionEventDao.create(storyBookContributionEvent);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import ai.elimu.model.content.Letter;
import ai.elimu.model.contributor.Contributor;
import ai.elimu.model.contributor.LetterContributionEvent;
import ai.elimu.model.enums.Platform;
import ai.elimu.util.DiscordHelper;
import ai.elimu.web.context.EnvironmentContextLoaderListener;
import javax.servlet.http.HttpServletRequest;
Expand Down Expand Up @@ -77,7 +76,6 @@ public String handleSubmit(
letterContributionEvent.setRevisionNumber(letter.getRevisionNumber());
letterContributionEvent.setComment(StringUtils.abbreviate(request.getParameter("contributionComment"), 1000));
letterContributionEvent.setTimeSpentMs(System.currentTimeMillis() - Long.valueOf(request.getParameter("timeStart")));
letterContributionEvent.setPlatform(Platform.WEBAPP);
letterContributionEventDao.create(letterContributionEvent);

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.content.Letter;
import ai.elimu.model.contributor.Contributor;
import ai.elimu.model.contributor.LetterContributionEvent;
import ai.elimu.model.enums.Platform;
import ai.elimu.util.DiscordHelper;
import ai.elimu.web.context.EnvironmentContextLoaderListener;
import javax.servlet.http.HttpServletRequest;
Expand Down Expand Up @@ -84,7 +83,6 @@ public String handleSubmit(
letterContributionEvent.setRevisionNumber(letter.getRevisionNumber());
letterContributionEvent.setComment(StringUtils.abbreviate(request.getParameter("contributionComment"), 1000));
letterContributionEvent.setTimeSpentMs(System.currentTimeMillis() - Long.valueOf(request.getParameter("timeStart")));
letterContributionEvent.setPlatform(Platform.WEBAPP);
letterContributionEventDao.create(letterContributionEvent);

if (!EnvironmentContextLoaderListener.PROPERTIES.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import ai.elimu.dao.LetterSoundDao;
import ai.elimu.model.contributor.Contributor;
import ai.elimu.model.contributor.LetterSoundCorrespondenceContributionEvent;
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 @@ -104,7 +103,6 @@ public String handleSubmit(
letterSoundContributionEvent.setRevisionNumber(letterSound.getRevisionNumber());
letterSoundContributionEvent.setComment(StringUtils.abbreviate(request.getParameter("contributionComment"), 1000));
letterSoundContributionEvent.setTimeSpentMs(System.currentTimeMillis() - Long.valueOf(request.getParameter("timeStart")));
letterSoundContributionEvent.setPlatform(Platform.WEBAPP);
letterSoundContributionEventDao.create(letterSoundContributionEvent);

if (!EnvironmentContextLoaderListener.PROPERTIES.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import ai.elimu.model.content.Word;
import ai.elimu.model.contributor.Contributor;
import ai.elimu.model.contributor.LetterSoundCorrespondenceContributionEvent;
import ai.elimu.model.enums.Platform;
import ai.elimu.util.DiscordHelper;
import java.util.Calendar;
import javax.servlet.http.HttpServletRequest;
Expand Down Expand Up @@ -124,7 +123,6 @@ public String handleSubmit(
letterSoundContributionEvent.setRevisionNumber(letterSound.getRevisionNumber());
letterSoundContributionEvent.setComment(StringUtils.abbreviate(request.getParameter("contributionComment"), 1000));
letterSoundContributionEvent.setTimeSpentMs(System.currentTimeMillis() - Long.valueOf(request.getParameter("timeStart")));
letterSoundContributionEvent.setPlatform(Platform.WEBAPP);
letterSoundContributionEventDao.create(letterSoundContributionEvent);

if (!EnvironmentContextLoaderListener.PROPERTIES.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import ai.elimu.model.contributor.AudioContributionEvent;
import ai.elimu.model.contributor.Contributor;
import ai.elimu.model.enums.ContentLicense;
import ai.elimu.model.enums.Platform;
import ai.elimu.model.v2.enums.content.AudioFormat;
import ai.elimu.model.v2.enums.content.LiteracySkill;
import ai.elimu.model.v2.enums.content.NumeracySkill;
Expand Down Expand Up @@ -194,7 +193,6 @@ public String handleSubmit(
audioContributionEvent.setRevisionNumber(audio.getRevisionNumber());
audioContributionEvent.setComment(StringUtils.abbreviate(request.getParameter("contributionComment"), 1000));
audioContributionEvent.setTimeSpentMs(System.currentTimeMillis() - Long.valueOf(request.getParameter("timeStart")));
audioContributionEvent.setPlatform(Platform.WEBAPP);
audioContributionEventDao.create(audioContributionEvent);

if (!EnvironmentContextLoaderListener.PROPERTIES.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import ai.elimu.model.contributor.AudioContributionEvent;
import ai.elimu.model.contributor.Contributor;
import ai.elimu.model.enums.ContentLicense;
import ai.elimu.model.enums.Platform;
import ai.elimu.model.v2.enums.content.AudioFormat;
import ai.elimu.model.v2.enums.content.LiteracySkill;
import ai.elimu.model.v2.enums.content.NumeracySkill;
Expand Down Expand Up @@ -191,7 +190,6 @@ public String handleSubmit(
audioContributionEvent.setRevisionNumber(audio.getRevisionNumber());
audioContributionEvent.setComment(StringUtils.abbreviate(request.getParameter("contributionComment"), 1000));
audioContributionEvent.setTimeSpentMs(System.currentTimeMillis() - Long.valueOf(request.getParameter("timeStart")));
audioContributionEvent.setPlatform(Platform.WEBAPP);
audioContributionEventDao.create(audioContributionEvent);

if (!EnvironmentContextLoaderListener.PROPERTIES.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import ai.elimu.model.contributor.Contributor;
import ai.elimu.model.contributor.ImageContributionEvent;
import ai.elimu.model.enums.ContentLicense;
import ai.elimu.model.enums.Platform;
import ai.elimu.model.v2.enums.content.ImageFormat;
import ai.elimu.model.v2.enums.content.LiteracySkill;
import ai.elimu.model.v2.enums.content.NumeracySkill;
Expand Down Expand Up @@ -173,7 +172,6 @@ public String handleSubmit(
imageContributionEvent.setRevisionNumber(image.getRevisionNumber());
imageContributionEvent.setComment(StringUtils.abbreviate(request.getParameter("contributionComment"), 1000));
imageContributionEvent.setTimeSpentMs(System.currentTimeMillis() - Long.valueOf(request.getParameter("timeStart")));
imageContributionEvent.setPlatform(Platform.WEBAPP);
imageContributionEventDao.create(imageContributionEvent);

if (!EnvironmentContextLoaderListener.PROPERTIES.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import ai.elimu.model.contributor.Contributor;
import ai.elimu.model.contributor.ImageContributionEvent;
import ai.elimu.model.enums.ContentLicense;
import ai.elimu.model.enums.Platform;
import ai.elimu.model.v2.enums.content.ImageFormat;
import ai.elimu.model.v2.enums.content.LiteracySkill;
import ai.elimu.model.v2.enums.content.NumeracySkill;
Expand Down Expand Up @@ -205,7 +204,6 @@ public String handleSubmit(
imageContributionEvent.setRevisionNumber(image.getRevisionNumber());
imageContributionEvent.setComment(StringUtils.abbreviate(request.getParameter("contributionComment"), 1000));
imageContributionEvent.setTimeSpentMs(System.currentTimeMillis() - Long.valueOf(request.getParameter("timeStart")));
imageContributionEvent.setPlatform(Platform.WEBAPP);
imageContributionEventDao.create(imageContributionEvent);

if (!EnvironmentContextLoaderListener.PROPERTIES.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import ai.elimu.model.content.Word;
import ai.elimu.model.contributor.Contributor;
import ai.elimu.model.contributor.NumberContributionEvent;
import ai.elimu.model.enums.Platform;
import ai.elimu.util.DiscordHelper;
import ai.elimu.web.context.EnvironmentContextLoaderListener;
import java.util.HashMap;
Expand Down Expand Up @@ -98,7 +97,6 @@ public String handleSubmit(
numberContributionEvent.setRevisionNumber(number.getRevisionNumber());
numberContributionEvent.setComment(StringUtils.abbreviate(request.getParameter("contributionComment"), 1000));
numberContributionEvent.setTimeSpentMs(System.currentTimeMillis() - Long.valueOf(request.getParameter("timeStart")));
numberContributionEvent.setPlatform(Platform.WEBAPP);
numberContributionEventDao.create(numberContributionEvent);

if (!EnvironmentContextLoaderListener.PROPERTIES.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import ai.elimu.model.content.Word;
import ai.elimu.model.contributor.Contributor;
import ai.elimu.model.contributor.NumberContributionEvent;
import ai.elimu.model.enums.Platform;
import ai.elimu.util.DiscordHelper;
import ai.elimu.web.context.EnvironmentContextLoaderListener;
import java.util.HashMap;
Expand Down Expand Up @@ -111,7 +110,6 @@ public String handleSubmit(
numberContributionEvent.setRevisionNumber(number.getRevisionNumber());
numberContributionEvent.setComment(request.getParameter("contributionComment"));
numberContributionEvent.setTimeSpentMs(System.currentTimeMillis() - Long.valueOf(request.getParameter("timeStart")));
numberContributionEvent.setPlatform(Platform.WEBAPP);
numberContributionEventDao.create(numberContributionEvent);

if (!EnvironmentContextLoaderListener.PROPERTIES.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import ai.elimu.dao.SoundDao;
import ai.elimu.model.contributor.Contributor;
import ai.elimu.model.contributor.SoundContributionEvent;
import ai.elimu.model.enums.Platform;
import ai.elimu.util.DiscordHelper;
import ai.elimu.web.context.EnvironmentContextLoaderListener;
import javax.servlet.http.HttpServletRequest;
Expand Down Expand Up @@ -89,7 +88,6 @@ public String handleSubmit(
soundContributionEvent.setRevisionNumber(sound.getRevisionNumber());
soundContributionEvent.setComment(StringUtils.abbreviate(request.getParameter("contributionComment"), 1000));
soundContributionEvent.setTimeSpentMs(System.currentTimeMillis() - Long.valueOf(request.getParameter("timeStart")));
soundContributionEvent.setPlatform(Platform.WEBAPP);
soundContributionEventDao.create(soundContributionEvent);

if (!EnvironmentContextLoaderListener.PROPERTIES.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import ai.elimu.dao.SoundDao;
import ai.elimu.model.contributor.Contributor;
import ai.elimu.model.contributor.SoundContributionEvent;
import ai.elimu.model.enums.Platform;
import ai.elimu.util.DiscordHelper;
import ai.elimu.web.context.EnvironmentContextLoaderListener;
import javax.servlet.http.HttpServletRequest;
Expand Down Expand Up @@ -102,7 +101,6 @@ public String handleSubmit(
soundContributionEvent.setRevisionNumber(sound.getRevisionNumber());
soundContributionEvent.setComment(StringUtils.abbreviate(request.getParameter("contributionComment"), 1000));
soundContributionEvent.setTimeSpentMs(System.currentTimeMillis() - Long.valueOf(request.getParameter("timeStart")));
soundContributionEvent.setPlatform(Platform.WEBAPP);
soundContributionEventDao.create(soundContributionEvent);

if (!EnvironmentContextLoaderListener.PROPERTIES.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import ai.elimu.model.contributor.Contributor;
import ai.elimu.model.contributor.StoryBookContributionEvent;
import ai.elimu.model.enums.ContentLicense;
import ai.elimu.model.enums.Platform;
import ai.elimu.model.v2.enums.ReadingLevel;
import ai.elimu.util.DiscordHelper;
import ai.elimu.web.context.EnvironmentContextLoaderListener;
Expand Down Expand Up @@ -100,7 +99,6 @@ public String handleSubmit(
storyBookContributionEvent.setRevisionNumber(storyBook.getRevisionNumber());
storyBookContributionEvent.setComment(StringUtils.abbreviate(request.getParameter("contributionComment"), 1000));
storyBookContributionEvent.setTimeSpentMs(System.currentTimeMillis() - Long.valueOf(request.getParameter("timeStart")));
storyBookContributionEvent.setPlatform(Platform.WEBAPP);
storyBookContributionEventDao.create(storyBookContributionEvent);

if (!EnvironmentContextLoaderListener.PROPERTIES.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import ai.elimu.model.contributor.Contributor;
import ai.elimu.model.contributor.ImageContributionEvent;
import ai.elimu.model.contributor.StoryBookContributionEvent;
import ai.elimu.model.enums.Platform;
import ai.elimu.model.v2.enums.content.ImageFormat;
import ai.elimu.util.DiscordHelper;
import ai.elimu.util.ImageColorHelper;
Expand Down Expand Up @@ -335,7 +334,6 @@ public String handleSubmit(
storyBookContributionEvent.setRevisionNumber(storyBook.getRevisionNumber());
storyBookContributionEvent.setComment("Uploaded ePUB file (🤖 auto-generated comment)");
storyBookContributionEvent.setTimeSpentMs(System.currentTimeMillis() - Long.valueOf(request.getParameter("timeStart")));
storyBookContributionEvent.setPlatform(Platform.WEBAPP);
storyBookContributionEventDao.create(storyBookContributionEvent);

// Store the StoryBook's cover image in the database, and assign it to the StoryBook
Expand Down Expand Up @@ -506,7 +504,6 @@ private void storeImageContributionEvent(Image image, HttpSession session, HttpS
imageContributionEvent.setRevisionNumber(image.getRevisionNumber());
imageContributionEvent.setComment("Extracted from ePUB file (🤖 auto-generated comment)");
imageContributionEvent.setTimeSpentMs(System.currentTimeMillis() - Long.valueOf(request.getParameter("timeStart")));
imageContributionEvent.setPlatform(Platform.WEBAPP);
imageContributionEventDao.create(imageContributionEvent);

if (!EnvironmentContextLoaderListener.PROPERTIES.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import ai.elimu.model.enums.ContentLicense;
import ai.elimu.model.v2.enums.ReadingLevel;
import ai.elimu.model.v2.enums.Language;
import ai.elimu.model.enums.Platform;
import ai.elimu.rest.v2.service.StoryBooksJsonService;
import ai.elimu.util.ConfigHelper;
import ai.elimu.util.DiscordHelper;
Expand Down Expand Up @@ -220,7 +219,6 @@ public String handleSubmit(
storyBookContributionEvent.setRevisionNumber(storyBook.getRevisionNumber());
storyBookContributionEvent.setComment(StringUtils.abbreviate(request.getParameter("contributionComment"), 1000));
storyBookContributionEvent.setTimeSpentMs(System.currentTimeMillis() - Long.valueOf(request.getParameter("timeStart")));
storyBookContributionEvent.setPlatform(Platform.WEBAPP);
storyBookContributionEventDao.create(storyBookContributionEvent);

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.Contributor;
import ai.elimu.model.contributor.StoryBookContributionEvent;
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 @@ -105,7 +104,6 @@ public String handleSubmit(
storyBookContributionEvent.setRevisionNumber(storyBook.getRevisionNumber());
storyBookContributionEvent.setComment("Created storybook chapter " + (storyBookChapter.getSortOrder() + 1) + " (🤖 auto-generated comment)");
storyBookContributionEvent.setTimeSpentMs(0L);
storyBookContributionEvent.setPlatform(Platform.WEBAPP);
storyBookContributionEventDao.create(storyBookContributionEvent);

if (!EnvironmentContextLoaderListener.PROPERTIES.isEmpty()) {
Expand Down
Loading

0 comments on commit 0b66ac2

Please sign in to comment.