Browse Source

Bugfixes after e08651ab7f1703742d59c104926f25c77d0c04b2

Dmitry Yu Okunev 1 year ago
parent
commit
f3b5d02b52

+ 4 - 4
app/controllers/people_controller.rb

@@ -17,7 +17,7 @@ class PeopleController < ApplicationController
 	end
 
 	def notset
-		@people = Person.left_outer_joins(:passes).distinct.where('`passes`.`person_id` IS NULL')
+		@people = Person.eager_load(:passes).distinct.where('`passes`.`person_id` IS NULL')
 
 		self.commonindex
 	end
@@ -31,7 +31,7 @@ class PeopleController < ApplicationController
 		if params[:q].nil? or params[:q] == ""
 			@people = Person.preload(:passes).all
 		else
-			@people = Person.preload(:passes).where("fullname LIKE :q", "%#{params[:q]}%")
+			@people = Person.preload(:passes).where("fullname LIKE :q", { :q => "%#{params[:q]}%" })
 		end
 
 		self.commonindex
@@ -64,8 +64,8 @@ class PeopleController < ApplicationController
 		hash = @person.as_json
 
 		if @person.IsManual?
-			patronymic = @person.Patronymic
-			patronymic = @person.Patronymic.gsub('Ё', 'Е').gsub('ё', 'е') unless patronymic.nil?
+			#patronymic = @person.Patronymic
+			#patronymic = @person.Patronymic.gsub('Ё', 'Е').gsub('ё', 'е') unless patronymic.nil?
 			#@availablePasses = Pass.where(:lastname => @person.Lastname.gsub('Ё', 'Е').gsub('ё', 'е'), :firstname => @person.Firstname.gsub('Ё', 'Е').gsub('ё', 'е'), :patronymic => patronymic)
 			##@availablePasses = Pass.where(:lastname => @person.Lastname.gsub('Ё', 'Е').gsub('ё', 'е'), :firstname => @person.Firstname.gsub('Ё', 'Е').gsub('ё', 'е')) if @availablePasses.nil? or @availablePasses.size == 0
 			#@availablePasses = Pass.find_by_sql('SELECT `passes`.* FROM `passes` LEFT JOIN `people` ON `passes`.`person_id` = `people`.`id` WHERE `people`.`id` IS NULL') if @availablePasses.nil? or @availablePasses.size == 0

+ 1 - 1
app/models/person.rb

@@ -45,6 +45,6 @@ class Person < ApplicationRecord
 	end
 
 	def GetKey
-		return "#{self.Fullname}".delete(' ').delete('?').gsub('Ё', 'Е').gsub('ё', 'е').strip
+		return "#{self.fullname}".delete(' ').delete('?').gsub('Ё', 'Е').gsub('ё', 'е').strip
 	end
 end

File diff suppressed because it is too large
+ 1 - 1
app/views/passes/index.html.erb


File diff suppressed because it is too large
+ 2 - 2
app/views/passes/show.html.erb


File diff suppressed because it is too large
+ 1 - 1
app/views/people/index.html.erb


File diff suppressed because it is too large
+ 2 - 2
app/views/people/namesakes.html.erb


File diff suppressed because it is too large
+ 2 - 2
app/views/people/notset.html.erb


+ 2 - 4
app/views/people/show.html.erb

@@ -1,8 +1,6 @@
 <table class='show_person'>
 	<tr><td>Текущая фотография:	</td><td><% if @person.passes.size != 0 %><a href="/people/<%= @person.id %>.jpeg"><img src="/people/<%= @person.id %>.jpeg" width='100px' height='133px'></a><% else %>Соответствие не установлено<% end %></td></tr>
-	<tr><td>Фамилия:		</td><td><%= @person.Lastname %></td></tr>
-	<tr><td>Имя:			</td><td><%= @person.Firstname %></td></tr>
-	<tr><td>Отчество:		</td><td><%= @person.Patronymic %></td></tr>
+	<tr><td>ФИО:			</td><td><%= @person.fullname %></td></tr>
 	<tr><td>Описание:		</td><td><%= @person.Description %></td></tr>
 	<% if @person.IsManual? %>
 		<tr><td>Идентификатор ОФЗ:	</td><td><%= if @person.passes.size == 0 then 'Не определён' else @person.GetPassId end %> — <a href='#edit_PassId' onclick='$("#edit_PassId").css("display", "block");return false'>Исправить</a></td></tr>
@@ -67,7 +65,7 @@
 		</div>
 		<script>
 			$(function(){
-				edit_PassId_filter('<%= @person.Lastname %> <%= @person.Firstname %> <%= @person.Patronymic %>');
+				edit_PassId_filter('<%= @person.fullname %>');
 			})
 		</script>
 	</div>

+ 1 - 0
config/locales/en.yml

@@ -7,3 +7,4 @@ en:
  or: "or"
  number: "number"
  identifier: "ID"
+ q: "search"

+ 1 - 0
config/locales/ru.yml

@@ -7,3 +7,4 @@ ru:
  or: "или"
  number: "число"
  identifier: "идентификатор"
+ q: "поиск"