diff --git a/app/decorators/tiding_decorator.rb b/app/decorators/tiding_decorator.rb index 8d383dadf..c9ad806ee 100644 --- a/app/decorators/tiding_decorator.rb +++ b/app/decorators/tiding_decorator.rb @@ -98,7 +98,7 @@ module TidingDecorator end def apply_add_schools_content - name = container.name + name = ApplyAddSchool.find_by(id: container_id)&.name if tiding_type == 'Apply' I18n.t(locale_format(tiding_type)) % name elsif status == 2 @@ -201,7 +201,7 @@ module TidingDecorator when 'Issue' then I18n.t(locale_format(parent_container_type)) % parent_container.subject when 'Journal' then - message = object.notes.present? ? ':' + message_content_helper(parent_container.notes) : '' + message = parent_container&.notes.present? ? ':' + message_content_helper(parent_container.notes) : '' I18n.t(locale_format(parent_container_type)) % message end end @@ -331,13 +331,17 @@ module TidingDecorator end def challenge_work_score_content + I18n.t(locale_format) % container&.comment + end + + def student_works_scores_appeal_content work = StudentWork.find_by(id: parent_container_id) - return if work.blank? + name = work&.homework_common&.name if parent_container_type == 'StudentWork' - I18n.t(locale_format(parent_container_type, tiding_type)) % work.homework_common.try(:name) - elsif parent_container_type == 'UserAppealResult' || parent_container_type == 'AppealResult' - I18n.t(locale_format(parent_container_type, status)) % work.homework_common.try(:name) + I18n.t(locale_format(parent_container_type, tiding_type)) % name + else + I18n.t(locale_format(parent_container_type, status)) % name end end @@ -349,7 +353,7 @@ module TidingDecorator if tiding_type == 'System' I18n.t(locale_format(tiding_type, status), reason: extra) % container.try(:title) else - I18n.t(locale_format) % container.try(:title) + I18n.t(locale_format(tiding_type)) % container.try(:title) end end diff --git a/app/models/journal.rb b/app/models/journal.rb new file mode 100644 index 000000000..25c1e2498 --- /dev/null +++ b/app/models/journal.rb @@ -0,0 +1,4 @@ +class Journal < ApplicationRecord + belongs_to :user + belongs_to :issue, foreign_key: :journalized_id +end \ No newline at end of file diff --git a/app/models/tiding.rb b/app/models/tiding.rb index 66b1f85be..3ef625c57 100644 --- a/app/models/tiding.rb +++ b/app/models/tiding.rb @@ -6,4 +6,16 @@ class Tiding < ApplicationRecord belongs_to :belong_container, polymorphic: true, optional: true has_many :attachments, as: :container + + def identifier + value = nil + if Object.const_defined?(container_type) + value = container.try(:identifier) + end + + if value.blank? && belong_container_type && Object.const_defined?(belong_container_type) + value = belong_container.try(:identifier) + end + value + end end \ No newline at end of file diff --git a/app/views/tidings/_tiding.json.jbuilder b/app/views/tidings/_tiding.json.jbuilder index d26d37b7b..34b06320d 100644 --- a/app/views/tidings/_tiding.json.jbuilder +++ b/app/views/tidings/_tiding.json.jbuilder @@ -1,6 +1,6 @@ json.extract! tiding, :id, :status, :viewed, :user_id, :tiding_type, :container_id, :container_type, :parent_container_id, :parent_container_type json.content tiding.content -json.identifier tiding.try(:container).try(:identifier) rescue nil +json.identifier tiding.identifier json.time tiding.how_long_time json.new_tiding tiding.unread?(@onclick_time) diff --git a/db/migrate/20190729122213_delete_myshixun_games_for_users.rb b/db/migrate/20190729122213_delete_myshixun_games_for_users.rb new file mode 100644 index 000000000..d52369828 --- /dev/null +++ b/db/migrate/20190729122213_delete_myshixun_games_for_users.rb @@ -0,0 +1,11 @@ +class DeleteMyshixunGamesForUsers < ActiveRecord::Migration[5.2] + def change + myshixuns = Myshixun.where("created_at > '2019-07-26 19:00:00' and repo_name is null") + myshixuns.find_each do |m| + if m.games.count == m.games.select{|g| g.status == 3}.count + puts("#######login: #{User.find(m.user_id).login}") + m.destroy! + end + end + end +end diff --git a/public/react/public/css/edu-all.css b/public/react/public/css/edu-all.css index 718ef291c..8b7c727a9 100644 --- a/public/react/public/css/edu-all.css +++ b/public/react/public/css/edu-all.css @@ -15,7 +15,7 @@ text-align: center; height: 60px; box-sizing: border-box; - min-width: 800px; + min-width: 785px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 13313b5d4..3d1136371 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -791,7 +791,7 @@ submittojoinclass=(value)=>{ <%= link_to '注册', user_join_path, :className => "ml5" %> */} { user===undefined? - + this.educoderlogin()} className="mr5 color-white">登录 注册 diff --git a/public/stylesheets/educoder/edu-all.css b/public/stylesheets/educoder/edu-all.css index ff4665d22..4fdd8c400 100644 --- a/public/stylesheets/educoder/edu-all.css +++ b/public/stylesheets/educoder/edu-all.css @@ -15,7 +15,7 @@ text-align: center; height: 60px; box-sizing: border-box; - min-width: 800px; + min-width: 785px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;