Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pom-dependency-tree.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ai.elimu:webapp:war:2.6.112-SNAPSHOT
+- ai.elimu:model:jar:model-2.0.118:compile
ai.elimu:webapp:war:2.6.113-SNAPSHOT
+- ai.elimu:model:jar:model-2.0.119:compile
| \- com.google.code.gson:gson:jar:2.13.1:compile
| \- com.google.errorprone:error_prone_annotations:jar:2.38.0:compile
+- org.springframework:spring-context:jar:6.0.11:compile
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<properties>
<java.version>17</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<model.version>2.0.118</model.version>
<model.version>2.0.119</model.version>
<hibernate.version>6.1.7.Final</hibernate.version>
<jetty.version>11.0.24</jetty.version>
<spring.version>6.0.11</spring.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class NumberAssessmentEvent extends AssessmentEvent {
private Integer numberValue;

/**
* The number represented as a symbol specific to the language. E.g. <code>"१०"</code>.
* The number represented as a symbol specific to the language. E.g. "१०" for <code>10</code> in Hindi.
*/
private String numberSymbol;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -544,8 +544,13 @@ public static List<NumberAssessmentEvent> extractNumberAssessmentEvents(File csv
Integer numberValue = Integer.valueOf(csvRecord.get("number_value"));
numberAssessmentEvent.setNumberValue(numberValue);

// String numberSymbol = csvRecord.get("number_symbol");
// numberAssessmentEvent.setNumberSymbol(numberSymbol);
if (versionCode >= 4001005) {
// https://github.com/elimu-ai/analytics/releases/tag/4.1.5
if (StringUtils.isNotBlank(csvRecord.get("number_symbol"))) {
String numberSymbol = csvRecord.get("number_symbol");
numberAssessmentEvent.setNumberSymbol(numberSymbol);
}
}
Comment on lines +547 to +553
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

LGTM! Version-based conditional logic follows established patterns.

The implementation correctly follows the established pattern for version-based feature support:

  • Proper version check for 4.1.5+ (4001005)
  • Appropriate use of StringUtils.isNotBlank() for field validation
  • Consistent with other conditional extractions in the file

However, please verify consistency with the extractNumberLearningEvents method (lines 471-474), which appears to process number_symbol without version checks. Ensure this difference is intentional based on when the field was introduced for each event type.


🏁 Script executed:

#!/bin/bash
# Search for numberSymbol field usage across the codebase to verify consistency
echo "=== Searching for numberSymbol field usage ==="
rg -A 3 -B 3 "number_symbol|numberSymbol" --type java

echo "=== Checking for version-based logic patterns ==="
rg -A 5 -B 2 "versionCode.*40010" --type java

Length of output: 8976


Add version guard for number_symbol in NumberLearningEvents parsing

The number_symbol field was introduced in Analytics 4.1.5, but in extractNumberLearningEvents() it’s parsed unconditionally. This will fail on older CSVs that don’t include that column. Wrap the existing logic in a versionCode >= 4001005 check, mirroring the assessment event handler:

• File: src/main/java/ai/elimu/util/csv/CsvAnalyticsExtractionHelper.java
Location: within extractNumberLearningEvents() (around lines 471–474)

• Replace:

if (StringUtils.isNotBlank(csvRecord.get("number_symbol"))) {
    String numberSymbol = csvRecord.get("number_symbol");
    numberLearningEvent.setNumberSymbol(numberSymbol);
}

With:

if (versionCode >= 4001005) {
    if (StringUtils.isNotBlank(csvRecord.get("number_symbol"))) {
        String numberSymbol = csvRecord.get("number_symbol");
        numberLearningEvent.setNumberSymbol(numberSymbol);
    }
}
🤖 Prompt for AI Agents
In src/main/java/ai/elimu/util/csv/CsvAnalyticsExtractionHelper.java around
lines 471 to 474 inside the extractNumberLearningEvents() method, the code
parses the number_symbol field without checking the versionCode, which causes
failures on older CSVs missing this column. To fix this, wrap the existing
number_symbol parsing logic in a condition that checks if versionCode is greater
than or equal to 4001005, ensuring the field is only accessed for compatible
versions.


if (StringUtils.isNotBlank(csvRecord.get("number_id"))) {
Long numberId = Long.valueOf(csvRecord.get("number_id"));
Expand Down
Loading