From d6405c3a62a498b3e7ac03f02cc70877139bf6e4 Mon Sep 17 00:00:00 2001 From: jo-elimu <1451036+jo-elimu@users.noreply.github.com> Date: Wed, 9 Oct 2024 12:48:37 +0700 Subject: [PATCH 1/2] feat(entity): video learning event #1894 --- .../elimu/model/analytics/LearningEvent.java | 2 +- .../model/analytics/VideoLearningEvent.java | 52 +++++++++++++++++++ .../resources/META-INF/jpa-schema-export.sql | 25 +++++++++ 3 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 src/main/java/ai/elimu/model/analytics/VideoLearningEvent.java diff --git a/src/main/java/ai/elimu/model/analytics/LearningEvent.java b/src/main/java/ai/elimu/model/analytics/LearningEvent.java index 0db27ebab..7a373a7b5 100644 --- a/src/main/java/ai/elimu/model/analytics/LearningEvent.java +++ b/src/main/java/ai/elimu/model/analytics/LearningEvent.java @@ -26,7 +26,7 @@ public abstract class LearningEvent extends BaseEntity { private String androidId; /** - * The package name of the {@link #application}. + * The package name of the {@link #application} where the learning event occurred. */ @NotNull private String packageName; diff --git a/src/main/java/ai/elimu/model/analytics/VideoLearningEvent.java b/src/main/java/ai/elimu/model/analytics/VideoLearningEvent.java new file mode 100644 index 000000000..2ea5e1843 --- /dev/null +++ b/src/main/java/ai/elimu/model/analytics/VideoLearningEvent.java @@ -0,0 +1,52 @@ +package ai.elimu.model.analytics; + +import javax.persistence.Entity; +import javax.persistence.ManyToOne; +import javax.validation.constraints.NotNull; + +import ai.elimu.model.content.multimedia.Video; + +@Entity +public class VideoLearningEvent extends LearningEvent { + + @NotNull + private String videoTitle; + + /** + * This field might not be included, e.g. if the videos were opened in a 3rd-party + * app that did not load the videos from the elimu.ai Content Provider. In this + * case, the {@link #videoId} will be {@code null}. + */ + private Long videoId; + + /** + * This field will only be populated if a corresponding {@link Video} can be + * found in the database for a given {@link #videoId}. + */ + @ManyToOne + private Video video; + + public String getVideoTitle() { + return videoTitle; + } + + public void setVideoTitle(String videoTitle) { + this.videoTitle = videoTitle; + } + + public Long getVideoId() { + return videoId; + } + + public void setVideoId(Long videoId) { + this.videoId = videoId; + } + + public Video getVideo() { + return video; + } + + public void setVideo(Video video) { + this.video = video; + } +} diff --git a/src/main/resources/META-INF/jpa-schema-export.sql b/src/main/resources/META-INF/jpa-schema-export.sql index 97e411982..9f13bb4eb 100644 --- a/src/main/resources/META-INF/jpa-schema-export.sql +++ b/src/main/resources/META-INF/jpa-schema-export.sql @@ -107,6 +107,8 @@ drop table if exists Video_Word; + drop table if exists VideoLearningEvent; + drop table if exists Word; drop table if exists Word_LetterSound; @@ -631,6 +633,19 @@ primary key (Video_id, words_id) ) engine=MyISAM; + create table VideoLearningEvent ( + id bigint not null auto_increment, + androidId varchar(255), + learningEventType varchar(255), + packageName varchar(255), + timestamp datetime, + videoId bigint, + videoTitle varchar(255), + application_id bigint, + video_id bigint, + primary key (id) + ) engine=MyISAM; + create table Word ( id bigint not null auto_increment, contentStatus varchar(255), @@ -1072,6 +1087,16 @@ foreign key (Video_id) references Video (id); + alter table VideoLearningEvent + add constraint FKoqqhe1r2epyv55g6jo79t251h + foreign key (application_id) + references Application (id); + + alter table VideoLearningEvent + add constraint FK38rllate5mtlhi6fdiudffm4c + foreign key (video_id) + references Video (id); + alter table Word add constraint FKd1ussioi3bpu2tmxm0cim5s5a foreign key (rootWord_id) From 6e2743f2633e80ddfb54360f7e4ce64048379160 Mon Sep 17 00:00:00 2001 From: jo-elimu <1451036+jo-elimu@users.noreply.github.com> Date: Wed, 9 Oct 2024 15:40:20 +0700 Subject: [PATCH 2/2] styles --- src/main/webapp/WEB-INF/jsp/admin/layout.jsp | 4 +-- .../webapp/WEB-INF/jsp/analytics/layout.jsp | 4 +-- .../webapp/WEB-INF/jsp/content/layout.jsp | 4 +-- src/main/webapp/WEB-INF/jsp/layout.jsp | 4 +-- src/main/webapp/WEB-INF/jsp/welcome.jsp | 15 +++++--- src/main/webapp/static/css/content/styles.css | 16 ++------- src/main/webapp/static/css/styles.css | 36 ++++++++++++++++--- 7 files changed, 53 insertions(+), 30 deletions(-) diff --git a/src/main/webapp/WEB-INF/jsp/admin/layout.jsp b/src/main/webapp/WEB-INF/jsp/admin/layout.jsp index 4695a7cda..3e7dd6453 100644 --- a/src/main/webapp/WEB-INF/jsp/admin/layout.jsp +++ b/src/main/webapp/WEB-INF/jsp/admin/layout.jsp @@ -186,7 +186,7 @@ -