Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ahmedfadhil/CoachAIBot
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: ahmedfadhil/CoachAIBot
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: bug_fixxing
Choose a head ref

Commits on Mar 27, 2018

  1. annotated bot_tokns

    neboduus committed Mar 27, 2018
    Copy the full SHA
    e79e65a View commit details
  2. back button working

    ahmedfadhil committed Mar 27, 2018
    Copy the full SHA
    00694b5 View commit details

Commits on Mar 29, 2018

  1. Copy the full SHA
    44c4e2a View commit details

Commits on Mar 30, 2018

  1. Copy the full SHA
    28a8afa View commit details
  2. Copy the full SHA
    719eecb View commit details

Commits on Apr 6, 2018

  1. csv stuff almost done

    ahmedfadhil committed Apr 6, 2018
    Copy the full SHA
    83f2b4e View commit details

Commits on Apr 9, 2018

  1. did some work on csv

    ahmedfadhil committed Apr 9, 2018
    Copy the full SHA
    dcedf78 View commit details
  2. fixed secrets.yml and other stuff

    Damiano Stoffie committed Apr 9, 2018
    Copy the full SHA
    4008de6 View commit details
  3. bugfixes in the dialog

    Damiano Stoffie committed Apr 9, 2018
    Copy the full SHA
    e310c5e View commit details
  4. fixed some bugs in the invitation_controller and view

    Damiano Stoffie committed Apr 9, 2018
    Copy the full SHA
    1f0d9c4 View commit details
  5. manually merged fitbit branch

    Damiano Stoffie committed Apr 9, 2018
    Copy the full SHA
    99925b1 View commit details
  6. mergin...

    Damiano Stoffie committed Apr 9, 2018
    Copy the full SHA
    269c672 View commit details
  7. minor changes

    ahmedfadhil committed Apr 9, 2018
    Copy the full SHA
    c6b06d9 View commit details

Commits on Apr 12, 2018

  1. wearable navigation

    Damiano Stoffie committed Apr 12, 2018
    Copy the full SHA
    3ba9c0b View commit details
  2. wearable icon added

    Damiano Stoffie committed Apr 12, 2018
    Copy the full SHA
    a9c57e2 View commit details
  3. modifed user model

    ahmedfadhil committed Apr 12, 2018
    Copy the full SHA
    59869e1 View commit details
  4. fixed merge conflicts

    ahmedfadhil committed Apr 12, 2018
    Copy the full SHA
    9583426 View commit details
  5. Copy the full SHA
    0ed6c95 View commit details

Commits on Apr 17, 2018

  1. added calendar events

    ahmedfadhil committed Apr 17, 2018
    Copy the full SHA
    73ca622 View commit details

Commits on Apr 22, 2018

  1. Copy the full SHA
    a3756d3 View commit details
  2. solves questionnaires bug

    neboduus committed Apr 22, 2018
    Copy the full SHA
    bb925a8 View commit details
