commit
						15d5fe127e
					
				@ -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
 | 
				
			||||
@ -0,0 +1,7 @@
 | 
				
			||||
<div class="tabs">
 | 
				
			||||
  <ul>
 | 
				
			||||
    <li><%= link_to '用户', {:action => 'latest_login_users'},   class: "#{current_page?(latest_login_users_path)? 'selected' : nil }" %></li>
 | 
				
			||||
    <li><%= link_to '老师',  {:action => 'latest_login_teachers'},  class: "#{current_page?(latest_login_teachers_path)? 'selected' : nil }" %></li>
 | 
				
			||||
 | 
				
			||||
  </ul>
 | 
				
			||||
</div>
 | 
				
			||||
@ -0,0 +1,84 @@
 | 
				
			||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', :media => 'all' %>
 | 
				
			||||
<h3>
 | 
				
			||||
  <%=l(:label_latest_login_user_list)%>
 | 
				
			||||
</h3>
 | 
				
			||||
<%= render 'tab_users' %>
 | 
				
			||||
 | 
				
			||||
<h3>
 | 
				
			||||
  最近登录老师列表
 | 
				
			||||
</h3>
 | 
				
			||||
<%= form_tag({}, :method => :get) do %>
 | 
				
			||||
    <fieldset>
 | 
				
			||||
      <legend>
 | 
				
			||||
        <%= l(:label_filter_plural) %>
 | 
				
			||||
      </legend>
 | 
				
			||||
      <label style="float:left">开始日期:</label>
 | 
				
			||||
      <%= text_field_tag 'startdate', params[:startdate], :size => 15, :onchange=>"$('#ui-datepicker-div').hide()", :style=>"float:left"%>
 | 
				
			||||
      <%= calendar_for('startdate')%><span style="float: left ">   </span>
 | 
				
			||||
      <label style="float:left">结束日期:</label>
 | 
				
			||||
      <%= text_field_tag 'enddate', params[:enddate], :size => 15, :onchange =>"$('#ui-datepicker-div').hide()", :style=>"float:left"%>
 | 
				
			||||
      <%= calendar_for('enddate')%>  
 | 
				
			||||
      <%= submit_tag l(:button_apply), :class => "small", :name => nil %>
 | 
				
			||||
      <%= link_to l(:button_clear), {:controller => 'admin', :action => 'latest_login_teachers'}, :class => 'icon icon-reload' %>
 | 
				
			||||
    </fieldset>
 | 
				
			||||
<% end %>
 | 
				
			||||
 
 | 
				
			||||
<div class="autoscroll">
 | 
				
			||||
  <table class="list" style="width: 100%;table-layout: fixed">
 | 
				
			||||
    <thead>
 | 
				
			||||
    <tr>
 | 
				
			||||
      <th style="width: 30px;">
 | 
				
			||||
        序号
 | 
				
			||||
      </th>
 | 
				
			||||
      <th style="width: 70px;">
 | 
				
			||||
        登录时间
 | 
				
			||||
      </th>
 | 
				
			||||
      <th style="width: 30px;">
 | 
				
			||||
        用户id
 | 
				
			||||
      </th>
 | 
				
			||||
      <th style="width: 50px;">
 | 
				
			||||
        用户姓名
 | 
				
			||||
      </th>
 | 
				
			||||
      <th style="width: 50px;">
 | 
				
			||||
        用户登录名
 | 
				
			||||
      </th>
 | 
				
			||||
      <th style="width: 50px;">
 | 
				
			||||
        用户身份
 | 
				
			||||
      </th>
 | 
				
			||||
    </tr>
 | 
				
			||||
    </thead>
 | 
				
			||||
    <tbody>
 | 
				
			||||
    <% @count=@page * 30 %>
 | 
				
			||||
    <% for teacher in @teachers do %>
 | 
				
			||||
        <tr>
 | 
				
			||||
          <% @count +=1 %>
 | 
				
			||||
          <td align="center">
 | 
				
			||||
            <%=@count %>
 | 
				
			||||
          </td>
 | 
				
			||||
          <td align="center">
 | 
				
			||||
            <%=format_time(teacher.last_login_on) %>
 | 
				
			||||
          </td>
 | 
				
			||||
          <td align="center">
 | 
				
			||||
            <%=teacher.id %>
 | 
				
			||||
          </td>
 | 
				
			||||
          <td align="center" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<% if teacher.try(:realname) == ' '%><%= teacher.login%><% else %><%=teacher.try(:realname) %><% end %>'>
 | 
				
			||||
            <% if teacher.try(:realname) == ' '%>
 | 
				
			||||
                <%= link_to(teacher.login, user_path(teacher)) %>
 | 
				
			||||
            <% else %>
 | 
				
			||||
                <%= link_to(teacher.try(:realname), user_path(teacher)) %>
 | 
				
			||||
            <% end %>
 | 
				
			||||
          </td>
 | 
				
			||||
          <td align="center">
 | 
				
			||||
            <%=link_to(teacher.login, user_path(teacher)) %>
 | 
				
			||||
          </td>
 | 
				
			||||
          <td align="center">
 | 
				
			||||
            老师
 | 
				
			||||
          </td>
 | 
				
			||||
        </tr>
 | 
				
			||||
    <% end %>
 | 
				
			||||
    </tbody>
 | 
				
			||||
  </table>
 | 
				
			||||
