diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 428e1157..b0a7be31 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -895,6 +895,8 @@ class AttachmentsController < ApplicationController @school = @attachment.container elsif @attachment.container_type == 'Library' @library = @attachment.container + elsif @attachment.container_type == 'ProjectPackage' + @package = @attachment.container else unless @attachment.container_type == 'Syllabus' || @attachment.container_type == 'Bid' || @attachment.container_type == 'Organization' || @attachment.container_type == 'HomeworkAttach' || @attachment.container_type == 'Memo' || @attachment.container_type == 'Softapplication' || @attachment.container_type == 'PhoneAppVersion' || @attachment.container_type == 'StudentWorksScore' || @attachment.container_type == 'StudentWork' || @attachment.container_type == 'Work'|| @attachment.container_type == 'ContestantWork'|| @attachment.container_type == 'Contest' || @attachment.container_type == 'HomeworkBank' || @attachment.container_type == 'Exercise' || @attachment.container_type == 'ExerciseBank' || @attachment.container_type == 'Career' || @attachment.container_type == 'EcTemplate' @project = @attachment.project diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 05e1e2ce..87a0e22b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -4375,6 +4375,8 @@ module ApplicationHelper candown = User.current.member_of_course?(attachment.container.courses.first) || (course.is_public == 1 && attachment.is_public == 1) elsif attachment.container_type == "Library" #教学案例允许下载 candown = true + elsif attachment.container_type == "ProjectPackage" #教学案例允许下载 + candown = true else candown = (attachment.is_public == 1 || attachment.is_public == true) end diff --git a/db/migrate/20190712083208_add_index_to_project_packages.rb b/db/migrate/20190712083208_add_index_to_project_packages.rb new file mode 100644 index 00000000..c72d359a --- /dev/null +++ b/db/migrate/20190712083208_add_index_to_project_packages.rb @@ -0,0 +1,8 @@ +class AddIndexToProjectPackages < ActiveRecord::Migration + def change + add_index :project_packages, :creator_id + add_index :project_package_applies, :project_package_id + add_index :bidding_users, :project_package_id + add_index :bidding_users, :user_id + end +end