Showing with 25,932 additions and 703 deletions.
  1. +3 −0 .gitignore
  2. +29 −5 Gemfile
  3. +13 −7 README.md
  4. +8 −0 app/assets/javascripts/application.js
  5. +3 −3 app/assets/javascripts/cable.js
  6. +3 −0 app/assets/javascripts/calendar.coffee
  7. +14 −0 app/assets/javascripts/date_range_picker.js
  8. +3 −0 app/assets/javascripts/events.coffee
  9. +59 −0 app/assets/javascripts/full_calendar.js
  10. 0 app/assets/javascripts/third_party/bootstrap-notify.js
  11. 0 app/assets/javascripts/third_party/bpopup/jquery.bpopup.js
  12. 0 app/assets/javascripts/third_party/mdl-ext.js
  13. 0 app/assets/javascripts/third_party/mdl-ext.js.map
  14. 0 app/assets/javascripts/third_party/paginathing.js
  15. 0 app/assets/javascripts/third_party/tipped/tipped.js
  16. +7 −6 app/assets/javascripts/user.coffee
  17. +3 −0 app/assets/stylesheets/application.css
  18. +3 −0 app/assets/stylesheets/calendar.scss
  19. +3 −0 app/assets/stylesheets/events.scss
  20. +5 −0 app/assets/stylesheets/home.scss
  21. +3 −3 app/cells/coach_users/show.erb
  22. +3 −3 app/cells/dashboard_cell.rb
  23. +39 −69 app/cells/drawer/show.erb
  24. +19 −18 app/cells/features/features_card.erb
  25. +1 −1 app/cells/features/lateral_info.erb
  26. +23 −14 app/cells/features_cell.rb
  27. +0 −1 app/cells/layout/show.erb
  28. +166 −0 app/cells/monthly_report/chart.erb
  29. +77 −0 app/cells/monthly_report/show.erb
  30. +103 −0 app/cells/monthly_report_cell.rb
  31. +14 −0 app/cells/objective/row.erb
  32. +89 −0 app/cells/objective/show.erb
  33. +28 −0 app/cells/objective/table.erb
  34. +61 −0 app/cells/objective_cell.rb
  35. +13 −0 app/cells/objectives/card.erb
  36. +53 −0 app/cells/objectives/new.erb
  37. +37 −0 app/cells/objectives/show.erb
  38. +17 −0 app/cells/objectives/table.erb
  39. +69 −0 app/cells/objectives_cell.rb
  40. +18 −0 app/cells/wearable/card.erb
  41. +51 −0 app/cells/wearable_cell.rb
  42. +166 −0 app/cells/weekly_report/chart.erb
  43. +21 −0 app/cells/weekly_report/navigation.erb
  44. +77 −0 app/cells/weekly_report/show.erb
  45. +115 −0 app/cells/weekly_report_cell.rb
  46. +17 −9 app/controllers/activities_controller.rb
  47. +3 −6 app/controllers/application_controller.rb
  48. +9 −0 app/controllers/calendar_controller.rb
  49. +40 −0 app/controllers/events_controller.rb
  50. +110 −0 app/controllers/invitations_controller.rb
  51. +42 −0 app/controllers/objectives_controller.rb
  52. +1 −0 app/controllers/plannings_controller.rb
  53. +70 −0 app/controllers/questionnaires_controller.rb
  54. +70 −30 app/controllers/users_controller.rb
  55. +64 −23 app/controllers/wearables_controller.rb
  56. +2 −0 app/helpers/calendar_helper.rb
  57. +2 −0 app/helpers/events_helper.rb
  58. +10 −0 app/jobs/ten_days_progress_job.rb
  59. +1 −0 app/models/activity.rb
  60. +8 −7 app/models/coach_user.rb
  61. +11 −0 app/models/event.rb
  62. +186 −187 app/models/exception_handler/exception.rb
  63. +80 −0 app/models/invitation.rb
  64. +120 −0 app/models/objective.rb
  65. +3 −0 app/models/objective_log.rb
  66. +77 −1 app/models/questionnaire.rb
  67. +1 −0 app/models/questionnaire_answer.rb
  68. +3 −0 app/models/questionnaire_question.rb
  69. +322 −22 app/models/user.rb
  70. +32 −0 app/views/answers/_form.html.erb
  71. +6 −0 app/views/answers/edit.html.erb
  72. +31 −0 app/views/answers/index.html.erb
  73. +5 −0 app/views/answers/new.html.erb
  74. +19 −0 app/views/answers/show.html.erb
  75. +7 −0 app/views/calendar/index.html.erb
  76. +13 −0 app/views/events/_edit.html.erb
  77. +12 −0 app/views/events/_event.json.jbuilder
  78. +21 −0 app/views/events/_form.html.erb
  79. +13 −0 app/views/events/_new.html.erb
  80. +8 −0 app/views/events/create.js.erb
  81. +2 −0 app/views/events/destroy.js.erb
  82. +3 −0 app/views/events/edit.js.erb
  83. +11 −0 app/views/events/index.json.jbuilder
  84. +3 −0 app/views/events/new.js.erb
  85. +7 −0 app/views/events/update.js.erb
  86. +30 −0 app/views/invitations/_form.html.erb
  87. +6 −0 app/views/invitations/edit.html.erb
  88. +27 −0 app/views/invitations/index.html.erb
  89. +39 −0 app/views/invitations/new.html.erb
  90. +24 −0 app/views/invitations/show.html.erb
  91. +9 −0 app/views/layouts/_messages.html.erb
  92. +7 −0 app/views/layouts/_notice.html.erb
  93. +1 −1 app/views/layouts/application.html.erb
  94. +78 −6 app/views/layouts/cell_application.html.erb
  95. +2 −0 app/views/layouts/home.html.erb
  96. +2 −1 app/views/layouts/profile.html.erb
  97. +1 −0 app/views/objectives/details.html.erb
  98. +10 −0 app/views/objectives/index.html.erb
  99. +1 −0 app/views/objectives/new.html.erb
  100. +1 −0 app/views/objectives/show.html.erb
  101. +27 −0 app/views/options/_form.html.erb
  102. +6 −0 app/views/options/edit.html.erb
  103. +29 −0 app/views/options/index.html.erb
  104. +5 −0 app/views/options/new.html.erb
  105. +14 −0 app/views/options/show.html.erb
  106. +0 −70 app/views/plannings/_new.html.erb
  107. +55 −0 app/views/questionnaires/_form.html.erb
  108. +13 −0 app/views/questionnaires/edit.html.erb
  109. +32 −0 app/views/questionnaires/index.html.erb
  110. +15 −0 app/views/questionnaires/new.html.erb
  111. +21 −0 app/views/questionnaires/show.html.erb
  112. +32 −0 app/views/questions/_form.html.erb
  113. +6 −0 app/views/questions/edit.html.erb
  114. +31 −0 app/views/questions/index.html.erb
  115. +5 −0 app/views/questions/new.html.erb
  116. +19 −0 app/views/questions/show.html.erb
  117. +0 −5 app/views/static_pages/about.html.erb
  118. +0 −12 app/views/static_pages/help.html.erb
  119. +2 −0 app/views/users/index.html.erb
  120. +64 −1 app/views/users/new.html.erb
  121. +2 −0 app/views/users/show.html.erb
  122. +28 −0 app/views/wearables/edit.html.erb
  123. +10 −5 app/views/wearables/index.html.erb
  124. +1 −0 app/views/wearables/monthly_chart.html.erb
  125. +1 −0 app/views/wearables/monthly_report.html.erb
  126. +15 −0 app/views/wearables/oauth2_callback.html.erb
  127. +1 −23 app/views/wearables/show.html.erb
  128. +1 −0 app/views/wearables/weekly_chart.html.erb
  129. +1 −0 config/application.rb
  130. +10 −1 config/cronotab.rb
  131. +1 −3 config/environments/development.rb
  132. +182 −0 config/initializers/simple_form.rb
  133. +31 −0 config/locales/simple_form.en.yml
  134. +61 −29 config/routes.rb
  135. +8 −5 config/secrets.yml
  136. +1 −0 db/migrate/20170711120649_create_activities.rb
  137. +15 −0 db/migrate/20171114145532_create_objectives.rb
  138. +13 −0 db/migrate/20171127172559_create_weekly_logs.rb
  139. +14 −0 db/migrate/20171214155509_drop_weekly_logs.rb
  140. +5 −0 db/migrate/20171216153318_add_fitbit_integration_to_objective.rb
  141. +5 −0 db/migrate/20171216154802_migrate_objective_log_type.rb
  142. +5 −0 db/migrate/20180117114946_fixobjectivestypes.rb
  143. +5 −0 db/migrate/20180327125933_add_score_to_options.rb
  144. +5 −0 db/migrate/20180330082402_add_campagin_to_invitation.rb
  145. +36 −0 db/migrate/20180330091540_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb
  146. +26 −0 db/migrate/20180330091541_add_missing_unique_indices.acts_as_taggable_on_engine.rb
  147. +20 −0 db/migrate/20180330091542_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb
  148. +15 −0 db/migrate/20180330091543_add_missing_taggable_index.acts_as_taggable_on_engine.rb
  149. +15 −0 db/migrate/20180330091544_change_collation_for_tag_names.acts_as_taggable_on_engine.rb
  150. +23 −0 db/migrate/20180330091545_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb
  151. +7 −0 db/migrate/20180330092727_add_height_weight_blood_type_to_user.rb
  152. +12 −0 db/migrate/20180412150916_create_events.rb
  153. +67 −1 db/schema.rb
  154. +16 −0 db/seeds.rb
  155. +48 −4 lib/bot_v2/dispatcher.rb
  156. +6 −2 lib/bot_v2/general.rb
  157. +1 −1 lib/bot_v2/questionnaire_manager.rb
  158. +119 −0 lib/csv_data/questionnaire_export.rb
  159. +19 −2 lib/csv_data/user_export.rb
  160. +302 −0 lib/finite_state_machine/objectives_fsm.rb
  161. +73 −73 lib/fitbit/client.rb
  162. +15 −15 lib/modules/communicator.rb
  163. +49 −28 lib/modules/notifier.rb
  164. +8 −0 lib/tasks/notify_for_new_questionnaire.rake
  165. +12 −0 lib/tasks/scramble_fitbit_data.rake
  166. +53 −0 lib/tasks/training.rake
  167. +15 −0 lib/templates/erb/scaffold/_form.html.erb
  168. +9 −0 test/controllers/calendar_controller_test.rb
  169. +48 −0 test/controllers/events_controller_test.rb
  170. +13 −0 test/fixtures/events.yml
  171. +7 −0 test/models/event_test.rb
  172. +9 −0 test/system/events_test.rb
  173. 0 vendor/assets/javascripts/.keep
  174. +1,618 −0 vendor/assets/javascripts/daterangepicker.js
  175. +13,200 −0 vendor/assets/javascripts/fullcalendar.js
  176. +180 −0 vendor/assets/javascripts/fullcalendar/gcal.js
  177. +4 −0 vendor/assets/javascripts/fullcalendar/lang-all.js
  178. +1 −0 vendor/assets/javascripts/fullcalendar/lang/ar-ma.js
  179. +1 −0 vendor/assets/javascripts/fullcalendar/lang/ar-sa.js
  180. +1 −0 vendor/assets/javascripts/fullcalendar/lang/ar-tn.js
  181. +1 −0 vendor/assets/javascripts/fullcalendar/lang/ar.js
  182. +1 −0 vendor/assets/javascripts/fullcalendar/lang/bg.js
  183. +1 −0 vendor/assets/javascripts/fullcalendar/lang/ca.js
  184. +1 −0 vendor/assets/javascripts/fullcalendar/lang/cs.js
  185. +1 −0 vendor/assets/javascripts/fullcalendar/lang/da.js
  186. +1 −0 vendor/assets/javascripts/fullcalendar/lang/de-at.js
  187. +1 −0 vendor/assets/javascripts/fullcalendar/lang/de.js
  188. +1 −0 vendor/assets/javascripts/fullcalendar/lang/el.js
  189. +1 −0 vendor/assets/javascripts/fullcalendar/lang/en-au.js
  190. +1 −0 vendor/assets/javascripts/fullcalendar/lang/en-ca.js
  191. +1 −0 vendor/assets/javascripts/fullcalendar/lang/en-gb.js
  192. +1 −0 vendor/assets/javascripts/fullcalendar/lang/en-ie.js
  193. +1 −0 vendor/assets/javascripts/fullcalendar/lang/en-nz.js
  194. +1 −0 vendor/assets/javascripts/fullcalendar/lang/es.js
  195. +1 −0 vendor/assets/javascripts/fullcalendar/lang/eu.js
  196. +1 −0 vendor/assets/javascripts/fullcalendar/lang/fa.js
  197. +1 −0 vendor/assets/javascripts/fullcalendar/lang/fi.js
  198. +1 −0 vendor/assets/javascripts/fullcalendar/lang/fr-ca.js
  199. +1 −0 vendor/assets/javascripts/fullcalendar/lang/fr-ch.js
  200. +1 −0 vendor/assets/javascripts/fullcalendar/lang/fr.js
  201. +1 −0 vendor/assets/javascripts/fullcalendar/lang/gl.js
  202. +1 −0 vendor/assets/javascripts/fullcalendar/lang/he.js
  203. +1 −0 vendor/assets/javascripts/fullcalendar/lang/hi.js
  204. +1 −0 vendor/assets/javascripts/fullcalendar/lang/hr.js
  205. +1 −0 vendor/assets/javascripts/fullcalendar/lang/hu.js
  206. +1 −0 vendor/assets/javascripts/fullcalendar/lang/id.js
  207. +1 −0 vendor/assets/javascripts/fullcalendar/lang/is.js
  208. +1 −0 vendor/assets/javascripts/fullcalendar/lang/it.js
  209. +1 −0 vendor/assets/javascripts/fullcalendar/lang/ja.js
  210. +1 −0 vendor/assets/javascripts/fullcalendar/lang/ko.js
  211. +1 −0 vendor/assets/javascripts/fullcalendar/lang/lb.js
  212. +1 −0 vendor/assets/javascripts/fullcalendar/lang/lt.js
  213. +1 −0 vendor/assets/javascripts/fullcalendar/lang/lv.js
  214. +1 −0 vendor/assets/javascripts/fullcalendar/lang/nb.js
  215. +1 −0 vendor/assets/javascripts/fullcalendar/lang/nl.js
  216. +1 −0 vendor/assets/javascripts/fullcalendar/lang/nn.js
  217. +1 −0 vendor/assets/javascripts/fullcalendar/lang/pl.js
  218. +1 −0 vendor/assets/javascripts/fullcalendar/lang/pt-br.js
  219. +1 −0 vendor/assets/javascripts/fullcalendar/lang/pt.js
  220. +1 −0 vendor/assets/javascripts/fullcalendar/lang/ro.js
  221. +1 −0 vendor/assets/javascripts/fullcalendar/lang/ru.js
  222. +1 −0 vendor/assets/javascripts/fullcalendar/lang/sk.js
  223. +1 −0 vendor/assets/javascripts/fullcalendar/lang/sl.js
  224. +1 −0 vendor/assets/javascripts/fullcalendar/lang/sr-cyrl.js
  225. +1 −0 vendor/assets/javascripts/fullcalendar/lang/sr.js
  226. +1 −0 vendor/assets/javascripts/fullcalendar/lang/sv.js
  227. +1 −0 vendor/assets/javascripts/fullcalendar/lang/th.js
  228. +1 −0 vendor/assets/javascripts/fullcalendar/lang/tr.js
  229. +1 −0 vendor/assets/javascripts/fullcalendar/lang/uk.js
  230. +1 −0 vendor/assets/javascripts/fullcalendar/lang/vi.js
  231. +1 −0 vendor/assets/javascripts/fullcalendar/lang/zh-cn.js
  232. +1 −0 vendor/assets/javascripts/fullcalendar/lang/zh-tw.js
  233. +4,195 −0 vendor/assets/javascripts/moment.js
  234. 0 vendor/assets/stylesheets/.keep
  235. +269 −0 vendor/assets/stylesheets/daterangepicker.css
  236. +1,261 −0 vendor/assets/stylesheets/fullcalendar.css
  237. +208 −0 vendor/assets/stylesheets/fullcalendar.print.css
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -4,6 +4,9 @@
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'

public/system/*
.env

# Ignore bundler config.
/.bundle

34 changes: 29 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -8,18 +8,24 @@ git_source(:github) do |repo_name|
"https://github.com/#{repo_name}.git"
end

gem 'dotenv-rails', groups: [:development, :test]

# Nested Form Fields
gem 'nested_form_fields'

# use svg files in views
#gem 'inline_svg'

# finite state machine for user <-> bot interaction
# gem 'state_machines'
gem 'aasm', '~> 4.12', '>= 4.12.3'
# State Machines adds support for creating state machines for attributes on any Ruby class.
gem 'state_machines'


# A discard gem to be used in archived users
gem 'discard'

gem 'record_tag_helper', '~> 1.0'

# Custom error page
# #Gemfile
# gem 'exception_handler', '~> 0.7.7.0'
@@ -35,6 +41,7 @@ gem 'xport'
gem 'crono'
gem 'daemons' #used by crono

gem 'record_tag_helper', '~> 1.0'
# cron jobs web ui
gem 'haml'
gem 'sinatra', require: nil
@@ -64,8 +71,12 @@ gem 'prawn', '~> 2.2', '>= 2.2.2'
gem 'highstock-rails'

# jquery-UI
gem 'jquery-rails'
gem 'jquery-ui-rails'


gem 'simple_form'

# for polling service in notification task
gem 'polling'

@@ -99,7 +110,7 @@ gem 'therubyracer', platforms: :ruby
gem 'coffee-rails', '~> 4.2'

# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
# gem 'turbolinks', '~> 5'
gem 'turbolinks', '~> 5.x'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
@@ -124,13 +135,26 @@ gem 'hash_dot'
# oauth2 client
gem 'oauth2'




# # Full calender
# gem 'fullcalendar-rails'
# gem 'momentjs-rails'


####
gem 'rails-assets-eq.js'
gem 'rails-assets-jquery'
#gem 'rails-assets-material-design-lite'
gem 'material_design_lite-rails', '~> 1.3'
gem 'rails-assets-mdl-selectfield'
gem 'rails-assets-polyfills'
# Act As Taggable
gem 'acts-as-taggable-on', '~> 5.0'

# handle exceptions in models
gem 'exception_handler', '~> 0.7.7.0'

group :development, :test do
# Adds support for Capybara system testing and selenium driver
@@ -152,7 +176,7 @@ group :development do
gem 'spring-watcher-listen', '~> 2.0.0'
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'web-console', '>= 3.3.0'

# Refactoring classes names
gem 'rails_refactor', '~> 1.3'

@@ -178,4 +202,4 @@ group :production do
gem 'rails_12factor', '0.0.2'
end

gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -44,17 +44,17 @@ cd ngrok

```
ngrok by @inconshreveable (Ctrl+C to quit)
Session Status online
Account Marian Diaconu (Plan: Free)
Version 2.2.8
Region United States (us)
Web Interface http://127.0.0.1:4040
Forwarding http://d9e5ba0e.ngrok.io -> localhost:3000
Forwarding https://d9e5ba0e.ngrok.io -> localhost:3000
Connections ttl opn rt1 rt5 p50 p90
0 0 0.00 0.00 0.00 0.00
0 0 0.00 0.00 0.00 0.00
```

* Set Telegram Bot Webhook by making a GET request like this:
@@ -69,7 +69,7 @@ And the bot token is: `294560170:AAFaB9cQ-hCzQEfYNr6z30gD2K7FeDZ1gVQ`.<br/>
You can change them if you have to.


This will tell to TelegramAPI to send the user interactions with the bot `@CoachAIBot`,
This will tell to TelegramAPI to send the user interactions with the bot `@CoachAIBot`,
which is associated with the bot token to the https public address generated by ngrok,
which binds the local Rails server.

@@ -79,7 +79,7 @@ which binds the local Rails server.
```

* Lets start [crono](https://github.com/plashchynski/crono) time-based background job scheduler daemon for Ruby on Rails.
We use it for periodically tasks like sending Notifications
We use it for periodically tasks like sending Notifications
```
bundle exec crono start RAILS_ENV=development
```
@@ -89,10 +89,16 @@ bundle exec crono start RAILS_ENV=development
rails s
```

* Access `http://localhost:3000/` for the Web Platform
* Access `http://localhost:3000/` for the Web Platform
* Credentials for LOG IN
```
email: user@example.com
password: 12345678
```
* Search `@CoachAIBot` on [Telegram](https://web.telegram.org/#/login)
* Search `@CoachAIBot` on [Telegram](https://web.telegram.org/#/login)

Print the erd schema:
```rake erd```
And visualize erd.pdf

Fitbit task to run every hour or so to pull the data from the fitbit server: ```rake fitbit:pull_data```
8 changes: 8 additions & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
@@ -14,12 +14,20 @@
//= require eq.js.js
//= require jquery
//= require jquery-ui
//= require jquery_ujs
//= require turbolinks
//= require highstock
//= require material
//= require mdl-selectfield
//= require rails-ujs
//= require nested_form_fields
//= require moment
//= require fullcalendar
//= require daterangepicker
//= require_tree ./third_party
//= require_tree ./third_party/bpopup
//= require_tree ./third_party/tipped
//= require_tree ./my_modules
//= require_tree .


6 changes: 3 additions & 3 deletions app/assets/javascripts/cable.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Action Cable provides the framework to deal with WebSockets in Rails.
// You can generate new channels where WebSocket features live using the `rails generate channel` command.
// You can generate new channels where WebSocket features live using the rails generate channel command.
//
//= require action_cable
//= require_self
//= require_tree ./channels

(function() {
this.App || (this.App = {});
this.App || (this.App = {});

App.cable = ActionCable.createConsumer();
App.cable = ActionCable.createConsumer();

}).call(this);
3 changes: 3 additions & 0 deletions app/assets/javascripts/calendar.coffee
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/
14 changes: 14 additions & 0 deletions app/assets/javascripts/date_range_picker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
var date_range_picker;
date_range_picker = function() {
$('.date-range-picker').each(function(){
$(this).daterangepicker({
timePicker: true,
timePickerIncrement: 30,
alwaysShowCalendars: true
}, function(start, end, label) {
$('.start_hidden').val(start.format('YYYY-MM-DD HH:mm'));
$('.end_hidden').val(end.format('YYYY-MM-DD HH:mm'));
});
})
};
$(document).on('turbolinks:load', date_range_picker);
3 changes: 3 additions & 0 deletions app/assets/javascripts/events.coffee
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/
59 changes: 59 additions & 0 deletions app/assets/javascripts/full_calendar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
var initialize_calendar;
initialize_calendar = function () {
$('.calendar').each(function () {
var calendar = $(this);
calendar.fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
selectable: true,
selectHelper: true,
editable: true,
eventLimit: true,
events: '/events.json',

select: function (start, end) {
$.getScript('/events/new', function () {
$('#event_date_range').val(moment(start).format("MM/DD/YYYY HH:mm") + ' - ' + moment(end).format("MM/DD/YYYY HH:mm"));
date_range_picker();
$('.start_hidden').val(moment(start).format('YYYY-MM-DD HH:mm'));
$('.end_hidden').val(moment(end).format('YYYY-MM-DD HH:mm'));
});

calendar.fullCalendar('unselect');
},

eventDrop: function (event, delta, revertFunc) {
event_data = {
event: {
id: event.id,
start: event.start.format(),
end: event.end.format()
}
};
$.ajax({
url: event.update_url,
data: event_data,
type: 'PATCH'
});
},

eventClick: function (event, jsEvent, view) {
$.getScript(event.edit_url, function () {
$('#event_date_range').val(moment(event.start).format("MM/DD/YYYY HH:mm") + ' - ' + moment(event.end).format("MM/DD/YYYY HH:mm"));
date_range_picker();
$('.start_hidden').val(moment(event.start).format('YYYY-MM-DD HH:mm'));
$('.end_hidden').val(moment(event.end).format('YYYY-MM-DD HH:mm'));
});
}
});
})
};
$(document).on('turbolinks:load', initialize_calendar);

// jQuery(document).ready(initialize_calendar);



Empty file modified app/assets/javascripts/third_party/bootstrap-notify.js
100755 → 100644
Empty file.
Empty file modified app/assets/javascripts/third_party/bpopup/jquery.bpopup.js
100755 → 100644
Empty file.
Empty file modified app/assets/javascripts/third_party/mdl-ext.js
100755 → 100644
Empty file.
Empty file modified app/assets/javascripts/third_party/mdl-ext.js.map
100755 → 100644
Empty file.
Empty file modified app/assets/javascripts/third_party/paginathing.js
100755 → 100644
Empty file.
Empty file modified app/assets/javascripts/third_party/tipped/tipped.js
100755 → 100644
Empty file.
13 changes: 7 additions & 6 deletions app/assets/javascripts/user.coffee
Original file line number Diff line number Diff line change
@@ -390,9 +390,10 @@ $ ->
addTips()


$ ->
flashCallback = ->
$(".alert").fadeOut()
$(".alert").bind 'click', (ev) =>
$(".alert").fadeOut()
setTimeout flashCallback, 9000

#$ ->
# flashCallback = ->
# $(".alert").fadeOut()
# $(".alert").bind 'click', (ev) =>
# $(".alert").fadeOut()
# setTimeout flashCallback, 9000
3 changes: 3 additions & 0 deletions app/assets/stylesheets/application.css
Original file line number Diff line number Diff line change
@@ -22,8 +22,11 @@
*= require static_pages
*= require internal_server_error
*= require page_not_found
*= require fullcalendar
*= require_tree .
*= require_tree ./third_party
*= require_tree ./third_party/tipped
*= require_self
*/

