Skip to content

Track Progress on Strategies #1719

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 52 commits into from
Closed
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
36cf917
Display contributors as a table
GayathriVenkatesh Mar 25, 2020
e1430fb
Use grids.scss to display contributors as table
GayathriVenkatesh Mar 30, 2020
06a14fd
Update grids.scss
GayathriVenkatesh Mar 30, 2020
7b1e9f3
Update contribute.html.erb
GayathriVenkatesh Apr 1, 2020
fd45438
Update gridThreeItemAlways()
GayathriVenkatesh Apr 1, 2020
671c57c
Add New Moment Button to home page
GayathriVenkatesh Apr 2, 2020
b2fbf3f
Merge remote-tracking branch 'upstream/master' into moments
GayathriVenkatesh Apr 2, 2020
130080c
Add 'Mark as Finished' option for strategies
GayathriVenkatesh Apr 2, 2020
201cf50
Add Tasks page
GayathriVenkatesh Apr 14, 2020
074fa4f
Merge branch 'master' into strategies
GayathriVenkatesh Apr 14, 2020
05ea003
Add Task to all languages
GayathriVenkatesh Apr 14, 2020
b700bdd
Merge branch 'strategies' of github.com:GayathriVenkatesh/ifme into s…
GayathriVenkatesh Apr 14, 2020
e7ce1e1
Codeclimate issues
GayathriVenkatesh Apr 17, 2020
a40700f
Fix rspec errors
GayathriVenkatesh Apr 17, 2020
343d750
Update tasks_controller.rb
Manasa2850 Apr 21, 2020
f793949
Update strategies_controller.rb
Manasa2850 Apr 21, 2020
69fef40
Update strategies_controller.rb
Manasa2850 Apr 21, 2020
1b625c5
Remove rake from Gemfile
Apr 26, 2020
4839cdd
Remove unwanted commits
Apr 26, 2020
06aa0fd
Delete .rake_tasks~
GayathriVenkatesh Apr 26, 2020
a986ce4
Add add_visible_to_strategies file
Apr 26, 2020
d2f9030
Merge branch 'strategies' of https://github.com/GayathriVenkatesh/ifm…
Apr 26, 2020
6c2a1b4
Use translation key
Apr 26, 2020
3d56560
Check if task exists
GayathriVenkatesh Apr 26, 2020
fd883c3
Delete todo_items_helper.rb
GayathriVenkatesh Apr 26, 2020
6ee81d5
Remove show function from tasks controller
GayathriVenkatesh Apr 26, 2020
2ca7062
Merge branch 'strategies' of https://github.com/GayathriVenkatesh/ifm…
GayathriVenkatesh Apr 26, 2020
3cf1569
Add show function
GayathriVenkatesh Apr 26, 2020
06bcd2f
Delete using destroy_all
GayathriVenkatesh Apr 30, 2020
1e088d4
Delete scaffolds.scss
GayathriVenkatesh Apr 30, 2020
719c25e
Codeclimate
GayathriVenkatesh May 13, 2020
61c4502
Update 20200224201131_create_moment_categories_join_table.rb
GayathriVenkatesh May 13, 2020
15700e5
Merge branch 'master' into strategies
GayathriVenkatesh May 13, 2020
96a5301
Update strategies_controller.rb
GayathriVenkatesh May 13, 2020
0ec0bad
Remove trailing spaces
GayathriVenkatesh May 13, 2020
4b365c9
codeclimate
Manasa2850 May 13, 2020
1089f6d
Update strategies_controller.rb
Manasa2850 May 13, 2020
a8adbef
Create tasks_controller_spec.rb
GayathriVenkatesh May 19, 2020
b360190
Remove show route
GayathriVenkatesh May 24, 2020
957f671
Remove development flag
GayathriVenkatesh May 24, 2020
d001eb8
Remove gem whenever
GayathriVenkatesh May 24, 2020
6d40000
Remove search tests
GayathriVenkatesh May 24, 2020
dfa599d
Remove todolists
Manasa2850 May 25, 2020
f41b5b8
codeclimate
Manasa2850 May 25, 2020
1656963
remove create_task from strategies_controller.rb
Manasa2850 May 25, 2020
9d5c6d5
add create_task to strategies_concern.rb
Manasa2850 May 25, 2020
3b5f6a3
codeclimate
Manasa2850 May 25, 2020
69b38aa
codeclimate
Manasa2850 May 25, 2020
895707e
Create todo_items_controller_spec.rb
Manasa2850 May 25, 2020
349021d
Removing since we have a task scheduler
Manasa2850 May 25, 2020
b2e87d3
Update todo_items_controller_spec.rb
Manasa2850 May 25, 2020
2db2e2d
Update todo_items_controller_spec.rb
Manasa2850 May 25, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 114 additions & 0 deletions .rake_tasks~
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
about
active_storage:install
app:template
app:update
app_cli
app_run
assets:clean[keep]
assets:clobber
assets:environment
assets:precompile
cache_digests:dependencies
cache_digests:nested_dependencies
cleaner:remove_lingering_categories
cloudinary:sync_static
db:create
db:drop
db:environment:set
db:fixtures:load
db:migrate
db:migrate:status
db:rollback
db:schema:cache:clear
db:schema:cache:dump
db:schema:dump
db:schema:load
db:seed
db:setup
db:structure:dump
db:structure:load
db:version
dev:cache
diagram:all
diagram:all_with_engines
diagram:controllers:all
diagram:controllers:brief
diagram:controllers:brief_with_engines
diagram:controllers:complete
diagram:controllers:complete_with_engines
diagram:models:all
diagram:models:brief
diagram:models:brief_with_engines
diagram:models:complete
diagram:models:complete_with_engines
diagram:setup:create_new_doc_folder_if_needed
erd
initializers
log:clear
middleware
notes
notes:custom
react_on_rails:assets:clobber
react_on_rails:assets:compile_environment
react_on_rails:assets:delete_broken_symlinks
react_on_rails:assets:symlink_non_digested_assets
react_on_rails:assets:webpack
react_on_rails:locale
restart
routes
scheduler:send_meeting_reminders
scheduler:send_perform_strategy_reminders
scheduler:send_refill_reminders
scheduler:send_take_medication_reminders
secret
setup_workspace
slugs:slugify
spec
spec:concerns
spec:controllers
spec:features
spec:helpers
spec:mailers
spec:models
spec:routing
spec:services
stats
strategies:update
test
test:db
test:system
time:zones[country_or_offset]
tmp:clear
tmp:create
webdrivers:chromedriver:remove
webdrivers:chromedriver:update[version]
webdrivers:chromedriver:version
webdrivers:edgedriver:remove
webdrivers:edgedriver:update[version]
webdrivers:edgedriver:version
webdrivers:geckodriver:remove
webdrivers:geckodriver:update[version]
webdrivers:geckodriver:version
webdrivers:iedriver:remove
webdrivers:iedriver:update[version]
webdrivers:iedriver:version
webpacker
webpacker:binstubs
webpacker:check_binstubs
webpacker:check_node
webpacker:check_yarn
webpacker:clobber
webpacker:compile
webpacker:info
webpacker:install
webpacker:install:angular
webpacker:install:coffee
webpacker:install:elm
webpacker:install:erb
webpacker:install:react
webpacker:install:stimulus
webpacker:install:typescript
webpacker:install:vue
webpacker:verify_install
webpacker:yarn_install
yarn:install
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ gem 'selenium-webdriver', '~> 3.142.3'

