Merge pull request #3843 from consul/remove_unused_code

Remove unused code
This commit is contained in:
Javier Martín
2019-11-10 01:04:42 +01:00
committed by GitHub
12 changed files with 0 additions and 145 deletions

View File

@@ -1,12 +1,4 @@
class Admin::SettingsController < Admin::BaseController
include Admin::ManagesProposalSettings
helper_method :successful_proposal_setting, :successful_proposals,
:poll_feature_short_title_setting, :poll_feature_description_setting,
:poll_feature_link_setting, :email_feature_short_title_setting,
:email_feature_description_setting,
:poster_feature_short_title_setting, :poster_feature_description_setting
def index
all_settings = Setting.all.group_by(&:type)
@configuration_settings = all_settings["configuration"]

View File

@@ -1,9 +0,0 @@
class Admin::Widget::BaseController < Admin::BaseController
helper_method :namespace
private
def namespace
"admin"
end
end

View File

@@ -1,41 +0,0 @@
module Admin::ManagesProposalSettings
extend ActiveSupport::Concern
included do
def successful_proposal_setting
@successful_proposal_setting ||= Setting.find_by(key: "proposals.successful_proposal_id")
end
def successful_proposals
Proposal.successful
end
def poll_feature_short_title_setting
@poll_feature_short_title_setting ||= Setting.find_by(key: "proposals.poll_short_title")
end
def poll_feature_description_setting
@poll_feature_description_setting ||= Setting.find_by(key: "proposals.poll_description")
end
def poll_feature_link_setting
@poll_feature_link_setting ||= Setting.find_by(key: "proposals.poll_link")
end
def email_feature_short_title_setting
@email_feature_short_title_setting ||= Setting.find_by(key: "proposals.email_short_title")
end
def email_feature_description_setting
@email_feature_description_setting ||= Setting.find_by(key: "proposals.email_description")
end
def poster_feature_short_title_setting
@poster_feature_short_title_setting ||= Setting.find_by(key: "proposals.poster_short_title")
end
def poster_feature_description_setting
@poster_feature_description_setting ||= Setting.find_by(key: "proposals.poster_description")
end
end
end

View File

@@ -39,17 +39,6 @@ module Dashboard::GroupSupports
complete_grouped_votes
end
def previous_key_for(date)
grouping_key_for(date - interval)
end
def interval
return 1.week if params[:group_by] == "week"
return 1.month if params[:group_by] == "month"
1.day
end
end
private

View File

@@ -1,12 +1,4 @@
module ApplicationHelper
def home_page?
return false if user_signed_in?
# Using path because fullpath yields false negatives since it contains
# parameters too
request.path == "/"
end
# if current path is /debates current_path_with_query_params(foo: "bar") returns /debates?foo=bar
# notice: if query_params have a param which also exist in current path,
# it "overrides" (query_params is merged last)

View File

@@ -11,10 +11,6 @@ module DocumentsHelper
bytes / Numeric::MEGABYTE
end
def document_nested_field_wrapper_id(index)
"document_#{index}"
end
def render_destroy_document_link(builder, document)
if !document.persisted? && document.cached_attachment.present?
link_to t("documents.form.delete_button"),

View File

@@ -3,10 +3,6 @@ module ImageablesHelper
imageable.image.present? && can?(:destroy, imageable.image)
end
def imageable_class(imageable)
imageable.class.name.parameterize(separator: "_")
end
def imageable_max_file_size
bytes_to_megabytes(Setting["uploads.images.max_size"].to_i.megabytes)
end

View File

@@ -17,10 +17,6 @@ module ImagesHelper
image.errors[:attachment].join(", ") if image.errors.key?(:attachment)
end
def image_bytes_to_megabytes(bytes)
bytes / Numeric::MEGABYTE
end
def image_class(image)
image.persisted? ? "persisted-image" : "cached-image"
end

View File

@@ -1,8 +1,4 @@
module OfficersHelper
def officer_label(officer)
truncate([officer.name, officer.email].compact.join(" - "), length: 100)
end
def vote_collection_shift?
current_user.poll_officer.officer_assignments.voting_days.where(date: Time.current.to_date).any?
end

View File

@@ -19,22 +19,6 @@ module PollsHelper
end
end
def poll_dates_select_options(poll)
options = []
(poll.starts_at.to_date..poll.ends_at.to_date).each do |date|
options << [l(date, format: :long), l(date)]
end
options_for_select(options, params[:d])
end
def poll_booths_select_options(poll)
options = []
poll.booths.each do |booth|
options << [booth_name_with_location(booth), booth.id]
end
options_for_select(options)
end
def booth_name_with_location(booth)
location = booth.location.blank? ? "" : " (#{booth.location})"
booth.name + location

View File

@@ -1,11 +0,0 @@
class AdministratorTask < ApplicationRecord
belongs_to :source, polymorphic: true
belongs_to :user
validates :source, presence: true
default_scope { order(created_at: :asc) }
scope :pending, -> { where(executed_at: nil) }
scope :done, -> { where.not(executed_at: nil) }
end

View File

@@ -43,30 +43,5 @@ class Poll
def set_denormalized_booth_assignment_id
self.booth_assignment_id ||= officer_assignment&.booth_assignment_id
end
def in_census?
census_api_response.valid?
end
def census_api_response
@census_api_response ||= CensusCaller.new.call(document_type, document_number)
end
def fill_stats_fields
if in_census?
self.gender = census_api_response.gender
self.geozone_id = Geozone.select(:id).find_by(census_code: census_api_response.district_code)&.id
self.age = voter_age(census_api_response.date_of_birth)
end
end
def voter_age(dob)
if dob.blank?
nil
else
now = Date.current
now.year - dob.year - (now.month > dob.month || (now.month == dob.month && now.day >= dob.day) ? 0 : 1)
end
end
end
end