3 changes: 3 additions & 0 deletions app/assets/stylesheets/calendar.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the calendar controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
3 changes: 3 additions & 0 deletions app/assets/stylesheets/events.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the events controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
5 changes: 5 additions & 0 deletions app/assets/stylesheets/home.scss
Original file line number Diff line number Diff line change
@@ -28,6 +28,11 @@
background-size: cover;
}

.fitbit_user_disabled {
pointer-events: none; /* Disables the button completely. Better than just cursor: default; */
//@include opacity(0.7);
}

//
//.demo-card-square.mdl-card {
// width: 320px;
6 changes: 3 additions & 3 deletions app/cells/coach_users/show.erb
Original file line number Diff line number Diff line change
@@ -233,7 +233,7 @@
<% else %>

<span class="text-muted username">
@<%= red_user.patient_objective %>
Obbiettivo: <%= red_user.patient_objective %>
</span></a>


@@ -293,7 +293,7 @@
<% else %>

<span class="text-muted username">
@<%= yellow_user.patient_objective %>
Obbiettivo: <%= yellow_user.patient_objective %>

</span></a>

@@ -347,7 +347,7 @@
<% else %>

<span class="text-muted username">
@<%= green_user.patient_objective %>
Obbiettivo: <%= green_user.patient_objective %>
</span></a>
<% end %>
<% if green_user %>
6 changes: 3 additions & 3 deletions app/cells/dashboard_cell.rb
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ def users_with_no_plan
end

def all_users
User.all.count
User.where(coach_user_id: model.id).count
end

def users_with_no_plan_count
@@ -57,11 +57,11 @@ def global_plans_count
end

def global_activities_count
Activity.all.count
Activity.where(coach_user_id: model.id).count
end

def activities_count(user)
Activity.joins(:plans).where(:plans => {:user_id => user.id}).count
Activity.where(coach_user_id: model.id).joins(:plans).where(:plans => {:user_id => user.id}).count
end

def user_id_link(user)
Loading