From 8994d3b2ba5e74ca2e77a9bea00ad1b4d2787238 Mon Sep 17 00:00:00 2001 From: jo-elimu <1451036+jo-elimu@users.noreply.github.com> Date: Thu, 11 Jul 2024 18:22:27 +0700 Subject: [PATCH 1/3] refactor(crowdsource): remove platform closes #1674 --- .../model/contributor/ContributionEvent.java | 15 --------------- .../ai/elimu/util/db/DbContentImportHelper.java | 6 ------ .../content/letter/LetterCreateController.java | 2 -- .../web/content/letter/LetterEditController.java | 2 -- .../letter_sound/LetterSoundCreateController.java | 2 -- .../letter_sound/LetterSoundEditController.java | 2 -- .../multimedia/audio/AudioCreateController.java | 2 -- .../multimedia/audio/AudioEditController.java | 2 -- .../multimedia/image/ImageCreateController.java | 2 -- .../multimedia/image/ImageEditController.java | 2 -- .../content/number/NumberCreateController.java | 2 -- .../web/content/number/NumberEditController.java | 2 -- .../web/content/sound/SoundCreateController.java | 2 -- .../web/content/sound/SoundEditController.java | 2 -- .../storybook/StoryBookCreateController.java | 2 -- .../StoryBookCreateFromEPubController.java | 3 --- .../storybook/StoryBookEditController.java | 2 -- .../chapter/StoryBookChapterCreateController.java | 2 -- .../chapter/StoryBookChapterDeleteController.java | 2 -- .../StoryBookParagraphCreateController.java | 2 -- .../StoryBookParagraphDeleteController.java | 2 -- .../StoryBookParagraphEditController.java | 10 ---------- .../web/content/word/WordCreateController.java | 10 ---------- .../web/content/word/WordEditController.java | 6 ------ 24 files changed, 86 deletions(-) diff --git a/src/main/java/ai/elimu/model/contributor/ContributionEvent.java b/src/main/java/ai/elimu/model/contributor/ContributionEvent.java index 2b1a2dade..120fdf1e3 100644 --- a/src/main/java/ai/elimu/model/contributor/ContributionEvent.java +++ b/src/main/java/ai/elimu/model/contributor/ContributionEvent.java @@ -37,13 +37,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; @@ -84,12 +77,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; - } } diff --git a/src/main/java/ai/elimu/util/db/DbContentImportHelper.java b/src/main/java/ai/elimu/util/db/DbContentImportHelper.java index a592060b2..e49e8e639 100644 --- a/src/main/java/ai/elimu/util/db/DbContentImportHelper.java +++ b/src/main/java/ai/elimu/util/db/DbContentImportHelper.java @@ -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; @@ -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); } @@ -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); } @@ -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); } @@ -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); } @@ -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); } diff --git a/src/main/java/ai/elimu/web/content/letter/LetterCreateController.java b/src/main/java/ai/elimu/web/content/letter/LetterCreateController.java index 21190e766..073846e07 100644 --- a/src/main/java/ai/elimu/web/content/letter/LetterCreateController.java +++ b/src/main/java/ai/elimu/web/content/letter/LetterCreateController.java @@ -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; @@ -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()) { diff --git a/src/main/java/ai/elimu/web/content/letter/LetterEditController.java b/src/main/java/ai/elimu/web/content/letter/LetterEditController.java index 21caf005e..fbd130c6d 100644 --- a/src/main/java/ai/elimu/web/content/letter/LetterEditController.java +++ b/src/main/java/ai/elimu/web/content/letter/LetterEditController.java @@ -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; @@ -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()) { diff --git a/src/main/java/ai/elimu/web/content/letter_sound/LetterSoundCreateController.java b/src/main/java/ai/elimu/web/content/letter_sound/LetterSoundCreateController.java index 5f0b4c704..4dd38cf21 100644 --- a/src/main/java/ai/elimu/web/content/letter_sound/LetterSoundCreateController.java +++ b/src/main/java/ai/elimu/web/content/letter_sound/LetterSoundCreateController.java @@ -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; @@ -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()) { diff --git a/src/main/java/ai/elimu/web/content/letter_sound/LetterSoundEditController.java b/src/main/java/ai/elimu/web/content/letter_sound/LetterSoundEditController.java index 5e656d60b..705f5d738 100644 --- a/src/main/java/ai/elimu/web/content/letter_sound/LetterSoundEditController.java +++ b/src/main/java/ai/elimu/web/content/letter_sound/LetterSoundEditController.java @@ -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; @@ -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()) { diff --git a/src/main/java/ai/elimu/web/content/multimedia/audio/AudioCreateController.java b/src/main/java/ai/elimu/web/content/multimedia/audio/AudioCreateController.java index 69991a7ac..1feb9d067 100644 --- a/src/main/java/ai/elimu/web/content/multimedia/audio/AudioCreateController.java +++ b/src/main/java/ai/elimu/web/content/multimedia/audio/AudioCreateController.java @@ -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; @@ -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()) { diff --git a/src/main/java/ai/elimu/web/content/multimedia/audio/AudioEditController.java b/src/main/java/ai/elimu/web/content/multimedia/audio/AudioEditController.java index 3987ec6d1..deb811809 100644 --- a/src/main/java/ai/elimu/web/content/multimedia/audio/AudioEditController.java +++ b/src/main/java/ai/elimu/web/content/multimedia/audio/AudioEditController.java @@ -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; @@ -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()) { diff --git a/src/main/java/ai/elimu/web/content/multimedia/image/ImageCreateController.java b/src/main/java/ai/elimu/web/content/multimedia/image/ImageCreateController.java index 61b26d774..ca2be579e 100644 --- a/src/main/java/ai/elimu/web/content/multimedia/image/ImageCreateController.java +++ b/src/main/java/ai/elimu/web/content/multimedia/image/ImageCreateController.java @@ -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; @@ -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()) { diff --git a/src/main/java/ai/elimu/web/content/multimedia/image/ImageEditController.java b/src/main/java/ai/elimu/web/content/multimedia/image/ImageEditController.java index c571b0c3a..d15743472 100644 --- a/src/main/java/ai/elimu/web/content/multimedia/image/ImageEditController.java +++ b/src/main/java/ai/elimu/web/content/multimedia/image/ImageEditController.java @@ -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; @@ -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()) { diff --git a/src/main/java/ai/elimu/web/content/number/NumberCreateController.java b/src/main/java/ai/elimu/web/content/number/NumberCreateController.java index c87792a96..79d59f827 100644 --- a/src/main/java/ai/elimu/web/content/number/NumberCreateController.java +++ b/src/main/java/ai/elimu/web/content/number/NumberCreateController.java @@ -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; @@ -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()) { diff --git a/src/main/java/ai/elimu/web/content/number/NumberEditController.java b/src/main/java/ai/elimu/web/content/number/NumberEditController.java index bdcb22498..252074a7a 100644 --- a/src/main/java/ai/elimu/web/content/number/NumberEditController.java +++ b/src/main/java/ai/elimu/web/content/number/NumberEditController.java @@ -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; @@ -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()) { diff --git a/src/main/java/ai/elimu/web/content/sound/SoundCreateController.java b/src/main/java/ai/elimu/web/content/sound/SoundCreateController.java index 4d6f31888..89cc43e23 100644 --- a/src/main/java/ai/elimu/web/content/sound/SoundCreateController.java +++ b/src/main/java/ai/elimu/web/content/sound/SoundCreateController.java @@ -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; @@ -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()) { diff --git a/src/main/java/ai/elimu/web/content/sound/SoundEditController.java b/src/main/java/ai/elimu/web/content/sound/SoundEditController.java index 9a282a478..4209ce882 100644 --- a/src/main/java/ai/elimu/web/content/sound/SoundEditController.java +++ b/src/main/java/ai/elimu/web/content/sound/SoundEditController.java @@ -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; @@ -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()) { diff --git a/src/main/java/ai/elimu/web/content/storybook/StoryBookCreateController.java b/src/main/java/ai/elimu/web/content/storybook/StoryBookCreateController.java index 2baa948b6..7ed609433 100644 --- a/src/main/java/ai/elimu/web/content/storybook/StoryBookCreateController.java +++ b/src/main/java/ai/elimu/web/content/storybook/StoryBookCreateController.java @@ -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; @@ -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()) { diff --git a/src/main/java/ai/elimu/web/content/storybook/StoryBookCreateFromEPubController.java b/src/main/java/ai/elimu/web/content/storybook/StoryBookCreateFromEPubController.java index 4a3c7fc1f..b3cea7b2f 100644 --- a/src/main/java/ai/elimu/web/content/storybook/StoryBookCreateFromEPubController.java +++ b/src/main/java/ai/elimu/web/content/storybook/StoryBookCreateFromEPubController.java @@ -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; @@ -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 @@ -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()) { diff --git a/src/main/java/ai/elimu/web/content/storybook/StoryBookEditController.java b/src/main/java/ai/elimu/web/content/storybook/StoryBookEditController.java index 6d4b8ab03..10faba493 100644 --- a/src/main/java/ai/elimu/web/content/storybook/StoryBookEditController.java +++ b/src/main/java/ai/elimu/web/content/storybook/StoryBookEditController.java @@ -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; @@ -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()) { diff --git a/src/main/java/ai/elimu/web/content/storybook/chapter/StoryBookChapterCreateController.java b/src/main/java/ai/elimu/web/content/storybook/chapter/StoryBookChapterCreateController.java index 01326606e..c9212669c 100644 --- a/src/main/java/ai/elimu/web/content/storybook/chapter/StoryBookChapterCreateController.java +++ b/src/main/java/ai/elimu/web/content/storybook/chapter/StoryBookChapterCreateController.java @@ -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; @@ -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()) { diff --git a/src/main/java/ai/elimu/web/content/storybook/chapter/StoryBookChapterDeleteController.java b/src/main/java/ai/elimu/web/content/storybook/chapter/StoryBookChapterDeleteController.java index 4921913f6..98551d216 100644 --- a/src/main/java/ai/elimu/web/content/storybook/chapter/StoryBookChapterDeleteController.java +++ b/src/main/java/ai/elimu/web/content/storybook/chapter/StoryBookChapterDeleteController.java @@ -16,7 +16,6 @@ import ai.elimu.model.contributor.ImageContributionEvent; import ai.elimu.model.contributor.StoryBookContributionEvent; import ai.elimu.model.enums.PeerReviewStatus; -import ai.elimu.model.enums.Platform; import ai.elimu.model.enums.Role; import ai.elimu.rest.v2.service.StoryBooksJsonService; import ai.elimu.util.DiscordHelper; @@ -133,7 +132,6 @@ public String handleRequest(HttpSession session, @PathVariable Long storyBookId, storyBookContributionEvent.setRevisionNumber(storyBook.getRevisionNumber()); storyBookContributionEvent.setComment("Deleted storybook chapter " + (storyBookChapterToBeDeleted.getSortOrder() + 1) + " (🤖 auto-generated comment)"); storyBookContributionEvent.setTimeSpentMs(0L); - storyBookContributionEvent.setPlatform(Platform.WEBAPP); storyBookContributionEventDao.create(storyBookContributionEvent); if (!EnvironmentContextLoaderListener.PROPERTIES.isEmpty()) { diff --git a/src/main/java/ai/elimu/web/content/storybook/paragraph/StoryBookParagraphCreateController.java b/src/main/java/ai/elimu/web/content/storybook/paragraph/StoryBookParagraphCreateController.java index 50b8fa2f8..2db1b534b 100644 --- a/src/main/java/ai/elimu/web/content/storybook/paragraph/StoryBookParagraphCreateController.java +++ b/src/main/java/ai/elimu/web/content/storybook/paragraph/StoryBookParagraphCreateController.java @@ -12,7 +12,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.rest.v2.service.StoryBooksJsonService; import ai.elimu.util.DiscordHelper; import ai.elimu.web.context.EnvironmentContextLoaderListener; @@ -110,7 +109,6 @@ public String handleSubmit( storyBookContributionEvent.setRevisionNumber(storyBook.getRevisionNumber()); storyBookContributionEvent.setComment("Created storybook paragraph in chapter " + (storyBookParagraph.getStoryBookChapter().getSortOrder() + 1) + " (🤖 auto-generated comment)"); storyBookContributionEvent.setTimeSpentMs(System.currentTimeMillis() - Long.valueOf(request.getParameter("timeStart"))); - storyBookContributionEvent.setPlatform(Platform.WEBAPP); storyBookContributionEventDao.create(storyBookContributionEvent); if (!EnvironmentContextLoaderListener.PROPERTIES.isEmpty()) { diff --git a/src/main/java/ai/elimu/web/content/storybook/paragraph/StoryBookParagraphDeleteController.java b/src/main/java/ai/elimu/web/content/storybook/paragraph/StoryBookParagraphDeleteController.java index f11d09137..69e0eec33 100644 --- a/src/main/java/ai/elimu/web/content/storybook/paragraph/StoryBookParagraphDeleteController.java +++ b/src/main/java/ai/elimu/web/content/storybook/paragraph/StoryBookParagraphDeleteController.java @@ -11,7 +11,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.model.enums.Role; import ai.elimu.rest.v2.service.StoryBooksJsonService; import ai.elimu.util.DiscordHelper; @@ -91,7 +90,6 @@ public String handleRequest(HttpSession session, @PathVariable Long id) { storyBookContributionEvent.setComment("Deleted storybook paragraph in chapter " + (storyBookParagraphToBeDeleted.getStoryBookChapter().getSortOrder() + 1) + " (🤖 auto-generated comment)"); storyBookContributionEvent.setParagraphTextBefore(paragraphTextBeforeDeletion); storyBookContributionEvent.setTimeSpentMs(0L); - storyBookContributionEvent.setPlatform(Platform.WEBAPP); storyBookContributionEventDao.create(storyBookContributionEvent); if (!EnvironmentContextLoaderListener.PROPERTIES.isEmpty()) { diff --git a/src/main/java/ai/elimu/web/content/storybook/paragraph/StoryBookParagraphEditController.java b/src/main/java/ai/elimu/web/content/storybook/paragraph/StoryBookParagraphEditController.java index 8e19adf42..386e1c3a0 100644 --- a/src/main/java/ai/elimu/web/content/storybook/paragraph/StoryBookParagraphEditController.java +++ b/src/main/java/ai/elimu/web/content/storybook/paragraph/StoryBookParagraphEditController.java @@ -1,7 +1,5 @@ package ai.elimu.web.content.storybook.paragraph; -import ai.elimu.dao.AudioContributionEventDao; -import ai.elimu.dao.AudioDao; import ai.elimu.dao.StoryBookContributionEventDao; import ai.elimu.dao.StoryBookDao; import org.apache.logging.log4j.Logger; @@ -11,7 +9,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.rest.v2.service.StoryBooksJsonService; import ai.elimu.util.DiscordHelper; import ai.elimu.web.context.EnvironmentContextLoaderListener; @@ -44,12 +41,6 @@ public class StoryBookParagraphEditController { @Autowired private StoryBookParagraphDao storyBookParagraphDao; - @Autowired - private AudioDao audioDao; - - @Autowired - private AudioContributionEventDao audioContributionEventDao; - @Autowired private StoryBooksJsonService storyBooksJsonService; @@ -108,7 +99,6 @@ public String handleSubmit( storyBookContributionEvent.setParagraphTextAfter(StringUtils.abbreviate(storyBookParagraph.getOriginalText(), 1000)); } storyBookContributionEvent.setTimeSpentMs(System.currentTimeMillis() - Long.valueOf(request.getParameter("timeStart"))); - storyBookContributionEvent.setPlatform(Platform.WEBAPP); storyBookContributionEventDao.create(storyBookContributionEvent); if (!EnvironmentContextLoaderListener.PROPERTIES.isEmpty()) { diff --git a/src/main/java/ai/elimu/web/content/word/WordCreateController.java b/src/main/java/ai/elimu/web/content/word/WordCreateController.java index 1673dd4d0..9ae8d8da4 100644 --- a/src/main/java/ai/elimu/web/content/word/WordCreateController.java +++ b/src/main/java/ai/elimu/web/content/word/WordCreateController.java @@ -6,8 +6,6 @@ import javax.validation.Valid; import org.apache.logging.log4j.Logger; -import ai.elimu.dao.AudioContributionEventDao; -import ai.elimu.dao.AudioDao; import ai.elimu.dao.EmojiDao; import ai.elimu.dao.ImageDao; import ai.elimu.dao.SyllableDao; @@ -21,7 +19,6 @@ import ai.elimu.model.content.multimedia.Image; import ai.elimu.model.contributor.Contributor; import ai.elimu.model.contributor.WordContributionEvent; -import ai.elimu.model.enums.Platform; import ai.elimu.model.v2.enums.content.SpellingConsistency; import ai.elimu.model.v2.enums.content.WordType; import java.util.ArrayList; @@ -66,12 +63,6 @@ public class WordCreateController { @Autowired private WordContributionEventDao wordContributionEventDao; - - @Autowired - private AudioDao audioDao; - - @Autowired - private AudioContributionEventDao audioContributionEventDao; @RequestMapping(method = RequestMethod.GET) public String handleRequest(Model model, @RequestParam(required = false) String autoFillText) { @@ -137,7 +128,6 @@ public String handleSubmit( wordContributionEvent.setRevisionNumber(word.getRevisionNumber()); wordContributionEvent.setComment(StringUtils.abbreviate(request.getParameter("contributionComment"), 1000)); wordContributionEvent.setTimeSpentMs(System.currentTimeMillis() - Long.valueOf(request.getParameter("timeStart"))); - wordContributionEvent.setPlatform(Platform.WEBAPP); wordContributionEventDao.create(wordContributionEvent); if (!EnvironmentContextLoaderListener.PROPERTIES.isEmpty()) { diff --git a/src/main/java/ai/elimu/web/content/word/WordEditController.java b/src/main/java/ai/elimu/web/content/word/WordEditController.java index 87adadf37..de523ef71 100644 --- a/src/main/java/ai/elimu/web/content/word/WordEditController.java +++ b/src/main/java/ai/elimu/web/content/word/WordEditController.java @@ -5,7 +5,6 @@ import javax.validation.Valid; import org.apache.logging.log4j.Logger; -import ai.elimu.dao.AudioContributionEventDao; import ai.elimu.dao.AudioDao; import ai.elimu.dao.EmojiDao; import ai.elimu.dao.ImageDao; @@ -24,7 +23,6 @@ import ai.elimu.model.content.multimedia.Image; import ai.elimu.model.contributor.Contributor; import ai.elimu.model.contributor.WordContributionEvent; -import ai.elimu.model.enums.Platform; import ai.elimu.model.v2.enums.content.SpellingConsistency; import ai.elimu.model.v2.enums.content.WordType; import java.util.ArrayList; @@ -76,9 +74,6 @@ public class WordEditController { @Autowired private WordPeerReviewEventDao wordPeerReviewEventDao; - @Autowired - private AudioContributionEventDao audioContributionEventDao; - @Autowired private StoryBookParagraphDao storyBookParagraphDao; @@ -186,7 +181,6 @@ public String handleSubmit( wordContributionEvent.setRevisionNumber(word.getRevisionNumber()); wordContributionEvent.setComment(StringUtils.abbreviate(request.getParameter("contributionComment"), 1000)); wordContributionEvent.setTimeSpentMs(System.currentTimeMillis() - Long.valueOf(request.getParameter("timeStart"))); - wordContributionEvent.setPlatform(Platform.WEBAPP); wordContributionEventDao.create(wordContributionEvent); if (!EnvironmentContextLoaderListener.PROPERTIES.isEmpty()) { From 6cd2dfec3c539a3c53d20af995fa37959aee5753 Mon Sep 17 00:00:00 2001 From: jo-elimu <1451036+jo-elimu@users.noreply.github.com> Date: Thu, 11 Jul 2024 18:30:11 +0700 Subject: [PATCH 2/3] refactor(crowdsource): db migration script refs #1674 --- src/main/resources/META-INF/jpa-schema-export.sql | 8 -------- src/main/resources/db/migration/2004004.sql | 10 ++++++++++ 2 files changed, 10 insertions(+), 8 deletions(-) create mode 100644 src/main/resources/db/migration/2004004.sql diff --git a/src/main/resources/META-INF/jpa-schema-export.sql b/src/main/resources/META-INF/jpa-schema-export.sql index 9d3e2e24e..cee5348cf 100644 --- a/src/main/resources/META-INF/jpa-schema-export.sql +++ b/src/main/resources/META-INF/jpa-schema-export.sql @@ -204,7 +204,6 @@ create table AudioContributionEvent ( id bigint not null auto_increment, comment varchar(1000), - platform varchar(255), revisionNumber integer, time datetime, timeSpentMs bigint, @@ -334,7 +333,6 @@ create table ImageContributionEvent ( id bigint not null auto_increment, comment varchar(1000), - platform varchar(255), revisionNumber integer, time datetime, timeSpentMs bigint, @@ -358,7 +356,6 @@ create table LetterContributionEvent ( id bigint not null auto_increment, comment varchar(1000), - platform varchar(255), revisionNumber integer, time datetime, timeSpentMs bigint, @@ -406,7 +403,6 @@ create table LetterSoundCorrespondenceContributionEvent ( id bigint not null auto_increment, comment varchar(1000), - platform varchar(255), revisionNumber integer, time datetime, timeSpentMs bigint, @@ -448,7 +444,6 @@ create table NumberContributionEvent ( id bigint not null auto_increment, comment varchar(1000), - platform varchar(255), revisionNumber integer, time datetime, timeSpentMs bigint, @@ -493,7 +488,6 @@ create table SoundContributionEvent ( id bigint not null auto_increment, comment varchar(1000), - platform varchar(255), revisionNumber integer, time datetime, timeSpentMs bigint, @@ -529,7 +523,6 @@ create table StoryBookContributionEvent ( id bigint not null auto_increment, comment varchar(1000), - platform varchar(255), revisionNumber integer, time datetime, timeSpentMs bigint, @@ -666,7 +659,6 @@ create table WordContributionEvent ( id bigint not null auto_increment, comment varchar(1000), - platform varchar(255), revisionNumber integer, time datetime, timeSpentMs bigint, diff --git a/src/main/resources/db/migration/2004004.sql b/src/main/resources/db/migration/2004004.sql new file mode 100644 index 000000000..81b25a497 --- /dev/null +++ b/src/main/resources/db/migration/2004004.sql @@ -0,0 +1,10 @@ +# 2.4.4 + +ALTER TABLE `AudioContributionEvent` DROP COLUMN `platform`; +ALTER TABLE `ImageContributionEvent` DROP COLUMN `platform`; +ALTER TABLE `LetterContributionEvent` DROP COLUMN `platform`; +ALTER TABLE `LetterSoundCorrespondenceContributionEvent` DROP COLUMN `platform`; +ALTER TABLE `NumberContributionEvent` DROP COLUMN `platform`; +ALTER TABLE `SoundContributionEvent` DROP COLUMN `platform`; +ALTER TABLE `StoryBookContributionEvent` DROP COLUMN `platform`; +ALTER TABLE `WordContributionEvent` DROP COLUMN `platform`; From ba7f64d31017d4a64d662243e4e3aab020e12d7a Mon Sep 17 00:00:00 2001 From: jo-elimu <1451036+jo-elimu@users.noreply.github.com> Date: Thu, 11 Jul 2024 18:38:45 +0700 Subject: [PATCH 3/3] refactor(crowdsource): remove platform ref #1674 --- src/main/java/ai/elimu/model/contributor/ContributionEvent.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/ai/elimu/model/contributor/ContributionEvent.java b/src/main/java/ai/elimu/model/contributor/ContributionEvent.java index 120fdf1e3..53c851a9a 100644 --- a/src/main/java/ai/elimu/model/contributor/ContributionEvent.java +++ b/src/main/java/ai/elimu/model/contributor/ContributionEvent.java @@ -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;