mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-06 21:24:23 +08:00
Fixed Hound alerts.
This commit is contained in:
parent
778ed8814b
commit
5966911b92
6 changed files with 29 additions and 26 deletions
|
@ -3,6 +3,7 @@ AllCops:
|
|||
- "vendor/**/*"
|
||||
- "db/schema.rb"
|
||||
UseCache: false
|
||||
TargetRubyVersion: 2.2
|
||||
|
||||
##################### Style ####################################
|
||||
|
||||
|
|
|
@ -119,8 +119,8 @@ class Users::SettingsController < ApplicationController
|
|||
def search_organization_users
|
||||
respond_to do |format|
|
||||
format.json {
|
||||
if params.include? :existing_query and
|
||||
query = params[:existing_query].strip()
|
||||
if params.include?(:existing_query) && params[:existing_query].strip
|
||||
query = params[:existing_query].strip
|
||||
if query.length < Constants::NAME_MIN_LENGTH
|
||||
render json: {
|
||||
"existing_query": [
|
||||
|
|
|
@ -10,7 +10,9 @@ class Asset < ActiveRecord::Base
|
|||
|
||||
validates_attachment :file,
|
||||
presence: true,
|
||||
size: { less_than: Constants::FILE_MAX_SIZE_MB.megabytes }
|
||||
size: {
|
||||
less_than: Constants::FILE_MAX_SIZE_MB.megabytes
|
||||
}
|
||||
validates :estimated_size, presence: true
|
||||
validates :file_present, inclusion: { in: [true, false] }
|
||||
|
||||
|
@ -123,8 +125,8 @@ class Asset < ActiveRecord::Base
|
|||
# Show all results if needed
|
||||
if page != Constants::SEARCH_NO_LIMIT
|
||||
ids = ids
|
||||
.limit(Constants::SEARCH_LIMIT)
|
||||
.offset((page - 1) * Constants::SEARCH_LIMIT)
|
||||
.limit(Constants::SEARCH_LIMIT)
|
||||
.offset((page - 1) * Constants::SEARCH_LIMIT)
|
||||
end
|
||||
|
||||
Asset
|
||||
|
@ -237,7 +239,7 @@ class Asset < ActiveRecord::Base
|
|||
es += get_octet_length_record(asset_text_datum, :data)
|
||||
es += get_octet_length_record(asset_text_datum, :data_vector)
|
||||
end
|
||||
es = es * Constants::ASSET_ESTIMATED_SIZE_FACTOR
|
||||
es *= Constants::ASSET_ESTIMATED_SIZE_FACTOR
|
||||
update(estimated_size: es)
|
||||
Rails.logger.info "Asset #{id}: Estimated size successfully calculated"
|
||||
|
||||
|
|
|
@ -74,14 +74,14 @@ class Comment < ActiveRecord::Base
|
|||
a_query
|
||||
)
|
||||
|
||||
# Show all results if needed
|
||||
if page == Constants::SEARCH_NO_LIMIT
|
||||
new_query
|
||||
else
|
||||
new_query
|
||||
.limit(Constants::SEARCH_LIMIT)
|
||||
.offset((page - 1) * Constants::SEARCH_LIMIT)
|
||||
end
|
||||
# Show all results if needed
|
||||
if page == Constants::SEARCH_NO_LIMIT
|
||||
new_query
|
||||
else
|
||||
new_query
|
||||
.limit(Constants::SEARCH_LIMIT)
|
||||
.offset((page - 1) * Constants::SEARCH_LIMIT)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -36,8 +36,8 @@ class Experiment < ActiveRecord::Base
|
|||
def self.search(user, include_archived, query = nil, page = 1)
|
||||
project_ids =
|
||||
Project
|
||||
.search(user, include_archived, nil, Constants::SEARCH_NO_LIMIT)
|
||||
.select("id")
|
||||
.search(user, include_archived, nil, Constants::SEARCH_NO_LIMIT)
|
||||
.select('id')
|
||||
|
||||
if query
|
||||
a_query = query.strip
|
||||
|
@ -67,8 +67,8 @@ class Experiment < ActiveRecord::Base
|
|||
new_query
|
||||
else
|
||||
new_query
|
||||
.limit(Constants::SEARCH_LIMIT)
|
||||
.offset((page - 1) * Constants::SEARCH_LIMIT)
|
||||
.limit(Constants::SEARCH_LIMIT)
|
||||
.offset((page - 1) * Constants::SEARCH_LIMIT)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -60,14 +60,14 @@ class Sample < ActiveRecord::Base
|
|||
a_query
|
||||
)
|
||||
|
||||
# Show all results if needed
|
||||
if page == Constants::SEARCH_NO_LIMIT
|
||||
new_query
|
||||
else
|
||||
new_query
|
||||
.limit(Constants::SEARCH_LIMIT)
|
||||
.offset((page - 1) * Constants::SEARCH_LIMIT)
|
||||
end
|
||||
# Show all results if needed
|
||||
if page == Constants::SEARCH_NO_LIMIT
|
||||
new_query
|
||||
else
|
||||
new_query
|
||||
.limit(Constants::SEARCH_LIMIT)
|
||||
.offset((page - 1) * Constants::SEARCH_LIMIT)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue