-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b370677
commit 1804abd
Showing
14 changed files
with
150 additions
and
43 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
app/assets/javascripts/admin/nudge_user_confirgurations.coffee
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Place all the behaviors and hooks related to the matching controller here. | ||
# All this logic will automatically be available in application.js. | ||
# You can use CoffeeScript in this file: http://coffeescript.org/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Place all the styles related to the admin/nudge_user_confirgurations controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Sass (SCSS) here: http://sass-lang.com/ |
20 changes: 20 additions & 0 deletions
20
app/controllers/admin/nudge_user_confirgurations_controller.rb
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
class Admin::NudgeUserConfirgurationsController < ApplicationController | ||
def new | ||
|
||
UserConfiguration.where( configured: [nil, false]).each do |user_configuration| | ||
if user = user_configuration.user | ||
|
||
if ( user_configuration.created_at < Time.now - 24.hours) && | ||
( user_configuration.say_what_you_want_email_count < 3 ) | ||
|
||
user_configuration.update_columns( | ||
say_what_you_want_email_count: user_configuration.say_what_you_want_email_count += 1 | ||
) | ||
UserMailer.delay.say_what_you_want user.id | ||
end | ||
end | ||
end | ||
redirect_to admin_email_groups_path | ||
|
||
end | ||
end |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module Admin::NudgeUserConfirgurationsHelper | ||
end |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
h1 Admin::NudgeUserConfirgurations#new | ||
p Find me in app/views/admin/nudge_user_confirgurations/new.html.slim |
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
6 changes: 6 additions & 0 deletions
6
db/migrate/20151119163018_add_say_what_you_want_email_count_to_user_configurations.rb
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class AddSayWhatYouWantEmailCountToUserConfigurations < ActiveRecord::Migration | ||
def change | ||
add_column :user_configurations, :say_what_you_want_email_count, :integer, default: 0 | ||
UserConfiguration.update_all(say_what_you_want_email_count: 0) | ||
end | ||
end |
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
12 changes: 12 additions & 0 deletions
12
spec/controllers/admin/nudge_user_confirgurations_controller_spec.rb
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe Admin::NudgeUserConfirgurationsController, type: :controller do | ||
|
||
describe "GET #new" do | ||
it "returns http success" do | ||
get :new | ||
expect(response).to have_http_status(:success) | ||
end | ||
end | ||
|
||
end |
15 changes: 15 additions & 0 deletions
15
spec/helpers/admin/nudge_user_confirgurations_helper_spec.rb
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require 'rails_helper' | ||
|
||
# Specs in this file have access to a helper object that includes | ||
# the Admin::NudgeUserConfirgurationsHelper. For example: | ||
# | ||
# describe Admin::NudgeUserConfirgurationsHelper do | ||
# describe "string concat" do | ||
# it "concats two strings with spaces" do | ||
# expect(helper.concat_strings("this","that")).to eq("this that") | ||
# end | ||
# end | ||
# end | ||
RSpec.describe Admin::NudgeUserConfirgurationsHelper, type: :helper do | ||
pending "add some examples to (or delete) #{__FILE__}" | ||
end |
5 changes: 5 additions & 0 deletions
5
spec/views/admin/nudge_user_confirgurations/new.html.slim_spec.rb
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe "nudge_user_confirgurations/new.html.slim", type: :view do | ||
pending "add some examples to (or delete) #{__FILE__}" | ||
end |