diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb
index 1c6fd7008..60e00280e 100644
--- a/app/api/mobile/apis/courses.rb
+++ b/app/api/mobile/apis/courses.rb
@@ -397,7 +397,7 @@ module Mobile
authenticate!
course = Course.find(params[:course_id])
- exercises = course.exercises.where("exercise_status <> 1").order("created_at desc")
+ exercises = course.exercises.where("exercise_status <> 1").reorder("created_at desc")
present :data,exercises,with:Mobile::Entities::Exercise,user: current_user
present :status,0
end
diff --git a/app/api/mobile/entities/activity.rb b/app/api/mobile/entities/activity.rb
index 9e2a39a5a..bdeff7ae9 100644
--- a/app/api/mobile/entities/activity.rb
+++ b/app/api/mobile/entities/activity.rb
@@ -20,15 +20,17 @@ module Mobile
ac.act unless ac.nil? || ac.act.nil?
end
when :reply_count
- if ac.act_type == "HomeworkCommon"
- ac.nil? || ac.act.nil? ? 0 : ac.act.journals_for_messages.count
- elsif ac.act_type == "News"
- ac.nil? || ac.act.nil? ? 0 : ac.act.comments.count
- elsif ac.act_type == "Message" || ac.act_type == "BlogComment" || ac.act_type == "JournalsForMessage"
- ac.nil? || ac.act.nil? ? 0 : ac.act.children.count
- elsif ac.act_type == "Issue"
- ac.nil? || ac.act.nil? ? 0 : ac.act.journals.where("notes is not null and notes != ''").count
- end
+ # if ac.act_type == "HomeworkCommon"
+ # ac.nil? || ac.act.nil? ? 0 : ac.act.journals_for_messages.count
+ # elsif ac.act_type == "News"
+ # ac.nil? || ac.act.nil? ? 0 : ac.act.comments.count
+ # elsif ac.act_type == "Message" || ac.act_type == "BlogComment" || ac.act_type == "JournalsForMessage"
+ # ac.nil? || ac.act.nil? ? 0 : ac.act.children.count
+ # elsif ac.act_type == "Issue"
+ # ac.nil? || ac.act.nil? ? 0 : ac.act.journals.where("notes is not null and notes != ''").count
+ # end
+ all_comments = []
+ ac.nil? || ac.act.nil? ? 0 : get_all_children(all_comments, ac.act).count
when :subject
if ac.act_type == "HomeworkCommon"
ac.act.name unless ac.nil? || ac.act.nil?
diff --git a/app/api/mobile/entities/blog_comment.rb b/app/api/mobile/entities/blog_comment.rb
index 67904d11e..a61864900 100644
--- a/app/api/mobile/entities/blog_comment.rb
+++ b/app/api/mobile/entities/blog_comment.rb
@@ -25,7 +25,9 @@ module Mobile
when :act_id
u.id
when :comment_count
- u.children.count
+ # u.children.count
+ all_comments = []
+ get_all_children(all_comments, u).count
end
end
end
diff --git a/app/api/mobile/entities/issue.rb b/app/api/mobile/entities/issue.rb
index ef3d09450..b99ea03a5 100644
--- a/app/api/mobile/entities/issue.rb
+++ b/app/api/mobile/entities/issue.rb
@@ -23,7 +23,9 @@ module Mobile
when :issue_status
IssueStatus.find(issue.status_id).name
when :journals_count
- issue.journals.where("notes is not null and notes != ''").count
+ # issue.journals.where("notes is not null and notes != ''").count
+ all_comments = []
+ get_all_children(all_comments, f).count
when :project_name
issue.project.name
when :praise_count
diff --git a/app/api/mobile/entities/jours.rb b/app/api/mobile/entities/jours.rb
index 15e22174c..f98d7a9ed 100644
--- a/app/api/mobile/entities/jours.rb
+++ b/app/api/mobile/entities/jours.rb
@@ -18,7 +18,9 @@ module Mobile
when :lasted_comment
time_from_now f.created_on
when :reply_count
- f.children.count
+ # f.children.count
+ all_comments = []
+ get_all_children(all_comments, f).count
when :praise_count
get_activity_praise_num(f)
when :act_type
diff --git a/app/api/mobile/entities/message.rb b/app/api/mobile/entities/message.rb
index 051c92886..d58192378 100644
--- a/app/api/mobile/entities/message.rb
+++ b/app/api/mobile/entities/message.rb
@@ -30,6 +30,9 @@ module Mobile
'Message'
when :act_id
u.id
+ when :replies_count
+ all_comments = []
+ get_all_children(all_comments, u).count
end
end
end
diff --git a/app/api/mobile/entities/news.rb b/app/api/mobile/entities/news.rb
index 4f973d82e..ff1452b1c 100644
--- a/app/api/mobile/entities/news.rb
+++ b/app/api/mobile/entities/news.rb
@@ -24,6 +24,9 @@ module Mobile
'News'
when :act_id
f.id
+ when :comments_count
+ all_comments = []
+ get_all_children(all_comments, f).count
end
end
elsif f.is_a?(Hash) && !f.key?(field)
diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb
index 39c77de4b..091e2749e 100644
--- a/app/services/courses_service.rb
+++ b/app/services/courses_service.rb
@@ -392,7 +392,7 @@ class CoursesService
def homework_list params,current_user
course = Course.find(params[:id])
if course.is_public != 0 || current_user.member_of_course?(course)
- bids = course.homework_commons.where("publish_time <= ?",Time.now.strftime("%Y-%m-%d")).page(params[:page] || 1).per(20).order('created_at DESC')
+ bids = course.homework_commons.where("publish_time <= ?",Time.now.strftime("%Y-%m-%d")).page(params[:page] || 1).per(20).reorder('created_at DESC')
bids = bids.like(params[:name]) if params[:name].present?
homeworks = []
bids.each do |bid|
@@ -495,7 +495,7 @@ class CoursesService
def course_attachments params
result = []
course = Course.find(params[:course_id])
- attachments = course.attachments.where("is_publish = 1").order("created_on desc")
+ attachments = course.attachments.where("is_publish = 1").reorder("created_on desc")
if !params[:name].nil? && params[:name] != ""
attachments.each do |atta|
result << atta if atta.filename.include?(params[:name])
diff --git a/public/assets/wechat/class_list.html b/public/assets/wechat/class_list.html
index a3c709cb5..d0074f343 100644
--- a/public/assets/wechat/class_list.html
+++ b/public/assets/wechat/class_list.html
@@ -36,5 +36,6 @@
我的资源
-
暂无课件,
请登录Trustie网站,在PC浏览器中上传课件。