Skip to content

Commit 7f6bb40

Browse files
authored
Model 2.0.117 (#2312)
2 parents a9194b5 + 2a72571 commit 7f6bb40

File tree

8 files changed

+63
-15
lines changed

8 files changed

+63
-15
lines changed

pom-dependency-tree.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
ai.elimu:webapp:war:2.6.107-SNAPSHOT
2-
+- ai.elimu:model:jar:model-2.0.114:compile
1+
ai.elimu:webapp:war:2.6.108-SNAPSHOT
2+
+- ai.elimu:model:jar:model-2.0.117:compile
33
| \- com.google.code.gson:gson:jar:2.13.1:compile
44
| \- com.google.errorprone:error_prone_annotations:jar:2.38.0:compile
55
+- org.springframework:spring-context:jar:6.0.11:compile

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<properties>
1010
<java.version>17</java.version>
1111
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
12-
<model.version>2.0.114</model.version>
12+
<model.version>2.0.117</model.version>
1313
<hibernate.version>6.1.7.Final</hibernate.version>
1414
<jetty.version>11.0.24</jetty.version>
1515
<spring.version>6.0.11</spring.version>
Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
package ai.elimu.entity.analytics;
22

3+
import java.util.List;
4+
35
import ai.elimu.entity.content.LetterSound;
6+
import ai.elimu.entity.converters.StringListConverter;
7+
import jakarta.persistence.Convert;
48
import jakarta.persistence.Entity;
59
import jakarta.persistence.ManyToOne;
10+
import jakarta.validation.constraints.NotNull;
611
import lombok.Getter;
712
import lombok.Setter;
813

@@ -11,13 +16,27 @@
1116
@Entity
1217
public class LetterSoundLearningEvent extends LearningEvent {
1318

14-
/**
15-
* This field might not be included, e.g. if the letter-sound correspondence was learned
16-
* in a 3rd-party app that did not load the content from the elimu.ai Content Provider.
17-
* In this case, the {@link #letterSoundId} will be {@code null}.
18-
*/
19-
private Long letterSoundId;
19+
/**
20+
* The sequence of letters. E.g. <code>["s","h"]</code>.
21+
*/
22+
@NotNull
23+
@Convert(converter = StringListConverter.class)
24+
private List<String> letterSoundLetters;
25+
26+
/**
27+
* The sequence of sounds (IPA values). E.g. <code>["ʃ"]</code>.
28+
*/
29+
@NotNull
30+
@Convert(converter = StringListConverter.class)
31+
private List<String> letterSoundSounds;
32+
33+
/**
34+
* This field might not be included, e.g. if the assessment task was done in a
35+
* 3rd-party app that did not load the content from the elimu.ai Content Provider.
36+
* In that case, this field will be {@code null}.
37+
*/
38+
private Long letterSoundId;
2039

21-
@ManyToOne
22-
private LetterSound letterSound;
40+
@ManyToOne
41+
private LetterSound letterSound;
2342
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package ai.elimu.entity.converters;
2+
3+
import java.util.Arrays;
4+
import java.util.Collections;
5+
import java.util.List;
6+
7+
import jakarta.persistence.AttributeConverter;
8+
9+
public class StringListConverter implements AttributeConverter<List<String>, String> {
10+
private static final String SPLIT_CHAR = ";";
11+
12+
@Override
13+
public String convertToDatabaseColumn(List<String> stringList) {
14+
return stringList != null ? String.join(SPLIT_CHAR, stringList) : "";
15+
}
16+
17+
@Override
18+
public List<String> convertToEntityAttribute(String string) {
19+
return string != null ? Arrays.asList(string.split(SPLIT_CHAR)) : Collections.emptyList();
20+
}
21+
}

src/main/java/ai/elimu/util/csv/CsvAnalyticsExtractionHelper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,9 @@ public static List<LetterSoundLearningEvent> extractLetterSoundLearningEvents(Fi
181181
}
182182
}
183183

184-
// TODO: letterSoundLetters
184+
// TODO: letter_sound_letters
185185

186-
// TODO: letterSoundSounds
186+
// TODO: letter_sound_sounds
187187

188188
Long letterSoundId = Long.valueOf(csvRecord.get("letter_sound_id"));
189189
letterSoundLearningEvent.setLetterSoundId(letterSoundId);

src/main/java/ai/elimu/web/servlet/CustomDispatcherServlet.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,8 @@ private void populateDatabase(WebApplicationContext webApplicationContext) {
380380
letterSoundLearningEvent.setResearchExperiment(ResearchExperiment.EXP_0_WORD_EMOJIS);
381381
letterSoundLearningEvent.setExperimentGroup(ExperimentGroup.values()[(int) (Math.random() * 2)]);
382382
}
383+
letterSoundLearningEvent.setLetterSoundLetters(letterSoundM.getLetters().stream().map(Letter::getText).toList());
384+
letterSoundLearningEvent.setLetterSoundSounds(letterSoundM.getSounds().stream().map(Sound::getValueIpa).toList());
383385
letterSoundLearningEvent.setLetterSoundId(letterSoundM.getId());
384386
letterSoundLearningEventDao.create(letterSoundLearningEvent);
385387
}

src/main/resources/META-INF/jpa-schema-export.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,8 @@
672672
researchExperiment smallint,
673673
timestamp datetime,
674674
letterSoundId bigint,
675+
letterSoundLetters varchar(255),
676+
letterSoundSounds varchar(255),
675677
application_id bigint,
676678
letterSound_id bigint,
677679
primary key (id)

src/main/webapp/WEB-INF/jsp/analytics/students/id.jsp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,8 @@
227227
<thead>
228228
<th>timestamp</th>
229229
<th>package_name</th>
230-
<th>letter_sound_id</th>
230+
<th>letter_sound_letters</th>
231+
<th>letter_sound_sounds</th>
231232
<th>ℹ️</th>
232233
</thead>
233234
<tbody>
@@ -241,7 +242,10 @@
241242
<code>${letterSoundLearningEvent.packageName}</code>
242243
</td>
243244
<td>
244-
${letterSoundLearningEvent.letterSoundId}
245+
${letterSoundLearningEvent.letterSoundLetters}
246+
</td>
247+
<td>
248+
${letterSoundLearningEvent.letterSoundSounds}
245249
</td>
246250
<td>
247251
<code>${letterSoundLearningEvent.additionalData}</code>

0 commit comments

Comments
 (0)