chore: use activity IDs from the choreo response (#3706)

This commit is contained in:
ggurdin 2025-08-12 15:34:57 -04:00 committed by GitHub
parent f5a2d1114b
commit 9e190d483a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 7 additions and 4 deletions

View file

@ -221,6 +221,7 @@ class ActivityGeneratorState extends State<ActivityGenerator> {
vocab: activity.vocab,
imageURL: imageUrl,
roles: activity.roles,
bookmarkId: activity.bookmarkId,
);
}
});

View file

@ -21,13 +21,12 @@ class ActivityPlanModel {
required this.learningObjective,
required this.instructions,
required this.vocab,
required this.bookmarkId,
Map<String, ActivityRole>? roles,
this.imageURL,
this.endAt,
this.duration,
}) : bookmarkId =
"${title.hashCode ^ learningObjective.hashCode ^ instructions.hashCode ^ imageURL.hashCode ^ vocab.map((v) => v.hashCode).reduce((a, b) => a ^ b)}",
_roles = roles;
}) : _roles = roles;
Map<String, ActivityRole> get roles {
if (_roles != null) return _roles!;
@ -62,6 +61,7 @@ class ActivityPlanModel {
endAt: endAt ?? this.endAt,
duration: duration ?? this.duration,
roles: roles ?? _roles,
bookmarkId: bookmarkId,
);
}
@ -102,6 +102,7 @@ class ActivityPlanModel {
)
: null,
roles: roles,
bookmarkId: json[ModelKey.activityPlanBookmarkId],
);
}

View file

@ -103,6 +103,7 @@ class ActivityPlannerBuilderState extends State<ActivityPlannerBuilder> {
vocab: vocab,
imageURL: imageURL,
roles: widget.initialActivity.roles,
bookmarkId: widget.initialActivity.bookmarkId,
);
}

View file

@ -163,7 +163,7 @@ class ModelKey {
static const String activityPlanInstructions = "instructions";
static const String activityPlanVocab = "vocab";
static const String activityPlanImageURL = "image_url";
static const String activityPlanBookmarkId = "bookmark_id";
static const String activityPlanBookmarkId = "activity_id";
static const String activityPlanEndAt = "end_at";
static const String activityPlanDuration = "duration";