43 lines
1.2 KiB
Dart
43 lines
1.2 KiB
Dart
/// One row from [spelling_items] joined with optional user progress.
|
|
class SpellingItemRecord {
|
|
const SpellingItemRecord({
|
|
required this.id,
|
|
required this.spellingWordId,
|
|
required this.canonicalWord,
|
|
required this.displayedWord,
|
|
required this.isCorrectlySpelled,
|
|
required this.correctAnswer,
|
|
this.familiarityScore = 0,
|
|
this.attemptCount = 0,
|
|
});
|
|
|
|
final String id;
|
|
final String spellingWordId;
|
|
final String canonicalWord;
|
|
final String displayedWord;
|
|
final bool isCorrectlySpelled;
|
|
final num correctAnswer;
|
|
final int familiarityScore;
|
|
final int attemptCount;
|
|
|
|
Map<String, dynamic> toQuestionMetadata() {
|
|
return <String, dynamic>{
|
|
'spelling_item_id': id,
|
|
'spelling_word_id': spellingWordId,
|
|
'canonical_word': canonicalWord,
|
|
'displayed_word': displayedWord,
|
|
'is_correctly_spelled': isCorrectlySpelled,
|
|
};
|
|
}
|
|
|
|
Map<String, dynamic> toPipelineContext() {
|
|
return <String, dynamic>{
|
|
'spellingItemId': id,
|
|
'spellingWordId': spellingWordId,
|
|
'canonicalWord': canonicalWord,
|
|
'displayedWord': displayedWord,
|
|
'isCorrectlySpelled': isCorrectlySpelled,
|
|
};
|
|
}
|
|
}
|