From 73dc1adc843dc252bac6d46518fb48ba7f998a9a Mon Sep 17 00:00:00 2001 From: p31729568 Date: Wed, 30 Oct 2019 15:44:47 +0800 Subject: [PATCH 1/2] weapp: search api --- app/views/weapps/searchs/index.json.jbuilder | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/views/weapps/searchs/index.json.jbuilder b/app/views/weapps/searchs/index.json.jbuilder index a366c061e..11855fb77 100644 --- a/app/views/weapps/searchs/index.json.jbuilder +++ b/app/views/weapps/searchs/index.json.jbuilder @@ -6,5 +6,9 @@ json.results do json.title highlights.delete(:name)&.join('...') || obj.searchable_title json.cover url_to_avatar(obj) + + if obj.is_a?(Course) + json.author_avatar_url url_to_avatar(obj.teacher) + end end end \ No newline at end of file From 9e186b928932956bebfd1ad6df105ac1c53a2d8c Mon Sep 17 00:00:00 2001 From: p31729568 Date: Wed, 30 Oct 2019 15:51:59 +0800 Subject: [PATCH 2/2] weapp: search api add column --- app/models/searchable/course.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/searchable/course.rb b/app/models/searchable/course.rb index 794dec0e2..a82496ad8 100644 --- a/app/models/searchable/course.rb +++ b/app/models/searchable/course.rb @@ -25,6 +25,7 @@ module Searchable::Course author_school_name: teacher&.school_name, visits_count: visits, members_count: course_members_count, + tasks_count: homework_commons_count + exercises_count + polls_count, is_public: is_public == 1, first_category_url: ApplicationController.helpers.module_url(none_hidden_course_modules.first, self) }