|
- <% define_admin_breadcrumbs do %>
- <% add_admin_breadcrumb('项目排行榜', admins_path) %>
- <% end %>
-
-
- <div class="box search-form-container user-list-form">
- <%= form_tag(admins_projects_rank_index_path, method: :get, class: 'form-inline search-form flex-1', id: 'project-rank-date-form') do %>
- <div class="form-group mr-2">
- <label for="status">日期:</label>
- <% dates_array = (0..30).to_a.map { |item| [(Date.today-item.days).to_s, (Date.today-item.days).to_s] } %>
- <%= select_tag(:date, options_for_select(dates_array, params[:date]), class:"form-control",id: "project-rank-date-select")%>
- </div>
- <% end %>
-
- </div>
-
- <div class="box admin-list-container project-language-list-container">
- <table class="table table-hover text-center subject-list-table">
- <thead class="thead-light">
- <tr>
- <th width="20%">排名</th>
- <th width="30%">项目</th>
- <th width="10%">得分</th>
- <th width="10%">访问数</th>
- <th width="10%">关注数</th>
- <th width="10%">点赞数</th>
- <th width="10%">fork数</th>
- <th width="10%">疑修数</th>
- <th width="10%">合并请求数</th>
- <th width="10%">提交数</th>
- </tr>
- </thead>
- <tbody>
- <% @date_rank.each_with_index do |item, index| %>
- <tr class="">
- <td><%= index + 1%></td>
- <% project_common = $redis_cache.hgetall("v2-project-common:#{item[0]}") %>
- <% owner_common = $redis_cache.hgetall("v2-owner-common:#{project_common["owner_id"]}")%>
- <td>
- <a href="/<%= owner_common["login"] %>/<%= project_common["identifier"]%>">
- <%= "#{owner_common["name"]}/#{project_common["name"]}" %>
- </a>
- </td>
-
- <td><%= item[1] %></td>
- <% project_date_statistic_key = "v2-project-statistic:#{item[0]}-#{@rank_date}"%>
- <% if $redis_cache.exists(project_date_statistic_key)%>
- <% visits = $redis_cache.hget(project_date_statistic_key, "visits") %>
- <td><%= visits || 0 %></td>
- <% watchers = $redis_cache.hget(project_date_statistic_key, "watchers") %>
- <td><%= watchers || 0 %></td>
- <% praises = $redis_cache.hget(project_date_statistic_key, "praises") %>
- <td><%= praises || 0 %></td>
- <% forks = $redis_cache.hget(project_date_statistic_key, "forks") %>
- <td><%= forks || 0 %></td>
- <% issues = $redis_cache.hget(project_date_statistic_key, "issues") %>
- <td><%= issues || 0 %></td>
- <% pullrequests = $redis_cache.hget(project_date_statistic_key, "pullrequests") %>
- <td><%= pullrequests || 0 %></td>
- <% commits = $redis_cache.hget(project_date_statistic_key, "commits") %>
- <td><%= commits || 0 %></td>
- <% else %>
- <td colspan="7">暂无数据</td>
- <% end %>
- </tr>
- <% end %>
- </tbody>
- </table>
- </div>
- <script>
- $("#project-rank-date-select").on('change', function() {
- $("#project-rank-date-form").submit()
- });
- </script>
|