Merge branch 'forge' of http://bdgit.educoder.net/Hjqreturn/educoder into forge
commit
3e7c7ec230
@ -0,0 +1,35 @@
|
|||||||
|
class Admins::AboutsController < Admins::BaseController
|
||||||
|
|
||||||
|
def index
|
||||||
|
projects = Project.all.project_statics_select
|
||||||
|
by_time = params[:time]
|
||||||
|
project_type = params[:project_type]
|
||||||
|
is_private = params[:is_private]
|
||||||
|
project_category_id = params[:project_category_id]
|
||||||
|
project_language_id = params[:project_language_id]
|
||||||
|
license_id = params[:license_id]
|
||||||
|
|
||||||
|
projects = projects.where(project_type: project_type) if project_type.present?
|
||||||
|
projects = projects.where(is_private: is_private) if is_private.present?
|
||||||
|
projects = projects.where(project_category_id: project_category_id) if project_category_id.present?
|
||||||
|
projects = projects.where(project_language_id: project_language_id) if project_language_id.present?
|
||||||
|
projects = projects.where(license_id: license_id) if license_id.present?
|
||||||
|
|
||||||
|
if by_time.present?
|
||||||
|
case by_time.to_s
|
||||||
|
when "week"
|
||||||
|
projects = projects.group_by_week(:created_on).count
|
||||||
|
when "month"
|
||||||
|
projects = projects.group_by_month(:created_on).count
|
||||||
|
when "quarter"
|
||||||
|
projects = projects.group_by_month(:created_on).count
|
||||||
|
when "year"
|
||||||
|
projects = projects.group_by_year(:created_on).count
|
||||||
|
else
|
||||||
|
projects = projects.group_by_day(:created_on).count
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@projects = projects
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
@ -0,0 +1 @@
|
|||||||
|
<%= @projects %>
|
@ -0,0 +1,16 @@
|
|||||||
|
# encoding: UTF-8
|
||||||
|
class AddIssuePriosityToTable < ActiveRecord::Migration[5.2]
|
||||||
|
#本地需要修改,线上不用修改
|
||||||
|
# def change
|
||||||
|
# create_table :issue_priorities do |t|
|
||||||
|
# t.string :name, charset: :utf8
|
||||||
|
# t.integer :position
|
||||||
|
# t.timestamps
|
||||||
|
# end
|
||||||
|
# name = %w(低 正常 高 紧急 立刻)
|
||||||
|
# position = %w(1 2 3 4 5)
|
||||||
|
# name.each_with_index do |n, index|
|
||||||
|
# IssuePriority.create!(name:n.to_s, position: position[index])
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
end
|
Loading…
Reference in new issue