chore: pass location image URL as topic image URL (#3876)

pull/2245/head
ggurdin 2 months ago committed by GitHub
parent 916da50bd4
commit 85ac0317b8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -238,15 +238,17 @@ class CoursePlanModel {
} }
List<CmsCoursePlanTopicLocationMedia>? topicLocationMedias; List<CmsCoursePlanTopicLocationMedia>? topicLocationMedias;
if (cmsCoursePlanTopicLocationMedias != null) { if (cmsCoursePlanTopicLocationMedias != null &&
topicLocations != null &&
topicLocations.isNotEmpty) {
final location = topicLocations.first;
for (final media in cmsCoursePlanTopicLocationMedias) { for (final media in cmsCoursePlanTopicLocationMedias) {
if (media.coursePlanTopicLocations.contains(topic.id)) { if (media.coursePlanTopicLocations.contains(location.id)) {
topicLocationMedias ??= []; topicLocationMedias ??= [];
topicLocationMedias.add(media); topicLocationMedias.add(media);
} }
} }
} }
// TODO: consume topicLocationMedias to form topic
topics ??= []; topics ??= [];
topics.add( topics.add(
@ -258,6 +260,10 @@ class CoursePlanModel {
? topicLocations.first.name ? topicLocations.first.name
: "Any", : "Any",
activities: activityPlans, activities: activityPlans,
imageUrl:
topicLocationMedias != null && topicLocationMedias.isNotEmpty
? '${Environment.cmsApi}${topicLocationMedias.last.url}'
: null,
), ),
); );
} }

Loading…
Cancel
Save