commit
e5f899987b
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,4 @@
|
||||
class Forward < ActiveRecord::Base
|
||||
validates_presence_of :from_id, :from_type, :to_id, :to_type
|
||||
belongs_to :from, :polymorphic => true
|
||||
end
|
@ -1,2 +1,3 @@
|
||||
$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'org_subfield_list',
|
||||
:locals => {org_subfield: @org_subfield,all_attachments: @result,sort:@sort,order:@order,org_subfield_attachments:@searched_attach})%>");
|
||||
:locals => {org_subfield: @org_subfield,all_attachments: @result,sort:@sort,order:@order,org_subfield_attachments:@searched_attach})%>");
|
||||
$("#attachment_count").html("<%= @result.count %>");
|
@ -1,5 +0,0 @@
|
||||
class AddIndexToSecdomain < ActiveRecord::Migration
|
||||
def change
|
||||
add_index(:secdomains, :subname, unique: true)
|
||||
end
|
||||
end
|
@ -0,0 +1,15 @@
|
||||
class CreateForwards < ActiveRecord::Migration
|
||||
def up
|
||||
create_table :forwards do|t|
|
||||
t.integer :from_id
|
||||
t.string :from_type
|
||||
t.integer :to_id
|
||||
t.string :to_type
|
||||
t.timestamp :created_at
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
drop_table :forwards
|
||||
end
|
||||
end
|
@ -0,0 +1,38 @@
|
||||
class UpdateOneStudentScore < ActiveRecord::Migration
|
||||
def up
|
||||
student_work_score = StudentWorksScore.where("user_id = 11688 AND student_work_id = 34414").first
|
||||
student_work_score.score = 100
|
||||
student_work_score.save
|
||||
student_works = StudentWork.where("user_id = 6456")
|
||||
student_works.each do |work|
|
||||
unless work.student_works_scores.empty?
|
||||
if work.student_works_scores.where(:reviewer_role => 2).empty?
|
||||
work.teaching_asistant_score = nil
|
||||
else
|
||||
work.teaching_asistant_score = work.student_works_scores.where(:reviewer_role => 2).average(:score).try(:round, 2).to_f
|
||||
end
|
||||
if work.student_works_scores.where(:reviewer_role => 3).empty?
|
||||
work.student_score = nil
|
||||
else
|
||||
work.student_score = work.student_works_scores.where(:reviewer_role => 3).average(:score).try(:round, 2).to_f
|
||||
end
|
||||
end
|
||||
if work.teaching_asistant_score.nil?
|
||||
work.final_score = work.student_score
|
||||
elsif work.student_score.nil?
|
||||
work.final_score = work.teaching_asistant_score
|
||||
else
|
||||
homework = HomeworkCommon.find work.homework_common_id
|
||||
ta_proportion = homework.homework_detail_manual.ta_proportion
|
||||
final_ta_score = BigDecimal.new("#{work.teaching_asistant_score}") * BigDecimal.new("#{ta_proportion}")
|
||||
final_s_score = BigDecimal.new("#{work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
|
||||
final_score = final_ta_score + final_s_score
|
||||
work.final_score = format("%.2f",final_score.to_f)
|
||||
end
|
||||
work.save
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue