-
-
Save JacobNinja/5267561 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CommitScore | |
ScoreValue = Struct.new(:email, :score) | |
def initialize(commit_values) | |
@commit_values = commit_values | |
end | |
def score | |
grouped_commits_by_email.map {|(email, commits) score_value(email, commits) } | |
end | |
private | |
def grouped_commits_by_email | |
@commit_values.group_by(&:email) | |
end | |
def score_value(email, commits) | |
ScoreValue.new(email, score_commits(commits)) | |
end | |
def score_commits(commits) | |
commits.map {|c| score_date(c.committed_date) }.reduce(:+) | |
end | |
def score_date(date) | |
# algo | |
1 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment