use ConstructIdentifier to sort constructs into groups
This commit is contained in:
parent
00cb1f1c75
commit
71b090683d
3 changed files with 13 additions and 8 deletions
|
|
@ -36,13 +36,8 @@ class ConstructListModel {
|
|||
final Map<String, List<OneConstructUse>> lemmaToUses = {};
|
||||
for (final use in uses) {
|
||||
if (use.lemma == null) continue;
|
||||
lemmaToUses[use.lemma! +
|
||||
use.constructType.string +
|
||||
(use.category ?? "Other")] ??= [];
|
||||
lemmaToUses[use.lemma! +
|
||||
use.constructType.string +
|
||||
(use.category ?? "Other")]!
|
||||
.add(use);
|
||||
lemmaToUses[use.identifier.string] ??= [];
|
||||
lemmaToUses[use.identifier.string]!.add(use);
|
||||
}
|
||||
|
||||
_constructMap = lemmaToUses.map(
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import 'dart:developer';
|
||||
|
||||
import 'package:fluffychat/pangea/enum/construct_use_type_enum.dart';
|
||||
import 'package:fluffychat/pangea/models/practice_activities.dart/practice_activity_model.dart';
|
||||
import 'package:fluffychat/pangea/utils/error_handler.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
|
|
@ -161,6 +162,12 @@ class OneConstructUse {
|
|||
}
|
||||
|
||||
int get pointValue => useType.pointValue;
|
||||
|
||||
ConstructIdentifier get identifier => ConstructIdentifier(
|
||||
lemma: lemma!,
|
||||
type: constructType,
|
||||
category: category,
|
||||
);
|
||||
}
|
||||
|
||||
class ConstructUseMetaData {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import 'package:sentry_flutter/sentry_flutter.dart';
|
|||
class ConstructIdentifier {
|
||||
final String lemma;
|
||||
final ConstructTypeEnum type;
|
||||
String? category;
|
||||
final String? category;
|
||||
|
||||
ConstructIdentifier({
|
||||
required this.lemma,
|
||||
|
|
@ -68,6 +68,9 @@ class ConstructIdentifier {
|
|||
int get hashCode {
|
||||
return lemma.hashCode ^ type.hashCode;
|
||||
}
|
||||
|
||||
String get string =>
|
||||
"$lemma-${type.string}${category != null ? "-$category" : "-other"}";
|
||||
}
|
||||
|
||||
class CandidateMessage {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue