Skip to content

Commit

Permalink
fix: CodeClimate 2.0 fixes (#374)
Browse files Browse the repository at this point in the history
* Codeclimate part 1

* Method complexity threshold 5->7

* Codeclimate style fixes
  • Loading branch information
peterkos authored Sep 21, 2020
1 parent eae9926 commit 746bbfc
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 12 deletions.
4 changes: 4 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
version: "2"
checks:
method-complexity:
config:
threshold: 7
plugins:
rubocop:
enabled: true
Expand Down
1 change: 0 additions & 1 deletion app/controllers/manage/configs_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,4 @@ def get_config
@config.value = HackathonConfig[var]
end
end

end
1 change: 0 additions & 1 deletion app/controllers/manage/stats_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@ def mlh_applied_datatable
def mlh_checked_in_datatable
render json: MLHCheckedInDatatable.new(params, view_context: view_context)
end

end
1 change: 1 addition & 0 deletions app/controllers/manage/trackable_events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def limit_write_access_to_directors
# If the user isn't a director, scope changes only to those they created
def scope_organizer_access
return if current_user.director? || @trackable_event.blank? || @trackable_event.user.blank?

redirect_to manage_trackable_events_path, notice: 'You may not view events you did not create.' if @trackable_event.user != current_user
end
end
1 change: 1 addition & 0 deletions app/controllers/questionnaires_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def create
return redirect_to questionnaires_path, notice: 'Application already exists.'
end
return unless HackathonConfig['accepting_questionnaires']

@questionnaire = Questionnaire.new(convert_school_name_to_id(questionnaire_params))
@questionnaire.user_id = current_user.id

Expand Down
21 changes: 11 additions & 10 deletions app/models/questionnaire.rb
Original file line number Diff line number Diff line change
Expand Up @@ -258,16 +258,17 @@ def queue_triggered_email_create
end

def queue_triggered_email_rsvp_reminder
if saved_change_to_acc_status? && acc_status == "accepted"
days_remaining = Date.parse(HackathonConfig["event_start_date"]).in_time_zone.to_date - Time.now.in_time_zone.to_date
if days_remaining > 14
deliver_date = 7.days.from_now
elsif days_remaining > 10
deliver_date = 5.days.from_now
elsif days_remaining > 3
deliver_date = 2.days.from_now
end
UserMailer.rsvp_reminder_email(user_id).deliver_later(wait_until: deliver_date) if deliver_date.present?
return unless saved_change_to_acc_status? && acc_status == "accepted"

event_start = Date.parse(HackathonConfig["event_start_date"]).in_time_zone
days_remaining = event_start.to_date - Time.now.in_time_zone.to_date
if days_remaining > 14
deliver_date = 7.days.from_now
elsif days_remaining > 10
deliver_date = 5.days.from_now
elsif days_remaining > 3
deliver_date = 2.days.from_now
end
UserMailer.rsvp_reminder_email(user_id).deliver_later(wait_until: deliver_date) if deliver_date.present?
end
end

0 comments on commit 746bbfc

Please sign in to comment.