gem 'rubyzip', '~> 1.3.0'

gem 'rake', '12.3.3'
gem 'whenever'

group :development, :test do
gem 'bundler-audit'
gem 'dotenv-rails', '~> 2.7.2'
Expand Down
4 changes: 4 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,8 @@ GEM
websocket-driver (0.7.1)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.4)
whenever (1.0.0)
chronic (>= 0.6.3)
xpath (3.2.0)
nokogiri (~> 1.8)

Expand Down Expand Up @@ -538,6 +540,7 @@ DEPENDENCIES
rails-erd (~> 1.6)
rails-i18n (~> 5.1.3)
rails_12factor (= 0.0.3)
rake (= 12.3.3)
react_on_rails (= 11.3.0)
resque (= 2.0.0)
resque-scheduler (= 4.4.0)
Expand All @@ -562,6 +565,7 @@ DEPENDENCIES
uglifier (~> 4.1.20)
webdrivers
webpacker (= 3.5.5)
whenever

RUBY VERSION
ruby 2.6.0p0
Expand Down
84 changes: 84 additions & 0 deletions app/assets/stylesheets/scaffolds.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
body {
background-color: #fff;
color: #333;
margin: 33px;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 13px;
line-height: 18px;
}

p, ol, ul, td {
font-family: verdana, arial, helvetica, sans-serif;
font-size: 13px;
line-height: 18px;
}

pre {
background-color: #eee;
padding: 10px;
font-size: 11px;
}

a {
color: #000;

&:visited {
color: #666;
}

&:hover {
color: #fff;
background-color: #000;
}
}

th {
padding-bottom: 5px;
}

td {
padding: 0 5px 7px;
}