</div>
 | 
				
			||||
<div class="pagination">
 | 
				
			||||
  <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
 | 
				
			||||
</div>
 | 
				
			||||
@ -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})%>");
 | 
				
			||||
$("#attachment_count").html("<%= @result.count %>");
 | 
				
			||||
@ -0,0 +1,6 @@
 | 
				
			||||
$("#ajax-modal").html("<%=escape_javascript(render :partial => 'alert_open_student_works') %>");
 | 
				
			||||
showModal('ajax-modal', '500px');
 | 
				
			||||
$('#ajax-modal').siblings().remove();
 | 
				
			||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
 | 
				
			||||
        "<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
 | 
				
			||||
$('#ajax-modal').parent().css("top","30%").css("left","30%").css("position","fixed").css("border","3px solid #269ac9");
 | 
				
			||||
@ -0,0 +1,7 @@
 | 
				
			||||
<% if @user_activity_id.to_i == -1 %>
 | 
				
			||||
$("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => "users/user_homework_detail",:locals => {:homework_common => @homework, :is_in_course => @is_in_course})%>");
 | 
				
			||||
sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
 | 
				
			||||
<% else %>
 | 
				
			||||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@course_activity}) %>");
 | 
				
			||||
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
 | 
				
			||||
<% end %>
 | 
				
			||||
@ -0,0 +1,15 @@
 | 
				
			||||
<div class="commit-row-info">
 | 
				
			||||
  <% if !user_commit_rep(changeset.author_email).nil? %>
 | 
				
			||||
      <a class="commit-author-link has_tooltip"> <span class="commit-author-name">
 | 
				
			||||
                        <%= image_tag(url_to_avatar(user_commit_rep(changeset.author_email)), :width => "20", :height => "20", :class => "fl portraitRadius mt2 ml4 mr5") %>
 | 
				
			||||
        <%= link_to user_commit_rep(changeset.author_email), user_path(user_commit_rep(changeset.author_email)), :length => 30 %></span></a>提交于
 | 
				
			||||
      <div class="committed_ago">
 | 
				
			||||
        <time class="time_ago js-timeago" title="<%= changeset.created_at %>"><%= time_tag(changeset.created_at) %>前 </time> 
 | 
				
			||||
      </div>
 | 
				
			||||
  <% else %>
 | 
				
			||||
      <span class="commit-author-name"><%= changeset.author_email %></span>提交于
 | 
				
			||||
      <div class="committed_ago">
 | 
				
			||||
        <time class="time_ago js-timeago" title="<%= changeset.created_at %>"><%= time_tag(changeset.created_at) %> 前</time> 
 | 
				
			||||
      </div>
 | 
				
			||||
  <% end %>
 | 
				
			||||
</div>
 | 
				
			||||
@ -0,0 +1,55 @@
 | 
				
			||||
<div class="project_r_h">
 | 
				
			||||
  <div class="fl"><h2 class="project_h2_repository"><%= render :partial => 'breadcrumbs', :locals => {:path => @path, :kind => 'dir', :revision => @rev} %></h2></div>
 | 
				
			||||
</div>
 | 
				
			||||
<!--<script>-->
 | 
				
			||||
<!--//    $(document).ready(function(){-->
 | 
				
			||||
<!--//        $("#changed-files").click(function(){-->
 | 
				
			||||
<!--//            $("#changed-files-detail").toggle();-->
 | 
				
			||||
<!--//        });-->
 | 
				
			||||
<!--//    });-->
 | 
				
			||||
<!--</script>-->
 | 
				
			||||
<div class="showing-changes-info fontGrey2"> Commit <a href="javascript:void()" class="linkGrey3">
 | 
				
			||||
  <%= @commit_details.id %></a><br />
 | 
				
			||||
  <li class="commit js-toggle-container">
 | 
				
			||||
    <%= render :partial => 'commit_details', :locals => {:changeset => @commit_details} %>
 | 
				
			||||
  </li>
 | 
				
			||||
</div>
 | 
				
			||||
<div class="showing-changes-project f14"><%= @commit_details.message %></div>
 | 
				
			||||
<!--<div class="showing-changes-row fontGrey2">Showing <a href="javascript:void()" class="linkGrey3" id="changed-files">3 changed files</a> with <span class="c_green">3 additions</span> and <span class="c_red">3 deletions</span>-->
 | 
				
			||||
  <!--<ol class="mt10" id="changed-files-detail">-->
 | 
				
			||||
    <!--<li><a href="javascript:void()" class="linkGrey3" id="changed-files">app/views/organizations/_org_course_homework.html.erb</a> </li>-->
 | 
				
			||||
    <!--<li><a href="javascript:void()" class="linkGrey3" id="changed-files">app/views/users/_course_homework.html.erb</a> </li>-->
 | 
				
			||||
    <!--<li><a href="javascript:void()" class="linkGrey3" id="changed-files">app/views/users/_user_homework_detail.html.erb</a> </li>-->
 | 
				
			||||
  <!--</ol>-->
 | 
				
			||||
<!--</div>-->
 | 
				
			||||
 | 
				
			||||
<% @commit_diff.each do |cd| %>
 | 
				
			||||
    <div class="showing-changes-row fontGrey2">
 | 
				
			||||
      <a href="javascript:void()" class="linkGrey3" id="changed-files">
 | 
				
			||||
        <img src="/images/vlicon/file.png" width="18" height="20" style="vertical-align:middle;" class="mr5" /><%= cd.new_path %>
 | 
				
			||||
      </a>
 | 
				
			||||
    </div>
 | 
				
			||||
    <div class="autoscroll">
 | 
				
			||||
      <table class="filecontent syntaxhl" style="width:100%;" >
 | 
				
			||||
        <tbody>
 | 
				
			||||
        <% line_num = diff_line_num(cd.diff) %>
 | 
				
			||||
        <% diff_content = diff_content(cd.diff) %>
 | 
				
			||||
        <% syntax_highlight_lines(cd.new_path, Redmine::CodesetUtil.to_utf8_by_setting(diff_content)).each do |line| %>
 | 
				
			||||
            <tr>
 | 
				
			||||
              <th class="line-num" id="L<%= line_num %>" style="vertical-align: top;">
 | 
				
			||||
                <a href="#L<%= line_num %>" style="padding-top: 0px;"><%= line_num %></a>
 | 
				
			||||
              </th>
 | 
				
			||||
              <% if line[0,1] == "-" %>
 | 
				
			||||
                  <td class="line-code diff_out"><pre style="width:auto;white-space: nowrap; "><%= line.html_safe %></pre></td>
 | 
				
			||||
              <% elsif line[0,1] == "+" %>
 | 
				
			||||
                  <td class="line-code diff_in"><pre style="width:auto;white-space: nowrap; "><%= line.html_safe %></pre></td>
 | 
				
			||||
              <% else%>
 | 
				
			||||
                  <td class="line-code"><pre style="width:auto;white-space: nowrap; "><%= line.html_safe %></pre></td>
 | 
				
			||||
              <% end %>
 | 
				
			||||
            </tr>
 | 
				
			||||
            <% line_num += 1 %>
 | 
				
			||||
        <% end %>
 | 
				
			||||
        </tbody>
 | 
				
			||||
      </table>
 | 
				
			||||
    </div>
 | 
				
			||||
<% end %>
 | 
				
			||||
@ -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
 | 
				
			||||
@ -0,0 +1,5 @@
 | 
				
			||||
class AddIsOpenToHomewrokCommon < ActiveRecord::Migration
 | 
				
			||||
  def change
 | 
				
			||||
    add_column :homework_commons, :is_open, :integer, :default => 0
 | 
				
			||||
  end
 | 
				
			||||
end
 | 
				
			||||
											
												
													File diff suppressed because it is too large
													Load Diff
												
											
										
									
								| 
		 After Width: | Height: | Size: 1.1 KiB  | 
					Loading…
					
					
				
		Reference in new issue