Skip to content

Instantly share code, notes, and snippets.

@Jimgerneer
Last active December 15, 2015 13:19
Show Gist options
  • Save Jimgerneer/5266812 to your computer and use it in GitHub Desktop.
Save Jimgerneer/5266812 to your computer and use it in GitHub Desktop.
Fail sauce
class Canoe
class CommitValue < Struct.new(:email, :committed_date); end
def self.weight(commit_values)
sorted_by_email_list = commit_values.group_by(&:email)
scored_by = sorted_by_email_list.each_with_object({}) do |(email, commit), hsh|
hsh[email] = sorted_by_email_list[email].count
hsh
end.sort {|(k1,v1), (k2,v2)| v2 <=> v1 }
scored_by_timeliness = sorted_by_email_list.each_with_object({}) do |(email, commits), hsh|
hsh[email] = timeliness_score_for(commits)
hsh
end.sort {|(k1,v1), (k2,v2)| v2 <=> v1 }
binding.pry
end
def self.timeliness_score_for(commits)
commits.reduce(0) {|acc, commit| date_relevance_function(commit.committed_date) }
end
@JacobNinja
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment