Skip to content

Commit

Permalink
Merge pull request #3843 from consul/remove_unused_code
Browse files Browse the repository at this point in the history
Remove unused code
  • Loading branch information
javierm committed Nov 10, 2019
2 parents b22ba4a + 216d9e6 commit 83e97cb
Show file tree
Hide file tree
Showing 12 changed files with 0 additions and 145 deletions.
8 changes: 0 additions & 8 deletions app/controllers/admin/settings_controller.rb
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down
9 changes: 0 additions & 9 deletions app/controllers/admin/widget/base_controller.rb

This file was deleted.

41 changes: 0 additions & 41 deletions app/controllers/concerns/admin/manages_proposal_settings.rb

This file was deleted.

11 changes: 0 additions & 11 deletions app/controllers/concerns/dashboard/group_supports.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,6 @@ def fill_holes(grouped_votes)

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
Expand Down
8 changes: 0 additions & 8 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
4 changes: 0 additions & 4 deletions app/helpers/documents_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ def bytes_to_mega(bytes)
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"),
Expand Down
4 changes: 0 additions & 4 deletions app/helpers/imageables_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ def can_destroy_image?(imageable)
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
Expand Down
4 changes: 0 additions & 4 deletions app/helpers/images_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ def image_errors_on_attachment(image)
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
Expand Down
4 changes: 0 additions & 4 deletions app/helpers/officers_helper.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down
16 changes: 0 additions & 16 deletions app/helpers/polls_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,6 @@ def poll_dates(poll)
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
Expand Down
11 changes: 0 additions & 11 deletions app/models/administrator_task.rb

This file was deleted.

25 changes: 0 additions & 25 deletions app/models/poll/voter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,30 +43,5 @@ def set_document_info
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

0 comments on commit 83e97cb

Please sign in to comment.