diff --git a/week_6/activity-tracker/app/views/activities/edit.html.erb b/week_6/activity-tracker/app/views/activities/edit.html.erb
new file mode 100644
index 00000000..9ee02372
--- /dev/null
+++ b/week_6/activity-tracker/app/views/activities/edit.html.erb
@@ -0,0 +1,9 @@
+
+
Edit Activity
+ <%= render "form", activity: @activity %>
+
+
+
+ <%= link_to "Show this activity", @activity ,class:"btn btn-info"%> |
+ <%= link_to "Back to activities", activities_path,class:"btn btn-alternate" %>
+
\ No newline at end of file
diff --git a/week_6/activity-tracker/app/views/activities/index.html.erb b/week_6/activity-tracker/app/views/activities/index.html.erb
new file mode 100644
index 00000000..b0e85b1c
--- /dev/null
+++ b/week_6/activity-tracker/app/views/activities/index.html.erb
@@ -0,0 +1,16 @@
+
\ No newline at end of file
diff --git a/week_6/activity-tracker/app/views/activities/index.json.jbuilder b/week_6/activity-tracker/app/views/activities/index.json.jbuilder
new file mode 100644
index 00000000..865f89ee
--- /dev/null
+++ b/week_6/activity-tracker/app/views/activities/index.json.jbuilder
@@ -0,0 +1 @@
+json.array! @activities, partial: "activities/activity", as: :activity
diff --git a/week_6/activity-tracker/app/views/activities/new.html.erb b/week_6/activity-tracker/app/views/activities/new.html.erb
new file mode 100644
index 00000000..2ddd6ffc
--- /dev/null
+++ b/week_6/activity-tracker/app/views/activities/new.html.erb
@@ -0,0 +1,5 @@
+
+
New activity
+ <%= render "form", activity: @activity %>
+
+
\ No newline at end of file
diff --git a/week_6/activity-tracker/app/views/activities/show.html.erb b/week_6/activity-tracker/app/views/activities/show.html.erb
new file mode 100644
index 00000000..a3d815ef
--- /dev/null
+++ b/week_6/activity-tracker/app/views/activities/show.html.erb
@@ -0,0 +1,6 @@
+
+ <%= render @activity %>
+
+
+ <%= link_to "Back to activities", activities_path,class:"btn btn-alternate" %>
+
\ No newline at end of file
diff --git a/week_6/activity-tracker/app/views/activities/show.json.jbuilder b/week_6/activity-tracker/app/views/activities/show.json.jbuilder
new file mode 100644
index 00000000..a145d0a8
--- /dev/null
+++ b/week_6/activity-tracker/app/views/activities/show.json.jbuilder
@@ -0,0 +1 @@
+json.partial! "activities/activity", activity: @activity
diff --git a/week_6/activity-tracker/app/views/activities/stats.html.erb b/week_6/activity-tracker/app/views/activities/stats.html.erb
new file mode 100644
index 00000000..bdf1a5f8
--- /dev/null
+++ b/week_6/activity-tracker/app/views/activities/stats.html.erb
@@ -0,0 +1,12 @@
+
+
+
Activities Statistics
+
+
Total Duration: <%= @total_duration %>
+
Total Calories: <%= @total_calories %>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/week_6/activity-tracker/app/views/devise/confirmations/new.html.erb b/week_6/activity-tracker/app/views/devise/confirmations/new.html.erb
new file mode 100644
index 00000000..b12dd0cb
--- /dev/null
+++ b/week_6/activity-tracker/app/views/devise/confirmations/new.html.erb
@@ -0,0 +1,16 @@
+
+<% end %>
+<%= render "devise/shared/links" %>
\ No newline at end of file
diff --git a/week_6/activity-tracker/app/views/devise/passwords/new.html.erb b/week_6/activity-tracker/app/views/devise/passwords/new.html.erb
new file mode 100644
index 00000000..f703aacb
--- /dev/null
+++ b/week_6/activity-tracker/app/views/devise/passwords/new.html.erb
@@ -0,0 +1,25 @@
+
\ No newline at end of file
diff --git a/week_6/activity-tracker/app/views/devise/registrations/edit.html.erb b/week_6/activity-tracker/app/views/devise/registrations/edit.html.erb
new file mode 100644
index 00000000..64deae9f
--- /dev/null
+++ b/week_6/activity-tracker/app/views/devise/registrations/edit.html.erb
@@ -0,0 +1,60 @@
+
\ No newline at end of file
diff --git a/week_6/activity-tracker/app/views/devise/registrations/new.html.erb b/week_6/activity-tracker/app/views/devise/registrations/new.html.erb
new file mode 100644
index 00000000..a3a1d417
--- /dev/null
+++ b/week_6/activity-tracker/app/views/devise/registrations/new.html.erb
@@ -0,0 +1,44 @@
+
\ No newline at end of file
diff --git a/week_6/activity-tracker/app/views/devise/sessions/new.html.erb b/week_6/activity-tracker/app/views/devise/sessions/new.html.erb
new file mode 100644
index 00000000..be4226a6
--- /dev/null
+++ b/week_6/activity-tracker/app/views/devise/sessions/new.html.erb
@@ -0,0 +1,37 @@
+
\ No newline at end of file
diff --git a/week_6/activity-tracker/app/views/devise/shared/_error_messages.html.erb b/week_6/activity-tracker/app/views/devise/shared/_error_messages.html.erb
new file mode 100644
index 00000000..cabfe307
--- /dev/null
+++ b/week_6/activity-tracker/app/views/devise/shared/_error_messages.html.erb
@@ -0,0 +1,15 @@
+<% if resource.errors.any? %>
+
+ <%if notice%>
+ <%if notice=='Activity was successfully destroyed.'%>
+
+
+
+
+
Activity Tracker
+
+
+ <%= notice %>
+
+
+
+
+ <%elsif notice=='Activity was successfully updated.'%>
+
+
+
+
+
Activity Tracker
+
+
+ <%= notice %>
+
+
+
+
+ <%else%>
+
+
+
+
+
Activity Tracker
+
+
+ <%= notice %>
+
+
+
+
+ <%end%>
+ <%end%>
+
<%= alert %>
+ <%= yield %>
+
+
+
diff --git a/week_6/activity-tracker/app/views/layouts/mailer.html.erb b/week_6/activity-tracker/app/views/layouts/mailer.html.erb
new file mode 100644
index 00000000..cbd34d2e
--- /dev/null
+++ b/week_6/activity-tracker/app/views/layouts/mailer.html.erb
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+ <%= yield %>
+
+
diff --git a/week_6/activity-tracker/app/views/layouts/mailer.text.erb b/week_6/activity-tracker/app/views/layouts/mailer.text.erb
new file mode 100644
index 00000000..37f0bddb
--- /dev/null
+++ b/week_6/activity-tracker/app/views/layouts/mailer.text.erb
@@ -0,0 +1 @@
+<%= yield %>
diff --git a/week_6/activity-tracker/app/views/shared/_navbar.html.erb b/week_6/activity-tracker/app/views/shared/_navbar.html.erb
new file mode 100644
index 00000000..04584583
--- /dev/null
+++ b/week_6/activity-tracker/app/views/shared/_navbar.html.erb
@@ -0,0 +1,62 @@
+
\ No newline at end of file
diff --git a/week_6/activity-tracker/app/views/static_pages/about.html.erb b/week_6/activity-tracker/app/views/static_pages/about.html.erb
new file mode 100644
index 00000000..8f074d21
--- /dev/null
+++ b/week_6/activity-tracker/app/views/static_pages/about.html.erb
@@ -0,0 +1,5 @@
+
+
ABOUT
+
This is a fitness app
+<%= link_to "Return to Home", static_pages_index_path,class:"btn btn-alternate" %>
+
\ No newline at end of file
diff --git a/week_6/activity-tracker/app/views/static_pages/index.html.erb b/week_6/activity-tracker/app/views/static_pages/index.html.erb
new file mode 100644
index 00000000..0f489bdd
--- /dev/null
+++ b/week_6/activity-tracker/app/views/static_pages/index.html.erb
@@ -0,0 +1,15 @@
+
+<%end%>
\ No newline at end of file
diff --git a/week_6/activity-tracker/bin/bundle b/week_6/activity-tracker/bin/bundle
new file mode 100755
index 00000000..374a0a1f
--- /dev/null
+++ b/week_6/activity-tracker/bin/bundle
@@ -0,0 +1,114 @@
+#!/usr/bin/env ruby
+# frozen_string_literal: true
+
+#
+# This file was generated by Bundler.
+#
+# The application 'bundle' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require "rubygems"
+
+m = Module.new do
+ module_function
+
+ def invoked_as_script?
+ File.expand_path($0) == File.expand_path(__FILE__)
+ end
+
+ def env_var_version
+ ENV["BUNDLER_VERSION"]
+ end
+
+ def cli_arg_version
+ return unless invoked_as_script? # don't want to hijack other binstubs
+ return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
+ bundler_version = nil
+ update_index = nil
+ ARGV.each_with_index do |a, i|
+ if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
+ bundler_version = a
+ end
+ next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
+ bundler_version = $1
+ update_index = i
+ end
+ bundler_version
+ end
+
+ def gemfile
+ gemfile = ENV["BUNDLE_GEMFILE"]
+ return gemfile if gemfile && !gemfile.empty?
+
+ File.expand_path("../../Gemfile", __FILE__)
+ end
+
+ def lockfile
+ lockfile =
+ case File.basename(gemfile)
+ when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
+ else "#{gemfile}.lock"
+ end
+ File.expand_path(lockfile)
+ end
+
+ def lockfile_version
+ return unless File.file?(lockfile)
+ lockfile_contents = File.read(lockfile)
+ return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
+ Regexp.last_match(1)
+ end
+
+ def bundler_requirement
+ @bundler_requirement ||=
+ env_var_version || cli_arg_version ||
+ bundler_requirement_for(lockfile_version)
+ end
+
+ def bundler_requirement_for(version)
+ return "#{Gem::Requirement.default}.a" unless version
+
+ bundler_gem_version = Gem::Version.new(version)
+
+ requirement = bundler_gem_version.approximate_recommendation
+
+ return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0")
+
+ requirement += ".a" if bundler_gem_version.prerelease?
+
+ requirement
+ end
+
+ def load_bundler!
+ ENV["BUNDLE_GEMFILE"] ||= gemfile
+
+ activate_bundler
+ end
+
+ def activate_bundler
+ gem_error = activation_error_handling do
+ gem "bundler", bundler_requirement
+ end
+ return if gem_error.nil?
+ require_error = activation_error_handling do
+ require "bundler/version"
+ end
+ return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
+ warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
+ exit 42
+ end
+
+ def activation_error_handling
+ yield
+ nil
+ rescue StandardError, LoadError => e
+ e
+ end
+end
+
+m.load_bundler!
+
+if m.invoked_as_script?
+ load Gem.bin_path("bundler", "bundle")
+end
diff --git a/week_6/activity-tracker/bin/importmap b/week_6/activity-tracker/bin/importmap
new file mode 100755
index 00000000..36502ab1
--- /dev/null
+++ b/week_6/activity-tracker/bin/importmap
@@ -0,0 +1,4 @@
+#!/usr/bin/env ruby
+
+require_relative "../config/application"
+require "importmap/commands"
diff --git a/week_6/activity-tracker/bin/rails b/week_6/activity-tracker/bin/rails
new file mode 100755
index 00000000..efc03774
--- /dev/null
+++ b/week_6/activity-tracker/bin/rails
@@ -0,0 +1,4 @@
+#!/usr/bin/env ruby
+APP_PATH = File.expand_path("../config/application", __dir__)
+require_relative "../config/boot"
+require "rails/commands"
diff --git a/week_6/activity-tracker/bin/rake b/week_6/activity-tracker/bin/rake
new file mode 100755
index 00000000..4fbf10b9
--- /dev/null
+++ b/week_6/activity-tracker/bin/rake
@@ -0,0 +1,4 @@
+#!/usr/bin/env ruby
+require_relative "../config/boot"
+require "rake"
+Rake.application.run
diff --git a/week_6/activity-tracker/bin/setup b/week_6/activity-tracker/bin/setup
new file mode 100755
index 00000000..ec47b79b
--- /dev/null
+++ b/week_6/activity-tracker/bin/setup
@@ -0,0 +1,33 @@
+#!/usr/bin/env ruby
+require "fileutils"
+
+# path to your application root.
+APP_ROOT = File.expand_path("..", __dir__)
+
+def system!(*args)
+ system(*args) || abort("\n== Command #{args} failed ==")
+end
+
+FileUtils.chdir APP_ROOT do
+ # This script is a way to set up or update your development environment automatically.
+ # This script is idempotent, so that you can run it at any time and get an expectable outcome.
+ # Add necessary setup steps to this file.
+
+ puts "== Installing dependencies =="
+ system! "gem install bundler --conservative"
+ system("bundle check") || system!("bundle install")
+
+ # puts "\n== Copying sample files =="
+ # unless File.exist?("config/database.yml")
+ # FileUtils.cp "config/database.yml.sample", "config/database.yml"
+ # end
+
+ puts "\n== Preparing database =="
+ system! "bin/rails db:prepare"
+
+ puts "\n== Removing old logs and tempfiles =="
+ system! "bin/rails log:clear tmp:clear"
+
+ puts "\n== Restarting application server =="
+ system! "bin/rails restart"
+end
diff --git a/week_6/activity-tracker/config.ru b/week_6/activity-tracker/config.ru
new file mode 100644
index 00000000..4a3c09a6
--- /dev/null
+++ b/week_6/activity-tracker/config.ru
@@ -0,0 +1,6 @@
+# This file is used by Rack-based servers to start the application.
+
+require_relative "config/environment"
+
+run Rails.application
+Rails.application.load_server
diff --git a/week_6/activity-tracker/config/application.rb b/week_6/activity-tracker/config/application.rb
new file mode 100644
index 00000000..eaab4107
--- /dev/null
+++ b/week_6/activity-tracker/config/application.rb
@@ -0,0 +1,22 @@
+require_relative "boot"
+
+require "rails/all"
+
+# Require the gems listed in Gemfile, including any gems
+# you've limited to :test, :development, or :production.
+Bundler.require(*Rails.groups)
+
+module ActivityTracker
+ class Application < Rails::Application
+ # Initialize configuration defaults for originally generated Rails version.
+ config.load_defaults 7.0
+
+ # Configuration for the application, engines, and railties goes here.
+ #
+ # These settings can be overridden in specific environments using the files
+ # in config/environments, which are processed later.
+ #
+ # config.time_zone = "Central Time (US & Canada)"
+ # config.eager_load_paths << Rails.root.join("extras")
+ end
+end
diff --git a/week_6/activity-tracker/config/boot.rb b/week_6/activity-tracker/config/boot.rb
new file mode 100644
index 00000000..988a5ddc
--- /dev/null
+++ b/week_6/activity-tracker/config/boot.rb
@@ -0,0 +1,4 @@
+ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
+
+require "bundler/setup" # Set up gems listed in the Gemfile.
+require "bootsnap/setup" # Speed up boot time by caching expensive operations.
diff --git a/week_6/activity-tracker/config/cable.yml b/week_6/activity-tracker/config/cable.yml
new file mode 100644
index 00000000..fc223da2
--- /dev/null
+++ b/week_6/activity-tracker/config/cable.yml
@@ -0,0 +1,10 @@
+development:
+ adapter: async
+
+test:
+ adapter: test
+
+production:
+ adapter: redis
+ url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
+ channel_prefix: activity_tracker_production
diff --git a/week_6/activity-tracker/config/credentials.yml.enc b/week_6/activity-tracker/config/credentials.yml.enc
new file mode 100644
index 00000000..a9fb37fc
--- /dev/null
+++ b/week_6/activity-tracker/config/credentials.yml.enc
@@ -0,0 +1 @@
+B6LyCTT0OSzAQblaMdACnO9BWBVrdazuj9ePgXYzYDJFqF1umLRqFxau0GHmZ53Q6o2ZNcyylAMWRsUSe7VoQK5Ve0WRhJvDhCHRpOn2zWsDG6y2sVIyR1l0VVp5/FfsLE5L/S9TF/HDI2V3Xv8iBqPKoGyHleL582VbO5v5z9d7ayJ5OjFeXDGmZIe4mzhauB4rYc22mUIBGZRhrcIjStdOf3OZXTdqtM3e4/khwH7WvEpiqKSh1LtuDxHLJHQfWKG5yD+EjEBxUtAwfCWL69QFCKsxEtMo91xDkE0/FjoFURg4ncoHcOYA6i1Fju6Lzhe6Wac55NF8yncuyWlL2bj2gSL2LaY6YLCly671SrgA8rpFr5Z8n78IOG7eAqymtxuVVIyIVYreg+OGrPyqjgNZPLV8ekf8pglu--M5CpQcLB+KsgPPI3--o+u1mu1B/YBf2fAURRqFkg==
\ No newline at end of file
diff --git a/week_6/activity-tracker/config/database.yml b/week_6/activity-tracker/config/database.yml
new file mode 100644
index 00000000..fcba57f1
--- /dev/null
+++ b/week_6/activity-tracker/config/database.yml
@@ -0,0 +1,25 @@
+# SQLite. Versions 3.8.0 and up are supported.
+# gem install sqlite3
+#
+# Ensure the SQLite 3 gem is defined in your Gemfile
+# gem "sqlite3"
+#
+default: &default
+ adapter: sqlite3
+ pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
+ timeout: 5000
+
+development:
+ <<: *default
+ database: db/development.sqlite3
+
+# Warning: The database defined as "test" will be erased and
+# re-generated from your development database when you run "rake".
+# Do not set this db to the same as development or production.
+test:
+ <<: *default
+ database: db/test.sqlite3
+
+production:
+ <<: *default
+ database: db/production.sqlite3
diff --git a/week_6/activity-tracker/config/environment.rb b/week_6/activity-tracker/config/environment.rb
new file mode 100644
index 00000000..cac53157
--- /dev/null
+++ b/week_6/activity-tracker/config/environment.rb
@@ -0,0 +1,5 @@
+# Load the Rails application.
+require_relative "application"
+
+# Initialize the Rails application.
+Rails.application.initialize!
diff --git a/week_6/activity-tracker/config/environments/development.rb b/week_6/activity-tracker/config/environments/development.rb
new file mode 100644
index 00000000..8500f459
--- /dev/null
+++ b/week_6/activity-tracker/config/environments/development.rb
@@ -0,0 +1,70 @@
+require "active_support/core_ext/integer/time"
+
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
+
+ # In the development environment your application's code is reloaded any time
+ # it changes. This slows down response time but is perfect for development
+ # since you don't have to restart the web server when you make code changes.
+ config.cache_classes = false
+
+ # Do not eager load code on boot.
+ config.eager_load = false
+
+ # Show full error reports.
+ config.consider_all_requests_local = true
+
+ # Enable server timing
+ config.server_timing = true
+
+ # Enable/disable caching. By default caching is disabled.
+ # Run rails dev:cache to toggle caching.
+ if Rails.root.join("tmp/caching-dev.txt").exist?
+ config.action_controller.perform_caching = true
+ config.action_controller.enable_fragment_cache_logging = true
+
+ config.cache_store = :memory_store
+ config.public_file_server.headers = {
+ "Cache-Control" => "public, max-age=#{2.days.to_i}"
+ }
+ else
+ config.action_controller.perform_caching = false
+
+ config.cache_store = :null_store
+ end
+
+ # Store uploaded files on the local file system (see config/storage.yml for options).
+ config.active_storage.service = :local
+
+ # Don't care if the mailer can't send.
+ config.action_mailer.raise_delivery_errors = false
+
+ config.action_mailer.perform_caching = false
+
+ # Print deprecation notices to the Rails logger.
+ config.active_support.deprecation = :log
+
+ # Raise exceptions for disallowed deprecations.
+ config.active_support.disallowed_deprecation = :raise
+
+ # Tell Active Support which deprecation messages to disallow.
+ config.active_support.disallowed_deprecation_warnings = []
+
+ # Raise an error on page load if there are pending migrations.
+ config.active_record.migration_error = :page_load
+
+ # Highlight code that triggered database queries in logs.
+ config.active_record.verbose_query_logs = true
+
+ # Suppress logger output for asset requests.
+ config.assets.quiet = true
+
+ # Raises error for missing translations.
+ # config.i18n.raise_on_missing_translations = true
+
+ # Annotate rendered view with file names.
+ # config.action_view.annotate_rendered_view_with_filenames = true
+
+ # Uncomment if you wish to allow Action Cable access from any origin.
+ # config.action_cable.disable_request_forgery_protection = true
+end
diff --git a/week_6/activity-tracker/config/environments/production.rb b/week_6/activity-tracker/config/environments/production.rb
new file mode 100644
index 00000000..86a19e32
--- /dev/null
+++ b/week_6/activity-tracker/config/environments/production.rb
@@ -0,0 +1,93 @@
+require "active_support/core_ext/integer/time"
+
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
+
+ # Code is not reloaded between requests.
+ config.cache_classes = true
+
+ # Eager load code on boot. This eager loads most of Rails and
+ # your application in memory, allowing both threaded web servers
+ # and those relying on copy on write to perform better.
+ # Rake tasks automatically ignore this option for performance.
+ config.eager_load = true
+
+ # Full error reports are disabled and caching is turned on.
+ config.consider_all_requests_local = false
+ config.action_controller.perform_caching = true
+
+ # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
+ # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
+ # config.require_master_key = true
+
+ # Disable serving static files from the `/public` folder by default since
+ # Apache or NGINX already handles this.
+ config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
+
+ # Compress CSS using a preprocessor.
+ # config.assets.css_compressor = :sass
+
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
+ config.assets.compile = false
+
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
+ # config.asset_host = "http://assets.example.com"
+
+ # Specifies the header that your server uses for sending files.
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
+ # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
+
+ # Store uploaded files on the local file system (see config/storage.yml for options).
+ config.active_storage.service = :local
+
+ # Mount Action Cable outside main process or domain.
+ # config.action_cable.mount_path = nil
+ # config.action_cable.url = "wss://example.com/cable"
+ # config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]
+
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
+ # config.force_ssl = true
+
+ # Include generic and useful information about system operation, but avoid logging too much
+ # information to avoid inadvertent exposure of personally identifiable information (PII).
+ config.log_level = :info
+
+ # Prepend all log lines with the following tags.
+ config.log_tags = [ :request_id ]
+
+ # Use a different cache store in production.
+ # config.cache_store = :mem_cache_store
+
+ # Use a real queuing backend for Active Job (and separate queues per environment).
+ # config.active_job.queue_adapter = :resque
+ # config.active_job.queue_name_prefix = "activity_tracker_production"
+
+ config.action_mailer.perform_caching = false
+
+ # Ignore bad email addresses and do not raise email delivery errors.
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
+ # config.action_mailer.raise_delivery_errors = false
+
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
+ # the I18n.default_locale when a translation cannot be found).
+ config.i18n.fallbacks = true
+
+ # Don't log any deprecations.
+ config.active_support.report_deprecations = false
+
+ # Use default logging formatter so that PID and timestamp are not suppressed.
+ config.log_formatter = ::Logger::Formatter.new
+
+ # Use a different logger for distributed setups.
+ # require "syslog/logger"
+ # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name")
+
+ if ENV["RAILS_LOG_TO_STDOUT"].present?
+ logger = ActiveSupport::Logger.new(STDOUT)
+ logger.formatter = config.log_formatter
+ config.logger = ActiveSupport::TaggedLogging.new(logger)
+ end
+
+ # Do not dump schema after migrations.
+ config.active_record.dump_schema_after_migration = false
+end
diff --git a/week_6/activity-tracker/config/environments/test.rb b/week_6/activity-tracker/config/environments/test.rb
new file mode 100644
index 00000000..6ea4d1e7
--- /dev/null
+++ b/week_6/activity-tracker/config/environments/test.rb
@@ -0,0 +1,60 @@
+require "active_support/core_ext/integer/time"
+
+# The test environment is used exclusively to run your application's
+# test suite. You never need to work with it otherwise. Remember that
+# your test database is "scratch space" for the test suite and is wiped
+# and recreated between test runs. Don't rely on the data there!
+
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
+
+ # Turn false under Spring and add config.action_view.cache_template_loading = true.
+ config.cache_classes = true
+
+ # Eager loading loads your whole application. When running a single test locally,
+ # this probably isn't necessary. It's a good idea to do in a continuous integration
+ # system, or in some way before deploying your code.
+ config.eager_load = ENV["CI"].present?
+
+ # Configure public file server for tests with Cache-Control for performance.
+ config.public_file_server.enabled = true
+ config.public_file_server.headers = {
+ "Cache-Control" => "public, max-age=#{1.hour.to_i}"
+ }
+
+ # Show full error reports and disable caching.
+ config.consider_all_requests_local = true
+ config.action_controller.perform_caching = false
+ config.cache_store = :null_store
+
+ # Raise exceptions instead of rendering exception templates.
+ config.action_dispatch.show_exceptions = false
+
+ # Disable request forgery protection in test environment.
+ config.action_controller.allow_forgery_protection = false
+
+ # Store uploaded files on the local file system in a temporary directory.
+ config.active_storage.service = :test
+
+ config.action_mailer.perform_caching = false
+
+ # Tell Action Mailer not to deliver emails to the real world.
+ # The :test delivery method accumulates sent emails in the
+ # ActionMailer::Base.deliveries array.
+ config.action_mailer.delivery_method = :test
+
+ # Print deprecation notices to the stderr.
+ config.active_support.deprecation = :stderr
+
+ # Raise exceptions for disallowed deprecations.
+ config.active_support.disallowed_deprecation = :raise
+
+ # Tell Active Support which deprecation messages to disallow.
+ config.active_support.disallowed_deprecation_warnings = []
+
+ # Raises error for missing translations.
+ # config.i18n.raise_on_missing_translations = true
+
+ # Annotate rendered view with file names.
+ # config.action_view.annotate_rendered_view_with_filenames = true
+end
diff --git a/week_6/activity-tracker/config/importmap.rb b/week_6/activity-tracker/config/importmap.rb
new file mode 100644
index 00000000..8dce42d4
--- /dev/null
+++ b/week_6/activity-tracker/config/importmap.rb
@@ -0,0 +1,7 @@
+# Pin npm packages by running ./bin/importmap
+
+pin "application", preload: true
+pin "@hotwired/turbo-rails", to: "turbo.min.js", preload: true
+pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true
+pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true
+pin_all_from "app/javascript/controllers", under: "controllers"
diff --git a/week_6/activity-tracker/config/initializers/assets.rb b/week_6/activity-tracker/config/initializers/assets.rb
new file mode 100644
index 00000000..2eeef966
--- /dev/null
+++ b/week_6/activity-tracker/config/initializers/assets.rb
@@ -0,0 +1,12 @@
+# Be sure to restart your server when you modify this file.
+
+# Version of your assets, change this if you want to expire all your assets.
+Rails.application.config.assets.version = "1.0"
+
+# Add additional assets to the asset load path.
+# Rails.application.config.assets.paths << Emoji.images_path
+
+# Precompile additional assets.
+# application.js, application.css, and all non-JS/CSS in the app/assets
+# folder are already added.
+# Rails.application.config.assets.precompile += %w( admin.js admin.css )
diff --git a/week_6/activity-tracker/config/initializers/content_security_policy.rb b/week_6/activity-tracker/config/initializers/content_security_policy.rb
new file mode 100644
index 00000000..54f47cf1
--- /dev/null
+++ b/week_6/activity-tracker/config/initializers/content_security_policy.rb
@@ -0,0 +1,25 @@
+# Be sure to restart your server when you modify this file.
+
+# Define an application-wide content security policy.
+# See the Securing Rails Applications Guide for more information:
+# https://guides.rubyonrails.org/security.html#content-security-policy-header
+
+# Rails.application.configure do
+# config.content_security_policy do |policy|
+# policy.default_src :self, :https
+# policy.font_src :self, :https, :data
+# policy.img_src :self, :https, :data
+# policy.object_src :none
+# policy.script_src :self, :https
+# policy.style_src :self, :https
+# # Specify URI for violation reports
+# # policy.report_uri "/csp-violation-report-endpoint"
+# end
+#
+# # Generate session nonces for permitted importmap and inline scripts
+# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
+# config.content_security_policy_nonce_directives = %w(script-src)
+#
+# # Report violations without enforcing the policy.
+# # config.content_security_policy_report_only = true
+# end
diff --git a/week_6/activity-tracker/config/initializers/devise.rb b/week_6/activity-tracker/config/initializers/devise.rb
new file mode 100644
index 00000000..ce1e8e4e
--- /dev/null
+++ b/week_6/activity-tracker/config/initializers/devise.rb
@@ -0,0 +1,313 @@
+# frozen_string_literal: true
+
+# Assuming you have not yet modified this file, each configuration option below
+# is set to its default value. Note that some are commented out while others
+# are not: uncommented lines are intended to protect your configuration from
+# breaking changes in upgrades (i.e., in the event that future versions of
+# Devise change the default values for those options).
+#
+# Use this hook to configure devise mailer, warden hooks and so forth.
+# Many of these configuration options can be set straight in your model.
+Devise.setup do |config|
+ # The secret key used by Devise. Devise uses this key to generate
+ # random tokens. Changing this key will render invalid all existing
+ # confirmation, reset password and unlock tokens in the database.
+ # Devise will use the `secret_key_base` as its `secret_key`
+ # by default. You can change it below and use your own secret key.
+ # config.secret_key = '312a7aed690014501b31b78831152e3c90d42570b72b13f649f15d79369219844731106d86fb12a8ec2a210f3c222e4338b057c93ee25c08355d6ee020c181ca'
+
+ # ==> Controller configuration
+ # Configure the parent class to the devise controllers.
+ # config.parent_controller = 'DeviseController'
+
+ # ==> Mailer Configuration
+ # Configure the e-mail address which will be shown in Devise::Mailer,
+ # note that it will be overwritten if you use your own mailer class
+ # with default "from" parameter.
+ config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
+ config.navigational_formats = ['*/*', :html, :turbo_stream]
+ # Configure the class responsible to send e-mails.
+ # config.mailer = 'Devise::Mailer'
+
+ # Configure the parent class responsible to send e-mails.
+ # config.parent_mailer = 'ActionMailer::Base'
+
+ # ==> ORM configuration
+ # Load and configure the ORM. Supports :active_record (default) and
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
+ # available as additional gems.
+ require 'devise/orm/active_record'
+
+ # ==> Configuration for any authentication mechanism
+ # Configure which keys are used when authenticating a user. The default is
+ # just :email. You can configure it to use [:username, :subdomain], so for
+ # authenticating a user, both parameters are required. Remember that those
+ # parameters are used only when authenticating and not when retrieving from
+ # session. If you need permissions, you should implement that in a before filter.
+ # You can also supply a hash where the value is a boolean determining whether
+ # or not authentication should be aborted when the value is not present.
+ # config.authentication_keys = [:email]
+
+ # Configure parameters from the request object used for authentication. Each entry
+ # given should be a request method and it will automatically be passed to the
+ # find_for_authentication method and considered in your model lookup. For instance,
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
+ # config.request_keys = []
+
+ # Configure which authentication keys should be case-insensitive.
+ # These keys will be downcased upon creating or modifying a user and when used
+ # to authenticate or find a user. Default is :email.
+ config.case_insensitive_keys = [:email]
+
+ # Configure which authentication keys should have whitespace stripped.
+ # These keys will have whitespace before and after removed upon creating or
+ # modifying a user and when used to authenticate or find a user. Default is :email.
+ config.strip_whitespace_keys = [:email]
+
+ # Tell if authentication through request.params is enabled. True by default.
+ # It can be set to an array that will enable params authentication only for the
+ # given strategies, for example, `config.params_authenticatable = [:database]` will
+ # enable it only for database (email + password) authentication.
+ # config.params_authenticatable = true
+
+ # Tell if authentication through HTTP Auth is enabled. False by default.
+ # It can be set to an array that will enable http authentication only for the
+ # given strategies, for example, `config.http_authenticatable = [:database]` will
+ # enable it only for database authentication.
+ # For API-only applications to support authentication "out-of-the-box", you will likely want to
+ # enable this with :database unless you are using a custom strategy.
+ # The supported strategies are:
+ # :database = Support basic authentication with authentication key + password
+ # config.http_authenticatable = false
+
+ # If 401 status code should be returned for AJAX requests. True by default.
+ # config.http_authenticatable_on_xhr = true
+
+ # The realm used in Http Basic Authentication. 'Application' by default.
+ # config.http_authentication_realm = 'Application'
+
+ # It will change confirmation, password recovery and other workflows
+ # to behave the same regardless if the e-mail provided was right or wrong.
+ # Does not affect registerable.
+ # config.paranoid = true
+
+ # By default Devise will store the user in session. You can skip storage for
+ # particular strategies by setting this option.
+ # Notice that if you are skipping storage for all authentication paths, you
+ # may want to disable generating routes to Devise's sessions controller by
+ # passing skip: :sessions to `devise_for` in your config/routes.rb
+ config.skip_session_storage = [:http_auth]
+
+ # By default, Devise cleans up the CSRF token on authentication to
+ # avoid CSRF token fixation attacks. This means that, when using AJAX
+ # requests for sign in and sign up, you need to get a new CSRF token
+ # from the server. You can disable this option at your own risk.
+ # config.clean_up_csrf_token_on_authentication = true
+
+ # When false, Devise will not attempt to reload routes on eager load.
+ # This can reduce the time taken to boot the app but if your application
+ # requires the Devise mappings to be loaded during boot time the application
+ # won't boot properly.
+ # config.reload_routes = true
+
+ # ==> Configuration for :database_authenticatable
+ # For bcrypt, this is the cost for hashing the password and defaults to 12. If
+ # using other algorithms, it sets how many times you want the password to be hashed.
+ # The number of stretches used for generating the hashed password are stored
+ # with the hashed password. This allows you to change the stretches without
+ # invalidating existing passwords.
+ #
+ # Limiting the stretches to just one in testing will increase the performance of
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
+ # a value less than 10 in other environments. Note that, for bcrypt (the default
+ # algorithm), the cost increases exponentially with the number of stretches (e.g.
+ # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
+ config.stretches = Rails.env.test? ? 1 : 12
+
+ # Set up a pepper to generate the hashed password.
+ # config.pepper = '861b44cfb251b3f71be5a4e261577a132a981e087dcab5a71b0ace7748ae792e90cda96e9cd15aac279a3fb03a528f6c68b8f05beed4c24643cce9823e3cec6d'
+
+ # Send a notification to the original email when the user's email is changed.
+ # config.send_email_changed_notification = false
+
+ # Send a notification email when the user's password is changed.
+ # config.send_password_change_notification = false
+
+ # ==> Configuration for :confirmable
+ # A period that the user is allowed to access the website even without
+ # confirming their account. For instance, if set to 2.days, the user will be
+ # able to access the website for two days without confirming their account,
+ # access will be blocked just in the third day.
+ # You can also set it to nil, which will allow the user to access the website
+ # without confirming their account.
+ # Default is 0.days, meaning the user cannot access the website without
+ # confirming their account.
+ # config.allow_unconfirmed_access_for = 2.days
+
+ # A period that the user is allowed to confirm their account before their
+ # token becomes invalid. For example, if set to 3.days, the user can confirm
+ # their account within 3 days after the mail was sent, but on the fourth day
+ # their account can't be confirmed with the token any more.
+ # Default is nil, meaning there is no restriction on how long a user can take
+ # before confirming their account.
+ # config.confirm_within = 3.days
+
+ # If true, requires any email changes to be confirmed (exactly the same way as
+ # initial account confirmation) to be applied. Requires additional unconfirmed_email
+ # db field (see migrations). Until confirmed, new email is stored in
+ # unconfirmed_email column, and copied to email column on successful confirmation.
+ config.reconfirmable = true
+
+ # Defines which key will be used when confirming an account
+ # config.confirmation_keys = [:email]
+
+ # ==> Configuration for :rememberable
+ # The time the user will be remembered without asking for credentials again.
+ # config.remember_for = 2.weeks
+
+ # Invalidates all the remember me tokens when the user signs out.
+ config.expire_all_remember_me_on_sign_out = true
+
+ # If true, extends the user's remember period when remembered via cookie.
+ # config.extend_remember_period = false
+
+ # Options to be passed to the created cookie. For instance, you can set
+ # secure: true in order to force SSL only cookies.
+ # config.rememberable_options = {}
+
+ # ==> Configuration for :validatable
+ # Range for password length.
+ config.password_length = 6..128
+
+ # Email regex used to validate email formats. It simply asserts that
+ # one (and only one) @ exists in the given string. This is mainly
+ # to give user feedback and not to assert the e-mail validity.
+ config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
+
+ # ==> Configuration for :timeoutable
+ # The time you want to timeout the user session without activity. After this
+ # time the user will be asked for credentials again. Default is 30 minutes.
+ # config.timeout_in = 30.minutes
+
+ # ==> Configuration for :lockable
+ # Defines which strategy will be used to lock an account.
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
+ # :none = No lock strategy. You should handle locking by yourself.
+ # config.lock_strategy = :failed_attempts
+
+ # Defines which key will be used when locking and unlocking an account
+ # config.unlock_keys = [:email]
+
+ # Defines which strategy will be used to unlock an account.
+ # :email = Sends an unlock link to the user email
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
+ # :both = Enables both strategies
+ # :none = No unlock strategy. You should handle unlocking by yourself.
+ # config.unlock_strategy = :both
+
+ # Number of authentication tries before locking an account if lock_strategy
+ # is failed attempts.
+ # config.maximum_attempts = 20
+
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
+ # config.unlock_in = 1.hour
+
+ # Warn on the last attempt before the account is locked.
+ # config.last_attempt_warning = true
+
+ # ==> Configuration for :recoverable
+ #
+ # Defines which key will be used when recovering the password for an account
+ # config.reset_password_keys = [:email]
+
+ # Time interval you can reset your password with a reset password key.
+ # Don't put a too small interval or your users won't have the time to
+ # change their passwords.
+ config.reset_password_within = 6.hours
+
+ # When set to false, does not sign a user in automatically after their password is
+ # reset. Defaults to true, so a user is signed in automatically after a reset.
+ # config.sign_in_after_reset_password = true
+
+ # ==> Configuration for :encryptable
+ # Allow you to use another hashing or encryption algorithm besides bcrypt (default).
+ # You can use :sha1, :sha512 or algorithms from others authentication tools as
+ # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
+ # for default behavior) and :restful_authentication_sha1 (then you should set
+ # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
+ #
+ # Require the `devise-encryptable` gem when using anything other than bcrypt
+ # config.encryptor = :sha512
+
+ # ==> Scopes configuration
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
+ # "users/sessions/new". It's turned off by default because it's slower if you
+ # are using only default views.
+ # config.scoped_views = false
+
+ # Configure the default scope given to Warden. By default it's the first
+ # devise role declared in your routes (usually :user).
+ # config.default_scope = :user
+
+ # Set this configuration to false if you want /users/sign_out to sign out
+ # only the current scope. By default, Devise signs out all scopes.
+ # config.sign_out_all_scopes = true
+
+ # ==> Navigation configuration
+ # Lists the formats that should be treated as navigational. Formats like
+ # :html should redirect to the sign in page when the user does not have
+ # access, but formats like :xml or :json, should return 401.
+ #
+ # If you have any extra navigational formats, like :iphone or :mobile, you
+ # should add them to the navigational formats lists.
+ #
+ # The "*/*" below is required to match Internet Explorer requests.
+ # config.navigational_formats = ['*/*', :html, :turbo_stream]
+
+ # The default HTTP method used to sign out a resource. Default is :delete.
+ config.sign_out_via = :delete
+
+ # ==> OmniAuth
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
+ # up on your models and hooks.
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
+
+ # ==> Warden configuration
+ # If you want to use other strategies, that are not supported by Devise, or
+ # change the failure app, you can configure them inside the config.warden block.
+ #
+ # config.warden do |manager|
+ # manager.intercept_401 = false
+ # manager.default_strategies(scope: :user).unshift :some_external_strategy
+ # end
+
+ # ==> Mountable engine configurations
+ # When using Devise inside an engine, let's call it `MyEngine`, and this engine
+ # is mountable, there are some extra configurations to be taken into account.
+ # The following options are available, assuming the engine is mounted as:
+ #
+ # mount MyEngine, at: '/my_engine'
+ #
+ # The router that invoked `devise_for`, in the example above, would be:
+ # config.router_name = :my_engine
+ #
+ # When using OmniAuth, Devise cannot automatically set OmniAuth path,
+ # so you need to do it manually. For the users scope, it would be:
+ # config.omniauth_path_prefix = '/my_engine/users/auth'
+
+ # ==> Hotwire/Turbo configuration
+ # When using Devise with Hotwire/Turbo, the http status for error responses
+ # and some redirects must match the following. The default in Devise for existing
+ # apps is `200 OK` and `302 Found respectively`, but new apps are generated with
+ # these new defaults that match Hotwire/Turbo behavior.
+ # Note: These might become the new default in future versions of Devise.
+ config.responder.error_status = :unprocessable_entity
+ config.responder.redirect_status = :see_other
+
+ # ==> Configuration for :registerable
+
+ # When set to false, does not sign a user in automatically after their password is
+ # changed. Defaults to true, so a user is signed in automatically after changing a password.
+ # config.sign_in_after_change_password = true
+end
diff --git a/week_6/activity-tracker/config/initializers/filter_parameter_logging.rb b/week_6/activity-tracker/config/initializers/filter_parameter_logging.rb
new file mode 100644
index 00000000..adc6568c
--- /dev/null
+++ b/week_6/activity-tracker/config/initializers/filter_parameter_logging.rb
@@ -0,0 +1,8 @@
+# Be sure to restart your server when you modify this file.
+
+# Configure parameters to be filtered from the log file. Use this to limit dissemination of
+# sensitive information. See the ActiveSupport::ParameterFilter documentation for supported
+# notations and behaviors.
+Rails.application.config.filter_parameters += [
+ :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
+]
diff --git a/week_6/activity-tracker/config/initializers/inflections.rb b/week_6/activity-tracker/config/initializers/inflections.rb
new file mode 100644
index 00000000..3860f659
--- /dev/null
+++ b/week_6/activity-tracker/config/initializers/inflections.rb
@@ -0,0 +1,16 @@
+# Be sure to restart your server when you modify this file.
+
+# Add new inflection rules using the following format. Inflections
+# are locale specific, and you may define rules for as many different
+# locales as you wish. All of these examples are active by default:
+# ActiveSupport::Inflector.inflections(:en) do |inflect|
+# inflect.plural /^(ox)$/i, "\\1en"
+# inflect.singular /^(ox)en/i, "\\1"
+# inflect.irregular "person", "people"
+# inflect.uncountable %w( fish sheep )
+# end
+
+# These inflection rules are supported but not enabled by default:
+# ActiveSupport::Inflector.inflections(:en) do |inflect|
+# inflect.acronym "RESTful"
+# end
diff --git a/week_6/activity-tracker/config/initializers/permissions_policy.rb b/week_6/activity-tracker/config/initializers/permissions_policy.rb
new file mode 100644
index 00000000..00f64d71
--- /dev/null
+++ b/week_6/activity-tracker/config/initializers/permissions_policy.rb
@@ -0,0 +1,11 @@
+# Define an application-wide HTTP permissions policy. For further
+# information see https://developers.google.com/web/updates/2018/06/feature-policy
+#
+# Rails.application.config.permissions_policy do |f|
+# f.camera :none
+# f.gyroscope :none
+# f.microphone :none
+# f.usb :none
+# f.fullscreen :self
+# f.payment :self, "https://secure.example.com"
+# end
diff --git a/week_6/activity-tracker/config/locales/devise.en.yml b/week_6/activity-tracker/config/locales/devise.en.yml
new file mode 100644
index 00000000..260e1c4b
--- /dev/null
+++ b/week_6/activity-tracker/config/locales/devise.en.yml
@@ -0,0 +1,65 @@
+# Additional translations at https://github.com/heartcombo/devise/wiki/I18n
+
+en:
+ devise:
+ confirmations:
+ confirmed: "Your email address has been successfully confirmed."
+ send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes."
+ send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes."
+ failure:
+ already_authenticated: "You are already signed in."
+ inactive: "Your account is not activated yet."
+ invalid: "Invalid %{authentication_keys} or password."
+ locked: "Your account is locked."
+ last_attempt: "You have one more attempt before your account is locked."
+ not_found_in_database: "Invalid %{authentication_keys} or password."
+ timeout: "Your session expired. Please sign in again to continue."
+ unauthenticated: "You need to sign in or sign up before continuing."
+ unconfirmed: "You have to confirm your email address before continuing."
+ mailer:
+ confirmation_instructions:
+ subject: "Confirmation instructions"
+ reset_password_instructions:
+ subject: "Reset password instructions"
+ unlock_instructions:
+ subject: "Unlock instructions"
+ email_changed:
+ subject: "Email Changed"
+ password_change:
+ subject: "Password Changed"
+ omniauth_callbacks:
+ failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
+ success: "Successfully authenticated from %{kind} account."
+ passwords:
+ no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
+ send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
+ send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
+ updated: "Your password has been changed successfully. You are now signed in."
+ updated_not_active: "Your password has been changed successfully."
+ registrations:
+ destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
+ signed_up: "Welcome! You have signed up successfully."
+ signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
+ signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
+ signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account."
+ update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirmation link to confirm your new email address."
+ updated: "Your account has been updated successfully."
+ updated_but_not_signed_in: "Your account has been updated successfully, but since your password was changed, you need to sign in again."
+ sessions:
+ signed_in: "Signed in successfully."
+ signed_out: "Signed out successfully."
+ already_signed_out: "Signed out successfully."
+ unlocks:
+ send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
+ send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
+ unlocked: "Your account has been unlocked successfully. Please sign in to continue."
+ errors:
+ messages:
+ already_confirmed: "was already confirmed, please try signing in"
+ confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
+ expired: "has expired, please request a new one"
+ not_found: "not found"
+ not_locked: "was not locked"
+ not_saved:
+ one: "1 error prohibited this %{resource} from being saved:"
+ other: "%{count} errors prohibited this %{resource} from being saved:"
diff --git a/week_6/activity-tracker/config/locales/en.yml b/week_6/activity-tracker/config/locales/en.yml
new file mode 100644
index 00000000..8ca56fc7
--- /dev/null
+++ b/week_6/activity-tracker/config/locales/en.yml
@@ -0,0 +1,33 @@
+# Files in the config/locales directory are used for internationalization
+# and are automatically loaded by Rails. If you want to use locales other
+# than English, add the necessary files in this directory.
+#
+# To use the locales, use `I18n.t`:
+#
+# I18n.t "hello"
+#
+# In views, this is aliased to just `t`:
+#
+# <%= t("hello") %>
+#
+# To use a different locale, set it with `I18n.locale`:
+#
+# I18n.locale = :es
+#
+# This would use the information in config/locales/es.yml.
+#
+# The following keys must be escaped otherwise they will not be retrieved by
+# the default I18n backend:
+#
+# true, false, on, off, yes, no
+#
+# Instead, surround them with single quotes.
+#
+# en:
+# "true": "foo"
+#
+# To learn more, please read the Rails Internationalization guide
+# available at https://guides.rubyonrails.org/i18n.html.
+
+en:
+ hello: "Hello world"
diff --git a/week_6/activity-tracker/config/puma.rb b/week_6/activity-tracker/config/puma.rb
new file mode 100644
index 00000000..daaf0369
--- /dev/null
+++ b/week_6/activity-tracker/config/puma.rb
@@ -0,0 +1,43 @@
+# Puma can serve each request in a thread from an internal thread pool.
+# The `threads` method setting takes two numbers: a minimum and maximum.
+# Any libraries that use thread pools should be configured to match
+# the maximum value specified for Puma. Default is set to 5 threads for minimum
+# and maximum; this matches the default thread size of Active Record.
+#
+max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
+min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
+threads min_threads_count, max_threads_count
+
+# Specifies the `worker_timeout` threshold that Puma will use to wait before
+# terminating a worker in development environments.
+#
+worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development"
+
+# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
+#
+port ENV.fetch("PORT") { 3000 }
+
+# Specifies the `environment` that Puma will run in.
+#
+environment ENV.fetch("RAILS_ENV") { "development" }
+
+# Specifies the `pidfile` that Puma will use.
+pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
+
+# Specifies the number of `workers` to boot in clustered mode.
+# Workers are forked web server processes. If using threads and workers together
+# the concurrency of the application would be max `threads` * `workers`.
+# Workers do not work on JRuby or Windows (both of which do not support
+# processes).
+#
+# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
+
+# Use the `preload_app!` method when specifying a `workers` number.
+# This directive tells Puma to first boot the application and load code
+# before forking the application. This takes advantage of Copy On Write
+# process behavior so workers use less memory.
+#
+# preload_app!
+
+# Allow puma to be restarted by `bin/rails restart` command.
+plugin :tmp_restart
diff --git a/week_6/activity-tracker/config/routes.rb b/week_6/activity-tracker/config/routes.rb
new file mode 100644
index 00000000..adb9e480
--- /dev/null
+++ b/week_6/activity-tracker/config/routes.rb
@@ -0,0 +1,15 @@
+Rails.application.routes.draw do
+ get 'static_pages/index'
+ get 'static_pages/about'
+ get 'about',to:"static_pages#about"
+ get 'generate_pdf', to: 'activities#generate_pdf', as: 'generate_pdf_user'
+ devise_for :users
+ resources :activities do
+ collection do
+ get 'stats'
+ end
+ end
+
+ root 'static_pages#index'
+
+end
diff --git a/week_6/activity-tracker/config/storage.yml b/week_6/activity-tracker/config/storage.yml
new file mode 100644
index 00000000..4942ab66
--- /dev/null
+++ b/week_6/activity-tracker/config/storage.yml
@@ -0,0 +1,34 @@
+test:
+ service: Disk
+ root: <%= Rails.root.join("tmp/storage") %>
+
+local:
+ service: Disk
+ root: <%= Rails.root.join("storage") %>
+
+# Use bin/rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
+# amazon:
+# service: S3
+# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
+# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
+# region: us-east-1
+# bucket: your_own_bucket-<%= Rails.env %>
+
+# Remember not to checkin your GCS keyfile to a repository
+# google:
+# service: GCS
+# project: your_project
+# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
+# bucket: your_own_bucket-<%= Rails.env %>
+
+# Use bin/rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
+# microsoft:
+# service: AzureStorage
+# storage_account_name: your_account_name
+# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
+# container: your_container_name-<%= Rails.env %>
+
+# mirror:
+# service: Mirror
+# primary: local
+# mirrors: [ amazon, google, microsoft ]
diff --git a/week_6/activity-tracker/db/migrate/20230223152529_create_activities.rb b/week_6/activity-tracker/db/migrate/20230223152529_create_activities.rb
new file mode 100644
index 00000000..52871291
--- /dev/null
+++ b/week_6/activity-tracker/db/migrate/20230223152529_create_activities.rb
@@ -0,0 +1,13 @@
+class CreateActivities < ActiveRecord::Migration[7.0]
+ def change
+ create_table :activities do |t|
+ t.string :title
+ t.string :activity_type
+ t.datetime :start
+ t.decimal :duration
+ t.integer :calories
+ t.integer :user_id, foreign_key: true
+ t.timestamps
+ end
+ end
+end
diff --git a/week_6/activity-tracker/db/migrate/20230223163803_devise_create_users.rb b/week_6/activity-tracker/db/migrate/20230223163803_devise_create_users.rb
new file mode 100644
index 00000000..43927dbd
--- /dev/null
+++ b/week_6/activity-tracker/db/migrate/20230223163803_devise_create_users.rb
@@ -0,0 +1,44 @@
+# frozen_string_literal: true
+
+class DeviseCreateUsers < ActiveRecord::Migration[7.0]
+ def change
+ create_table :users do |t|
+ ## Database authenticatable
+ t.string :email, null: false, default: ""
+ t.string :encrypted_password, null: false, default: ""
+
+ ## Recoverable
+ t.string :reset_password_token
+ t.datetime :reset_password_sent_at
+
+ ## Rememberable
+ t.datetime :remember_created_at
+
+ ## Trackable
+ # t.integer :sign_in_count, default: 0, null: false
+ # t.datetime :current_sign_in_at
+ # t.datetime :last_sign_in_at
+ # t.string :current_sign_in_ip
+ # t.string :last_sign_in_ip
+
+ ## Confirmable
+ # t.string :confirmation_token
+ # t.datetime :confirmed_at
+ # t.datetime :confirmation_sent_at
+ # t.string :unconfirmed_email # Only if using reconfirmable
+
+ ## Lockable
+ # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
+ # t.string :unlock_token # Only if unlock strategy is :email or :both
+ # t.datetime :locked_at
+
+
+ t.timestamps null: false
+ end
+
+ add_index :users, :email, unique: true
+ add_index :users, :reset_password_token, unique: true
+ # add_index :users, :confirmation_token, unique: true
+ # add_index :users, :unlock_token, unique: true
+ end
+end
diff --git a/week_6/activity-tracker/db/migrate/20230224195846_create_active_storage_tables.active_storage.rb b/week_6/activity-tracker/db/migrate/20230224195846_create_active_storage_tables.active_storage.rb
new file mode 100644
index 00000000..8a7bfe18
--- /dev/null
+++ b/week_6/activity-tracker/db/migrate/20230224195846_create_active_storage_tables.active_storage.rb
@@ -0,0 +1,57 @@
+# This migration comes from active_storage (originally 20170806125915)
+class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
+ def change
+ # Use Active Record's configured type for primary and foreign keys
+ primary_key_type, foreign_key_type = primary_and_foreign_key_types
+
+ create_table :active_storage_blobs, id: primary_key_type do |t|
+ t.string :key, null: false
+ t.string :filename, null: false
+ t.string :content_type
+ t.text :metadata
+ t.string :service_name, null: false
+ t.bigint :byte_size, null: false
+ t.string :checksum
+
+ if connection.supports_datetime_with_precision?
+ t.datetime :created_at, precision: 6, null: false
+ else
+ t.datetime :created_at, null: false
+ end
+
+ t.index [ :key ], unique: true
+ end
+
+ create_table :active_storage_attachments, id: primary_key_type do |t|
+ t.string :name, null: false
+ t.references :record, null: false, polymorphic: true, index: false, type: foreign_key_type
+ t.references :blob, null: false, type: foreign_key_type
+
+ if connection.supports_datetime_with_precision?
+ t.datetime :created_at, precision: 6, null: false
+ else
+ t.datetime :created_at, null: false
+ end
+
+ t.index [ :record_type, :record_id, :name, :blob_id ], name: :index_active_storage_attachments_uniqueness, unique: true
+ t.foreign_key :active_storage_blobs, column: :blob_id
+ end
+
+ create_table :active_storage_variant_records, id: primary_key_type do |t|
+ t.belongs_to :blob, null: false, index: false, type: foreign_key_type
+ t.string :variation_digest, null: false
+
+ t.index [ :blob_id, :variation_digest ], name: :index_active_storage_variant_records_uniqueness, unique: true
+ t.foreign_key :active_storage_blobs, column: :blob_id
+ end
+ end
+
+ private
+ def primary_and_foreign_key_types
+ config = Rails.configuration.generators
+ setting = config.options[config.orm][:primary_key_type]
+ primary_key_type = setting || :primary_key
+ foreign_key_type = setting || :bigint
+ [primary_key_type, foreign_key_type]
+ end
+end
diff --git a/week_6/activity-tracker/db/migrate/20230224211008_add_image_to_activities.rb b/week_6/activity-tracker/db/migrate/20230224211008_add_image_to_activities.rb
new file mode 100644
index 00000000..32ff1199
--- /dev/null
+++ b/week_6/activity-tracker/db/migrate/20230224211008_add_image_to_activities.rb
@@ -0,0 +1,6 @@
+class AddImageToActivities < ActiveRecord::Migration[7.0]
+ def change
+ add_column :activities, :image, :string
+ add_index :activities, :image, unique: true
+ end
+end
diff --git a/week_6/activity-tracker/db/schema.rb b/week_6/activity-tracker/db/schema.rb
new file mode 100644
index 00000000..2a9ab7dc
--- /dev/null
+++ b/week_6/activity-tracker/db/schema.rb
@@ -0,0 +1,69 @@
+# This file is auto-generated from the current state of the database. Instead
+# of editing this file, please use the migrations feature of Active Record to
+# incrementally modify your database, and then regenerate this schema definition.
+#
+# This file is the source Rails uses to define your schema when running `bin/rails
+# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
+# be faster and is potentially less error prone than running all of your
+# migrations from scratch. Old migrations may fail to apply correctly if those
+# migrations use external dependencies or application code.
+#
+# It's strongly recommended that you check this file into your version control system.
+
+ActiveRecord::Schema[7.0].define(version: 2023_02_24_211008) do
+ create_table "active_storage_attachments", force: :cascade do |t|
+ t.string "name", null: false
+ t.string "record_type", null: false
+ t.bigint "record_id", null: false
+ t.bigint "blob_id", null: false
+ t.datetime "created_at", null: false
+ t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id"
+ t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true
+ end
+
+ create_table "active_storage_blobs", force: :cascade do |t|
+ t.string "key", null: false
+ t.string "filename", null: false
+ t.string "content_type"
+ t.text "metadata"
+ t.string "service_name", null: false
+ t.bigint "byte_size", null: false
+ t.string "checksum"
+ t.datetime "created_at", null: false
+ t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
+ end
+
+ create_table "active_storage_variant_records", force: :cascade do |t|
+ t.bigint "blob_id", null: false
+ t.string "variation_digest", null: false
+ t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true
+ end
+
+ create_table "activities", force: :cascade do |t|
+ t.string "title"
+ t.string "activity_type"
+ t.datetime "start"
+ t.decimal "duration"
+ t.integer "calories"
+ t.integer "user_id"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ t.string "image"
+ t.index ["image"], name: "index_activities_on_image", unique: true
+ end
+
+ create_table "users", force: :cascade do |t|
+ t.string "email", default: "", null: false
+ t.string "encrypted_password", default: "", null: false
+ t.string "reset_password_token"
+ t.datetime "reset_password_sent_at"
+ t.datetime "remember_created_at"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ t.index ["email"], name: "index_users_on_email", unique: true
+ t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
+ end
+
+ add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
+ add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
+end
diff --git a/week_6/activity-tracker/db/seeds.rb b/week_6/activity-tracker/db/seeds.rb
new file mode 100644
index 00000000..bc25fce3
--- /dev/null
+++ b/week_6/activity-tracker/db/seeds.rb
@@ -0,0 +1,7 @@
+# This file should contain all the record creation needed to seed the database with its default values.
+# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
+#
+# Examples:
+#
+# movies = Movie.create([{ name: "Star Wars" }, { name: "Lord of the Rings" }])
+# Character.create(name: "Luke", movie: movies.first)
diff --git a/week_6/activity-tracker/lib/assets/.keep b/week_6/activity-tracker/lib/assets/.keep
new file mode 100644
index 00000000..e69de29b
diff --git a/week_6/activity-tracker/lib/tasks/.keep b/week_6/activity-tracker/lib/tasks/.keep
new file mode 100644
index 00000000..e69de29b
diff --git a/week_6/activity-tracker/log/.keep b/week_6/activity-tracker/log/.keep
new file mode 100644
index 00000000..e69de29b
diff --git a/week_6/activity-tracker/public/404.html b/week_6/activity-tracker/public/404.html
new file mode 100644
index 00000000..2be3af26
--- /dev/null
+++ b/week_6/activity-tracker/public/404.html
@@ -0,0 +1,67 @@
+
+
+
+ The page you were looking for doesn't exist (404)
+
+
+
+
+
+
+
+
+
The page you were looking for doesn't exist.
+
You may have mistyped the address or the page may have moved.
+
+
If you are the application owner check the logs for more information.
+
+
+
diff --git a/week_6/activity-tracker/public/422.html b/week_6/activity-tracker/public/422.html
new file mode 100644
index 00000000..c08eac0d
--- /dev/null
+++ b/week_6/activity-tracker/public/422.html
@@ -0,0 +1,67 @@
+
+
+
+ The change you wanted was rejected (422)
+
+
+
+
+
+
+
+
+
The change you wanted was rejected.
+
Maybe you tried to change something you didn't have access to.
+
+
If you are the application owner check the logs for more information.
+
+
+
diff --git a/week_6/activity-tracker/public/500.html b/week_6/activity-tracker/public/500.html
new file mode 100644
index 00000000..78a030af
--- /dev/null
+++ b/week_6/activity-tracker/public/500.html
@@ -0,0 +1,66 @@
+
+
+
+ We're sorry, but something went wrong (500)
+
+
+
+
+
+
+
+
+
We're sorry, but something went wrong.
+
+
If you are the application owner check the logs for more information.
+
+
+
diff --git a/week_6/activity-tracker/public/apple-touch-icon-precomposed.png b/week_6/activity-tracker/public/apple-touch-icon-precomposed.png
new file mode 100644
index 00000000..e69de29b
diff --git a/week_6/activity-tracker/public/apple-touch-icon.png b/week_6/activity-tracker/public/apple-touch-icon.png
new file mode 100644
index 00000000..e69de29b
diff --git a/week_6/activity-tracker/public/favicon.ico b/week_6/activity-tracker/public/favicon.ico
new file mode 100644
index 00000000..e69de29b
diff --git a/week_6/activity-tracker/public/robots.txt b/week_6/activity-tracker/public/robots.txt
new file mode 100644
index 00000000..c19f78ab
--- /dev/null
+++ b/week_6/activity-tracker/public/robots.txt
@@ -0,0 +1 @@
+# See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
diff --git a/week_6/activity-tracker/storage/.keep b/week_6/activity-tracker/storage/.keep
new file mode 100644
index 00000000..e69de29b
diff --git a/week_6/activity-tracker/test/application_system_test_case.rb b/week_6/activity-tracker/test/application_system_test_case.rb
new file mode 100644
index 00000000..d19212ab
--- /dev/null
+++ b/week_6/activity-tracker/test/application_system_test_case.rb
@@ -0,0 +1,5 @@
+require "test_helper"
+
+class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
+ driven_by :selenium, using: :chrome, screen_size: [1400, 1400]
+end
diff --git a/week_6/activity-tracker/test/channels/application_cable/connection_test.rb b/week_6/activity-tracker/test/channels/application_cable/connection_test.rb
new file mode 100644
index 00000000..800405f1
--- /dev/null
+++ b/week_6/activity-tracker/test/channels/application_cable/connection_test.rb
@@ -0,0 +1,11 @@
+require "test_helper"
+
+class ApplicationCable::ConnectionTest < ActionCable::Connection::TestCase
+ # test "connects with cookies" do
+ # cookies.signed[:user_id] = 42
+ #
+ # connect
+ #
+ # assert_equal connection.user_id, "42"
+ # end
+end
diff --git a/week_6/activity-tracker/test/controllers/.keep b/week_6/activity-tracker/test/controllers/.keep
new file mode 100644
index 00000000..e69de29b
diff --git a/week_6/activity-tracker/test/controllers/activities_controller_test.rb b/week_6/activity-tracker/test/controllers/activities_controller_test.rb
new file mode 100644
index 00000000..dec4d257
--- /dev/null
+++ b/week_6/activity-tracker/test/controllers/activities_controller_test.rb
@@ -0,0 +1,48 @@
+require "test_helper"
+
+class ActivitiesControllerTest < ActionDispatch::IntegrationTest
+ setup do
+ @activity = activities(:one)
+ end
+
+ test "should get index" do
+ get activities_url
+ assert_response :success
+ end
+
+ test "should get new" do
+ get new_activity_url
+ assert_response :success
+ end
+
+ test "should create activity" do
+ assert_difference("Activity.count") do
+ post activities_url, params: { activity: { activity_type: @activity.activity_type, calories: @activity.calories, duration: @activity.duration, start: @activity.start, title: @activity.title } }
+ end
+
+ assert_redirected_to activity_url(Activity.last)
+ end
+
+ test "should show activity" do
+ get activity_url(@activity)
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get edit_activity_url(@activity)
+ assert_response :success
+ end
+
+ test "should update activity" do
+ patch activity_url(@activity), params: { activity: { activity_type: @activity.activity_type, calories: @activity.calories, duration: @activity.duration, start: @activity.start, title: @activity.title } }
+ assert_redirected_to activity_url(@activity)
+ end
+
+ test "should destroy activity" do
+ assert_difference("Activity.count", -1) do
+ delete activity_url(@activity)
+ end
+
+ assert_redirected_to activities_url
+ end
+end
diff --git a/week_6/activity-tracker/test/controllers/static_pages_controller_test.rb b/week_6/activity-tracker/test/controllers/static_pages_controller_test.rb
new file mode 100644
index 00000000..2126daec
--- /dev/null
+++ b/week_6/activity-tracker/test/controllers/static_pages_controller_test.rb
@@ -0,0 +1,13 @@
+require "test_helper"
+
+class StaticPagesControllerTest < ActionDispatch::IntegrationTest
+ test "should get index" do
+ get static_pages_index_url
+ assert_response :success
+ end
+
+ test "should get about" do
+ get static_pages_about_url
+ assert_response :success
+ end
+end
diff --git a/week_6/activity-tracker/test/fixtures/activities.yml b/week_6/activity-tracker/test/fixtures/activities.yml
new file mode 100644
index 00000000..4df1066a
--- /dev/null
+++ b/week_6/activity-tracker/test/fixtures/activities.yml
@@ -0,0 +1,15 @@
+# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
+
+one:
+ title: MyString
+ activity_type: MyString
+ start: 2023-02-23 15:25:30
+ duration: 9.99
+ calories: 1
+
+two:
+ title: MyString
+ activity_type: MyString
+ start: 2023-02-23 15:25:30
+ duration: 9.99
+ calories: 1
diff --git a/week_6/activity-tracker/test/fixtures/files/.keep b/week_6/activity-tracker/test/fixtures/files/.keep
new file mode 100644
index 00000000..e69de29b
diff --git a/week_6/activity-tracker/test/fixtures/users.yml b/week_6/activity-tracker/test/fixtures/users.yml
new file mode 100644
index 00000000..b8a728da
--- /dev/null
+++ b/week_6/activity-tracker/test/fixtures/users.yml
@@ -0,0 +1,11 @@
+# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
+
+# This model initially had no columns defined. If you add columns to the
+# model remove the "{}" from the fixture names and add the columns immediately
+# below each fixture, per the syntax in the comments below
+#
+steve:
+ email: steve@example.com
+
+jane:
+ email: jane@example.com
diff --git a/week_6/activity-tracker/test/helpers/.keep b/week_6/activity-tracker/test/helpers/.keep
new file mode 100644
index 00000000..e69de29b
diff --git a/week_6/activity-tracker/test/integration/.keep b/week_6/activity-tracker/test/integration/.keep
new file mode 100644
index 00000000..e69de29b
diff --git a/week_6/activity-tracker/test/mailers/.keep b/week_6/activity-tracker/test/mailers/.keep
new file mode 100644
index 00000000..e69de29b
diff --git a/week_6/activity-tracker/test/models/.keep b/week_6/activity-tracker/test/models/.keep
new file mode 100644
index 00000000..e69de29b
diff --git a/week_6/activity-tracker/test/models/activity_test.rb b/week_6/activity-tracker/test/models/activity_test.rb
new file mode 100644
index 00000000..c07a8b91
--- /dev/null
+++ b/week_6/activity-tracker/test/models/activity_test.rb
@@ -0,0 +1,7 @@
+require "test_helper"
+
+class ActivityTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
diff --git a/week_6/activity-tracker/test/models/user_test.rb b/week_6/activity-tracker/test/models/user_test.rb
new file mode 100644
index 00000000..5c07f490
--- /dev/null
+++ b/week_6/activity-tracker/test/models/user_test.rb
@@ -0,0 +1,7 @@
+require "test_helper"
+
+class UserTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
diff --git a/week_6/activity-tracker/test/system/.keep b/week_6/activity-tracker/test/system/.keep
new file mode 100644
index 00000000..e69de29b
diff --git a/week_6/activity-tracker/test/system/activities_test.rb b/week_6/activity-tracker/test/system/activities_test.rb
new file mode 100644
index 00000000..15feb5a2
--- /dev/null
+++ b/week_6/activity-tracker/test/system/activities_test.rb
@@ -0,0 +1,49 @@
+require "application_system_test_case"
+
+class ActivitiesTest < ApplicationSystemTestCase
+ setup do
+ @activity = activities(:one)
+ end
+
+ test "visiting the index" do
+ visit activities_url
+ assert_selector "h1", text: "Activities"
+ end
+
+ test "should create activity" do
+ visit activities_url
+ click_on "New activity"
+
+ fill_in "Activity type", with: @activity.activity_type
+ fill_in "Calories", with: @activity.calories
+ fill_in "Duration", with: @activity.duration
+ fill_in "Start", with: @activity.start
+ fill_in "Title", with: @activity.title
+ click_on "Create Activity"
+
+ assert_text "Activity was successfully created"
+ click_on "Back"
+ end
+
+ test "should update Activity" do
+ visit activity_url(@activity)
+ click_on "Edit this activity", match: :first
+
+ fill_in "Activity type", with: @activity.activity_type
+ fill_in "Calories", with: @activity.calories
+ fill_in "Duration", with: @activity.duration
+ fill_in "Start", with: @activity.start
+ fill_in "Title", with: @activity.title
+ click_on "Update Activity"
+
+ assert_text "Activity was successfully updated"
+ click_on "Back"
+ end
+
+ test "should destroy Activity" do
+ visit activity_url(@activity)
+ click_on "Destroy this activity", match: :first
+
+ assert_text "Activity was successfully destroyed"
+ end
+end
diff --git a/week_6/activity-tracker/test/test_helper.rb b/week_6/activity-tracker/test/test_helper.rb
new file mode 100644
index 00000000..d713e377
--- /dev/null
+++ b/week_6/activity-tracker/test/test_helper.rb
@@ -0,0 +1,13 @@
+ENV["RAILS_ENV"] ||= "test"
+require_relative "../config/environment"
+require "rails/test_help"
+
+class ActiveSupport::TestCase
+ # Run tests in parallel with specified workers
+ parallelize(workers: :number_of_processors)
+
+ # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
+ fixtures :all
+
+ # Add more helper methods to be used by all tests here...
+end
diff --git a/week_6/activity-tracker/tmp/.keep b/week_6/activity-tracker/tmp/.keep
new file mode 100644
index 00000000..e69de29b
diff --git a/week_6/activity-tracker/tmp/pids/.keep b/week_6/activity-tracker/tmp/pids/.keep
new file mode 100644
index 00000000..e69de29b
diff --git a/week_6/activity-tracker/tmp/storage/.keep b/week_6/activity-tracker/tmp/storage/.keep
new file mode 100644
index 00000000..e69de29b
diff --git a/week_6/activity-tracker/vendor/.keep b/week_6/activity-tracker/vendor/.keep
new file mode 100644
index 00000000..e69de29b
diff --git a/week_6/activity-tracker/vendor/javascript/.keep b/week_6/activity-tracker/vendor/javascript/.keep
new file mode 100644
index 00000000..e69de29b