div {
&.field, &.actions {
margin-bottom: 10px;
}
}

#notice {
color: green;
}

.field_with_errors {
padding: 2px;
background-color: red;
display: table;
}

#error_explanation {
width: 450px;
border: 2px solid red;
padding: 7px 7px 0;
margin-bottom: 20px;
background-color: #f0f0f0;

h2 {
text-align: left;
font-weight: bold;
padding: 5px 5px 5px 15px;
font-size: 12px;
margin: -7px -7px 0;
background-color: #c00;
color: #fff;
}

ul li {
font-size: 12px;
list-style: square;
}
}

label {
display: block;
}
2 changes: 1 addition & 1 deletion app/controllers/concerns/strategies_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def strategy_params
params.require(:strategy).permit(
:name, :description, :published_at, :draft,
:comment, { category: [] }, { viewers: [] }, :visible,
perform_strategy_reminder_attributes: %i[active id]
:finished, perform_strategy_reminder_attributes: %i[active id]
)
end
end
12 changes: 11 additions & 1 deletion app/controllers/strategies_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
class StrategiesController < ApplicationController
include CollectionPageSetupConcern
include ReminderHelper
include StrategiesConcern
include Shared
include StrategiesConcern
include MomentsHelper
include TagsHelper

Expand Down Expand Up @@ -82,6 +82,13 @@ def premade
end
end

def create_task(strategy)
task = Task.find(strategy.id)
task.finished = strategy.finished
task.title = strategy.name
task.save
end

# PATCH/PUT /strategies/1
# PATCH/PUT /strategies/1.json
def update
Expand All @@ -94,12 +101,15 @@ def update
end
empty_array_for :viewers, :category
shared_update(@strategy, strategy_params)
create_task(@strategy)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be testing for this new task functionality in the test for update.

end

# DELETE /strategies/1
# DELETE /strategies/1.json
def destroy
shared_destroy(@strategy)
task = Task.find(@strategy.id)
task.delete
PerformStrategyReminder.where(strategy_id: @strategy.id).destroy_all
end

Expand Down
21 changes: 21 additions & 0 deletions app/controllers/tasks_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# frozen_string_literal: true

class TasksController < ApplicationController
before_action :set_task, only: %i[show]

def index
@tasks = Task.all
end

def show; end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can get rid of this and exclude this route in routes.rb.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we actually need this route?


private

def set_task
@task = Task.find(params[:id])
end

def task_params
params.require(:task).permit(:title, :description)
end
end
19 changes: 19 additions & 0 deletions app/controllers/todo_items_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# frozen_string_literal: true
#
class TodoItemsController < ApplicationController
before_action :set_task

def create
@todo_item = @task.todo_items.create(todo_item_params)
end

private

def set_task
@task = TodoList.find(params[:task_id])
end

def todo_item_params
params[:todo_item].permit(:content)
end
end
9 changes: 9 additions & 0 deletions app/helpers/strategies_form_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,15 @@ def build_strategy_comment(strategy)
)
end

def build_strategy_finished(strategy)
build_switch_input(true, strategy.finished, false)
.merge(
id: 'strategy_finished',
name: 'strategy[finished]',
label: t('strategies.form.mark_as_finished')
)
end

def build_strategy_publishing(strategy)
build_switch_input('0', !strategy.published?, '1').merge(
id: 'strategy_publishing',
Expand Down
1 change: 1 addition & 0 deletions app/helpers/strategies_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def strategy_form_inputs(strategy, viewers)
get_viewers_input(viewers, 'strategy', 'strategies', strategy),
build_strategy_comment(strategy), build_strategy_publishing(strategy),
build_strategy_visible(strategy),
build_strategy_finished(strategy),
build_strategy_reminder(strategy).merge(type: 'checkbox'),
build_strategy_reminder_attributes(strategy)]
end
Expand Down
23 changes: 23 additions & 0 deletions app/helpers/tasks_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# frozen_string_literal: true

module TasksHelper
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be unit testing this helper.

def present_task(element)
{
name: element.title,
link: 'strategies/' + element.title.downcase.strip.tr(' ', '-') + '/edit',
date: TimeAgo.created_or_edited(element),
categories: slugs_hash('Followed ': element.no_of_days_followed.to_s +
'/' + element.total_no_of_days.to_s + ' days')
}
end

def task_props(elements)
elements.map { |element| present_task(element) }
end

private

def slugs_hash(data)
data.map { |total_no_of_days| { name: total_no_of_days } }
end
end
4 changes: 4 additions & 0 deletions app/helpers/todo_items_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# frozen_string_literal: true

module TodoItemsHelper
end
Loading