Open
Conversation
DMips
requested changes
Oct 27, 2017
Contributor
DMips
left a comment
There was a problem hiding this comment.
Hi,
I reviewed your code - let me know if you have any questions or you want me to implement that!
|
|
||
| private | ||
| def assign_organised_badge(project) | ||
| unless project.mentee.badges.timekeeper.any? |
| namespace :award_badge_once do | ||
| desc "TODO" | ||
| task award_organized_badge: :environment do | ||
| @projects = Project.all |
Contributor
There was a problem hiding this comment.
indentation is weird - standard in ruby is 2 spaces
| @@ -0,0 +1,30 @@ | |||
| namespace :award_badge_once do | |||
| desc "TODO" | |||
| @@ -0,0 +1,30 @@ | |||
| namespace :award_badge_once do | |||
| desc "TODO" | |||
| task award_organized_badge: :environment do | |||
Contributor
There was a problem hiding this comment.
how about just organized_badge as award is already in namespace
Contributor
| desc "TODO" | ||
| task award_organized_badge: :environment do | ||
| @projects = Project.all | ||
| @edition = Edition.last |
Contributor
There was a problem hiding this comment.
you can use Project.current_edition which will return all projects from well this edition so no need to declare @edition variable
| @edition = Edition.last | ||
| @projects.each do |project| | ||
| is_organised_flag = true | ||
| @edition.weeks.each do |week| |
Contributor
There was a problem hiding this comment.
instead of @edition use project.edition
And more importantly I'd rather use query for that. You can add migration to link Week with Task model and then do in project loop:
results = project.tasks.joins(:week).group("weeks.id").count -> will return hash with week_id and number of tasks
results.length == 12 -> award badge
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.