mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-17 06:52:27 +01:00
fix conflt
This commit is contained in:
commit
6db26e7a19
@ -4,6 +4,11 @@
|
||||
- add json cache for machines, events, trainings
|
||||
- optimise sql query, avoid to N+1
|
||||
|
||||
## v2.2.2 2016 June 23
|
||||
- Fix some bugs: users with uncompleted account (sso imported) won't appear in statistics, in listings and in searches. Moreover, they won't block statistics generation
|
||||
- Fix a bug: unable to display next results in statistics tables
|
||||
- Admin: Category is mandatory when creating a course/workshop (event)
|
||||
|
||||
## v2.2.1 2016 June 22
|
||||
- Fix a bug: field User.merged_at should not be allowed to be mapped in SSO
|
||||
- Fix a bug: integration test "user reservation without plan"
|
||||
|
@ -5,15 +5,28 @@ class API::MembersController < API::ApiController
|
||||
|
||||
def index
|
||||
@requested_attributes = params[:requested_attributes]
|
||||
@members = policy_scope(User)
|
||||
@query = policy_scope(User)
|
||||
|
||||
unless params[:page].nil? and params[:size].nil?
|
||||
@members = @members.page(params[:page].to_i).per(params[:size].to_i)
|
||||
@query = @query.page(params[:page].to_i).per(params[:size].to_i)
|
||||
end
|
||||
|
||||
# remove unmerged profiles from list
|
||||
@members = @query.to_a
|
||||
@members.delete_if { |u| u.need_completion? }
|
||||
end
|
||||
|
||||
def last_subscribed
|
||||
<<<<<<< HEAD
|
||||
@members = User.active.with_role(:member).includes(profile: [:user_avatar]).where('is_allow_contact = true AND confirmed_at IS NOT NULL').order('created_at desc').limit(params[:last])
|
||||
=======
|
||||
@query = User.active.with_role(:member).includes(:profile).where('is_allow_contact = true AND confirmed_at IS NOT NULL').order('created_at desc').limit(params[:last])
|
||||
|
||||
# remove unmerged profiles from list
|
||||
@members = @query.to_a
|
||||
@members.delete_if { |u| u.need_completion? }
|
||||
|
||||
>>>>>>> 9ab28c1df60ab3b3a06b76025dba26d6151aa0ba
|
||||
@requested_attributes = ['profile']
|
||||
render :index
|
||||
end
|
||||
@ -169,7 +182,7 @@ class API::MembersController < API::ApiController
|
||||
order_key = 'users.id'
|
||||
end
|
||||
|
||||
@members = User.includes(:profile, :group, :subscriptions)
|
||||
@query = User.includes(:profile, :group, :subscriptions)
|
||||
.joins(:profile, :group, :roles, 'LEFT JOIN "subscriptions" ON "subscriptions"."user_id" = "users"."id" LEFT JOIN "plans" ON "plans"."id" = "subscriptions"."plan_id"')
|
||||
.where("users.is_active = 'true' AND roles.name = 'member'")
|
||||
.order("#{order_key} #{direction}")
|
||||
@ -177,7 +190,11 @@ class API::MembersController < API::ApiController
|
||||
.per(p[:size])
|
||||
|
||||
# ILIKE => PostgreSQL case-insensitive LIKE
|
||||
@members = @members.where('profiles.first_name ILIKE :search OR profiles.last_name ILIKE :search OR profiles.phone ILIKE :search OR email ILIKE :search OR groups.name ILIKE :search OR plans.base_name ILIKE :search', search: "%#{p[:search]}%") if p[:search].size > 0
|
||||
@query = @query.where('profiles.first_name ILIKE :search OR profiles.last_name ILIKE :search OR profiles.phone ILIKE :search OR email ILIKE :search OR groups.name ILIKE :search OR plans.base_name ILIKE :search', search: "%#{p[:search]}%") if p[:search].size > 0
|
||||
|
||||
# remove unmerged profiles from list
|
||||
@members = @query.to_a
|
||||
@members.delete_if { |u| u.need_completion? }
|
||||
|
||||
@members
|
||||
|
||||
@ -201,6 +218,10 @@ class API::MembersController < API::ApiController
|
||||
end
|
||||
end
|
||||
|
||||
# remove unmerged profiles from list
|
||||
@members = @members.to_a
|
||||
@members.delete_if { |u| u.need_completion? }
|
||||
|
||||
@members
|
||||
end
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
user_is_admin = (current_user and current_user.is_admin?)
|
||||
maxMembers = @members.except(:offset, :limit, :order).count
|
||||
maxMembers = @query.except(:offset, :limit, :order).count
|
||||
|
||||
json.array!(@members) do |member|
|
||||
json.maxMembers maxMembers
|
||||
|
@ -1,4 +1,4 @@
|
||||
maxMembers = @members.except(:offset, :limit, :order).count
|
||||
maxMembers = @query.except(:offset, :limit, :order).count
|
||||
|
||||
json.array!(@members) do |member|
|
||||
json.maxMembers maxMembers
|
||||
|
@ -2,8 +2,8 @@ class CreateUnaccentFunction < ActiveRecord::Migration
|
||||
|
||||
# PostgreSQL only
|
||||
def up
|
||||
execute 'CREATE EXTENSION unaccent;'
|
||||
execute 'CREATE EXTENSION pg_trgm;'
|
||||
execute 'CREATE EXTENSION IF NOT EXISTS unaccent;'
|
||||
execute 'CREATE EXTENSION IF NOT EXISTS pg_trgm;'
|
||||
execute "CREATE OR REPLACE FUNCTION f_unaccent(text)
|
||||
RETURNS text AS
|
||||
$func$
|
||||
|
Loading…
x
Reference in New Issue
Block a user