@@ -2,6 +2,7 @@ package ai.elimu.analytics.utils
2
2
3
3
import ai.elimu.model.v2.gson.content.LetterGson
4
4
import ai.elimu.model.v2.gson.content.LetterSoundGson
5
+ import ai.elimu.model.v2.gson.content.NumberGson
5
6
import ai.elimu.model.v2.gson.content.SoundGson
6
7
import ai.elimu.model.v2.gson.content.WordGson
7
8
import android.content.Context
@@ -23,7 +24,7 @@ object AssessmentEventUtil {
23
24
* @param masteryScore A value in the range [0.0, 1.0].
24
25
* @param timeSpentMs The number of milliseconds passed between the student opening the assessment task and submitting a response. E.g. `15000`.
25
26
* @param additionalData Any additional data related to the learning event, e.g. `{'is_letter_pressed':true}`
26
- * @param context Needed to fetch the `packageName` of the application where the learning event occurred.
27
+ * @param context Needed to fetch the `packageName` of the application where the event occurred.
27
28
* @param analyticsApplicationId The package name of the analytics application that will receive the Intent and store the event.
28
29
*/
29
30
fun reportLetterSoundAssessmentEvent (
@@ -59,16 +60,16 @@ object AssessmentEventUtil {
59
60
* @param masteryScore A value in the range [0.0, 1.0].
60
61
* @param timeSpentMs The number of milliseconds passed between the student opening the assessment task and submitting a response. E.g. `15000`.
61
62
* @param additionalData Any additional data related to the learning event, e.g. `{'is_word_pressed':true}`
62
- * @param context Needed to fetch the `packageName` of the application where the learning event occurred.
63
+ * @param context Needed to fetch the `packageName` of the application where the event occurred.
63
64
* @param analyticsApplicationId The package name of the analytics application that will receive the Intent and store the event.
64
65
*/
65
66
fun reportWordAssessmentEvent (
66
67
wordGson : WordGson ,
67
- masteryScore : Float? ,
68
- timeSpentMs : Long? ,
68
+ masteryScore : Float ,
69
+ timeSpentMs : Long ,
69
70
additionalData : JSONObject ? = null,
70
71
context : Context ,
71
- analyticsApplicationId : String?
72
+ analyticsApplicationId : String
72
73
) {
73
74
Log .i(TAG , " reportWordAssessmentEvent" )
74
75
@@ -86,4 +87,37 @@ object AssessmentEventUtil {
86
87
broadcastIntent.setPackage(analyticsApplicationId)
87
88
context.sendBroadcast(broadcastIntent)
88
89
}
90
+
91
+ /* *
92
+ * @param numberGson The number that the student is being assessed for.
93
+ * @param masteryScore A value in the range [0.0, 1.0].
94
+ * @param timeSpentMs The number of milliseconds passed between the student opening the assessment task and submitting a response. E.g. `15000`.
95
+ * @param additionalData Any additional data related to the learning event, e.g. `{'is_number_pressed':true}`
96
+ * @param context Needed to fetch the `packageName` of the application where the event occurred.
97
+ * @param analyticsApplicationId The package name of the analytics application that will receive the Intent and store the event.
98
+ */
99
+ fun reportNumberAssessmentEvent (
100
+ numberGson : NumberGson ,
101
+ masteryScore : Float ,
102
+ timeSpentMs : Long ,
103
+ additionalData : JSONObject ? = null,
104
+ context : Context ,
105
+ analyticsApplicationId : String
106
+ ) {
107
+ Log .i(TAG , " reportNumberAssessmentEvent" )
108
+
109
+ val broadcastIntent = Intent ()
110
+ broadcastIntent.setPackage(analyticsApplicationId)
111
+ broadcastIntent.setAction(" ai.elimu.intent.action.NUMBER_ASSESSMENT_EVENT" )
112
+ broadcastIntent.putExtra(BundleKeys .KEY_PACKAGE_NAME , context.packageName)
113
+ broadcastIntent.putExtra(BundleKeys .KEY_MASTERY_SCORE , masteryScore)
114
+ broadcastIntent.putExtra(BundleKeys .KEY_TIME_SPENT_MS , timeSpentMs)
115
+ additionalData?.let {
116
+ broadcastIntent.putExtra(BundleKeys .KEY_ADDITIONAL_DATA , additionalData.toString())
117
+ }
118
+ broadcastIntent.putExtra(BundleKeys .KEY_NUMBER_VALUE , numberGson.value)
119
+ broadcastIntent.putExtra(BundleKeys .KEY_NUMBER_ID , numberGson.id)
120
+
121
+ context.sendBroadcast(broadcastIntent)
122
+ }
89
123
}
0 commit comments