mirror of
https://github.com/ENSL/ensl.org.git
synced 2025-01-13 21:31:28 +00:00
Fix teams and weeks
This commit is contained in:
parent
772d9f0f15
commit
420930f2b9
6 changed files with 7 additions and 5 deletions
|
@ -20,7 +20,7 @@ MYSQL_DATABASE=ensl
|
|||
MYSQL_USERNAME=ensl
|
||||
MYSQL_PASSWORD=ensl
|
||||
MYSQL_ROOT_PASSWORD=ensl
|
||||
MYSQL_CONNECTION_POOL=8
|
||||
MYSQL_CONNECTION_POOL=32
|
||||
|
||||
NEW_RELIC_APP_NAME=ENSL
|
||||
NEW_RELIC_LICENSE_KEY=
|
||||
|
|
|
@ -39,6 +39,7 @@ class TeamsController < ApplicationController
|
|||
def update
|
||||
raise AccessError unless @team.can_update? cuser
|
||||
if @team.update_attributes(Team.params(params, cuser))
|
||||
# FIXME: move this logic to model
|
||||
if params[:rank]
|
||||
@team.teamers.present.each do |member|
|
||||
# Contains new rank as given by submitted parameters
|
||||
|
|
|
@ -12,7 +12,7 @@ class WeeksController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
@week = Week.new(Weeks.params(params, cuser))
|
||||
@week = Week.new(Week.params(params, cuser))
|
||||
raise AccessError unless @week.can_create? cuser
|
||||
|
||||
if @week.save
|
||||
|
|
|
@ -54,7 +54,8 @@ class Article < ActiveRecord::Base
|
|||
scope :nodrafts, -> { where(status: STATUS_PUBLISHED) }
|
||||
scope :drafts, -> { where(status: STATUS_DRAFT) }
|
||||
scope :articles, -> { where(["category_id IN (SELECT id FROM categories WHERE domain = ?)", Category::DOMAIN_ARTICLES]) }
|
||||
scope :onlynews, -> { where(category_id: Category.select(:id).where.not(domain: Category::DOMAIN_NEWS)) }
|
||||
# FIXME: shorter
|
||||
scope :onlynews, -> { where(category_id: Category.select(:id).where(domain: Category::DOMAIN_NEWS)) }
|
||||
scope :category, -> (cat) { where(category_id: cat) }
|
||||
scope :domain, -> (domain) { includes(:category).where("categories.domain = '?'", domain) }
|
||||
#scope :nospecial, -> { where("category_id != ?", Category::SPECIAL) }
|
||||
|
|
|
@ -133,6 +133,6 @@ class Team < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def self.params(params, cuser)
|
||||
params.require(:team).except(:id, :active, :founder_id, :created_at, :updated_at).permit!
|
||||
params.permit(:team).except(:id, :active, :founder_id, :created_at, :updated_at).permit!
|
||||
end
|
||||
end
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
<%= link_to 'Scheduled Matches', confirmed_matches_path(@contest), class: 'button' %>
|
||||
|
||||
<% if cuser and cuser.admin? %>
|
||||
<% if @contest.can_update?(cuser) %>
|
||||
<%= link_to 'Edit Contest', edit_contest_path(@contest), class: 'button' %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue