parent
36fecfc635
commit
09eae9e253
|
@ -210,4 +210,29 @@ module CoursesHelper
|
|||
teacher_stars = homework.rates(:quality).where("rater_id = #{member.user_id}").select("stars").first
|
||||
return format("%.2f",teacher_stars == nil ? 0 : teacher_stars.stars)
|
||||
end
|
||||
|
||||
def project_score project
|
||||
issue_count = project.issues.count
|
||||
issue_journal_count = project.issue_changes.count
|
||||
issue_score = issue_count * 0.2
|
||||
issue_journal_score = issue_journal_count * 0.1
|
||||
finall_issue_score = issue_score + issue_journal_score
|
||||
new_count = project.news.count
|
||||
new_score = new_count * 0.1
|
||||
finall_new_score = new_score
|
||||
document_count = project.documents.count
|
||||
file_score = document_count * 0.1
|
||||
finall_file_score = file_score
|
||||
changeset_count = project.changesets.count
|
||||
code_submit_score = changeset_count * 0.3
|
||||
finall_code_submit_score = code_submit_score
|
||||
board_message_count = 0
|
||||
project.boards.each do |board|
|
||||
board_message_count += board.messages_count
|
||||
end
|
||||
topic_score = board_message_count * 0.1
|
||||
#finall_topic_score = topic_score
|
||||
finall_project_score = finall_issue_score + finall_new_score + finall_file_score + finall_code_submit_score + topic_score
|
||||
format("%.2f",finall_project_score)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
@bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',5, 10, 7)).size >0) && cur_user_homework_for_bid(@bid).count == 0 %>
|
||||
<div class='icon icon-add'>
|
||||
<%#= link_to l(:label_commit_homework), new_submit_homework_path, :onclick => "$('#put-bid-form').slideToggle(); this.blur(); return false;" %>
|
||||
<%= link_to l(:label_course_new_homework),new_homework_attach_path %>
|
||||
<%= link_to l(:label_course_new_homework),new_homework_attach_path %><strong style="color: #a9a9a9"> (每一个作业都可以是一个精美的作品)</strong>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
|
|
@ -14,12 +14,14 @@
|
|||
(Rails.env.development?) %>
|
||||
</td>
|
||||
<td align="right">
|
||||
<div class="project-search">
|
||||
<% if is_teacher %>
|
||||
<%= text_field_tag 'student_id', params[:student_id], :size => 30 %>
|
||||
<%= submit_tag l(:label_search_by_student_id), :class => "small", :name => nil %>
|
||||
<% end %>
|
||||
</div></td>
|
||||
<div class="project-search">
|
||||
<% if is_teacher %>
|
||||
<%= text_field_tag 'student_id', params[:student_id], :size => 30 %>
|
||||
<%= submit_tag l(:label_search_by_student_id), :class => "small", :name => nil %>
|
||||
<% end %>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
@ -92,22 +94,23 @@
|
|||
|
||||
<tr>
|
||||
<td>
|
||||
<strong>开发项目:</strong>
|
||||
<% if homework.project != nil %>
|
||||
<%= link_to homework.project.name,project_path(homework.project.id)%>
|
||||
<% else %>
|
||||
暂无
|
||||
<% end %>
|
||||
<strong>开发项目</strong>:
|
||||
<% if homework.project != nil %>
|
||||
<%= link_to homework.project.name,project_path(homework.project.id)%>
|
||||
<% else %>
|
||||
暂无
|
||||
<% end %>
|
||||
</td>
|
||||
<td>
|
||||
<strong>项目得分:</strong>
|
||||
<strong>项目得分:
|
||||
<span style="color: #EC6300;">
|
||||
<% if homework.project != nil %>
|
||||
0
|
||||
<%= project_score homework.project %>
|
||||
<% else %>
|
||||
0
|
||||
0.00
|
||||
<% end %>
|
||||
</span>
|
||||
</strong>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
|
Loading…
Reference in New Issue