Skip to content

Commit

Permalink
Clean up comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nimmolo committed Jan 5, 2024
1 parent 426cae6 commit 1316758
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 24 deletions.
8 changes: 3 additions & 5 deletions app/controllers/observations/namings/votes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ class VotesController < ApplicationController
# Index breakdown of votes for a given naming.
# Linked from: observations/show
# Displayed on show obs via popup for JS users.
# Has its own route for non-js.
# Inputs: params[:naming_id] (naming)
# Outputs: @naming
# Has its own route for non-js access and testing.
# Inputs: params[:naming_id], [:observation_id]
# Outputs: @naming, @consensus
def index
pass_query_params
@naming = find_or_goto_index(Naming, params[:naming_id].to_s)
Expand Down Expand Up @@ -72,8 +72,6 @@ def create_or_update_vote
value = Vote.validate_value(value_str)
raise("Bad value.") unless value

# N+1: Take the whole vote object and send it to change vote?
# Or how about returning obs.reload from observation.change_vote
@consensus = ::Observation::NamingConsensus.new(observation)
@consensus.change_vote(@naming, value, @user) # 2nd load (namings.reload)
@observation = load_observation_naming_includes # 3rd load
Expand Down
1 change: 0 additions & 1 deletion app/controllers/species_lists/shared_private_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ module SharedPrivateMethods
############################################################################

def find_species_list!
# find_or_goto_index(SpeciesList, params[:id].to_s)
SpeciesList.show_includes.safe_find(params[:id].to_s) ||
flash_error_and_goto_index(SpeciesList, params[:id].to_s)
end
Expand Down
5 changes: 2 additions & 3 deletions app/helpers/namings_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ def observation_namings_table_rows(consensus)
end

# NEW - needs a current consensus object
# N+1: obs.consensus_naming and observation.owners_favorite?
def naming_row_content(consensus, naming)
vote = consensus.users_vote(naming, User.current) || Vote.new(value: 0)
consensus_favorite = consensus.consensus_naming
Expand Down Expand Up @@ -389,15 +388,15 @@ def propose_naming_link(obs_id, text: :create_naming.t,
end

# N+1: can't move the calculation of observation.image_ids
# must query obs includes images, don't update table-footer
# must query obs includes images, so don't update table-footer
def suggest_namings_link(obs)
localizations = {
processing_images: :suggestions_processing_images.t,
processing_image: :suggestions_processing_image.t,
processing_results: :suggestions_processing_results.t,
error: :suggestions_error.t
}.to_json
# NOTE: it does not actually commit to this path.
# NOTE: suggestions does not actually commit to this path, it's a js request
results_url = add_query_param(
naming_suggestions_for_observation_path(id: obs.id, names: :xxx)
)
Expand Down
15 changes: 0 additions & 15 deletions app/models/vote.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,6 @@
# contained within a single Naming or not.
# Vote is responsible for very little except holding the value.
#
# NC#change_vote:: Change a User's Vote for a given Naming.
# NC#calc_consensus:: Decide which Name is winner for an Observation.
# NC#owners_favorite?:: Is a given Naming the Observation owner's
# favorite?
# NC#users_favorite?:: Is a given Naming the given User's
# favorite?
# NC#refresh_vote_cache:: Refresh vote cache for all Observation's.
#
# Naming#vote_sum:: Straight sum of Vote's for this Naming (tests)
# NC#user_voted?:: Has a given User voted for this Naming?
# NC#users_vote:: Get a given User's Vote for this Naming.
# NC#vote_percent:: Convert score for this Naming into a percentage.
# NC#users_favorite?:: Is this Naming the given User's favorite?
# NC#calc_vote_table:: Gather Vote info for this Naming.
#
# == Attributes
#
# id:: Locally unique numerical id, starting at 1.
Expand Down

0 comments on commit 1316758

Please sign in to comment.