From 7b672f5416e1b98399d6bdaa72b7578282ec2a6a Mon Sep 17 00:00:00 2001 From: Icaro Rezende Date: Tue, 30 Mar 2021 10:12:25 -0300 Subject: [PATCH 01/18] fix gemfile and migrations --- Gemfile | 1 - Gemfile.lock | 159 +++++++----------- ...91121154635_add_monitor_to_atendimentos.rb | 2 +- db/schema.rb | 12 +- db/seeds.rb | 11 +- 5 files changed, 75 insertions(+), 110 deletions(-) diff --git a/Gemfile b/Gemfile index bfc41880..e97f4c25 100644 --- a/Gemfile +++ b/Gemfile @@ -27,7 +27,6 @@ gem 'jbuilder', '~> 2.5' # Use ActiveModel has_secure_password gem 'bcrypt', '~> 3.1.7' -gem 'webdrivers', '~> 4.0' # Uses HAML templates gem 'haml' diff --git a/Gemfile.lock b/Gemfile.lock index c2dba9cb..91fa9006 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -20,48 +20,43 @@ GIT GEM remote: https://rubygems.org/ specs: - - abstract_type (0.0.7) - actioncable (5.2.4) - actionpack (= 5.2.4) + actioncable (5.2.5) + actionpack (= 5.2.5) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailer (5.2.4) - actionpack (= 5.2.4) - actionview (= 5.2.4) - activejob (= 5.2.4) + actionmailer (5.2.5) + actionpack (= 5.2.5) + actionview (= 5.2.5) + activejob (= 5.2.5) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.2.4) - actionview (= 5.2.4) - activesupport (= 5.2.4) - rack (~> 2.0) + actionpack (5.2.5) + actionview (= 5.2.5) + activesupport (= 5.2.5) + rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.2.4) - activesupport (= 5.2.4) - + actionview (5.2.5) + activesupport (= 5.2.5) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - - activejob (5.2.4) - activesupport (= 5.2.4) + activejob (5.2.5) + activesupport (= 5.2.5) globalid (>= 0.3.6) - activemodel (5.2.4) - activesupport (= 5.2.4) - activerecord (5.2.4) - activemodel (= 5.2.4) - activesupport (= 5.2.4) + activemodel (5.2.5) + activesupport (= 5.2.5) + activerecord (5.2.5) + activemodel (= 5.2.5) + activesupport (= 5.2.5) arel (>= 9.0) - activestorage (5.2.4) - actionpack (= 5.2.4) - activerecord (= 5.2.4) - marcel (~> 0.3.1) - activesupport (5.2.4) - + activestorage (5.2.5) + actionpack (= 5.2.5) + activerecord (= 5.2.5) + marcel (~> 1.0.0) + activesupport (5.2.5) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) @@ -70,10 +65,8 @@ GEM public_suffix (>= 2.0.2, < 5.0) arel (9.0.0) arrayfields (4.9.2) - ast (2.4.2) autoprefixer-rails (10.2.4.0) - execjs bcrypt (3.1.16) bindex (0.8.1) @@ -114,7 +107,6 @@ GEM coffee-script-source execjs coffee-script-source (1.12.2) - concurrent-ruby (1.1.8) crass (1.0.6) cucumber (5.3.0) @@ -147,7 +139,6 @@ GEM capybara (>= 2.18, < 4) cucumber (>= 3.0.2, < 6) mime-types (~> 3.2) - nokogiri (~> 1.8) rails (>= 5.0, < 7) cucumber-rails-training-wheels (1.0.0) @@ -174,9 +165,7 @@ GEM factory_bot (~> 6.1.0) railties (>= 5.0.0) fattr (2.4.0) - ffi (1.15.0) - flay (2.12.1) erubis (~> 2.7.0) path_expander (~> 1.0) @@ -189,9 +178,7 @@ GEM formatador (0.2.5) globalid (0.4.2) activesupport (>= 4.2.0) - guard (2.16.2) - formatador (>= 0.2.4) listen (>= 2.7, < 4.0) lumberjack (>= 1.0.12, < 2.0) @@ -215,22 +202,16 @@ GEM html2haml (>= 1.0.1) railties (>= 5.1) hirb (0.7.3) - html2haml (2.2.0) erubis (~> 2.7.0) haml (>= 4.0, < 6) nokogiri (>= 1.6.0) ruby_parser (~> 3.5) - http-accept (1.7.0) - http-cookie (1.0.3) - domain_name (~> 0.5) - i18n (1.7.0) + i18n (1.8.9) concurrent-ruby (~> 1.0) - ice_nine (0.11.2) - jbuilder (2.9.1) - activesupport (>= 4.2.0) - jquery-rails (4.3.5) - + jbuilder (2.11.2) + activesupport (>= 5.0.0) + jquery-rails (4.4.0) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) @@ -242,9 +223,7 @@ GEM rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) ruby_dep (~> 1.2) - loofah (2.9.0) - crass (~> 1.0.2) nokogiri (>= 1.5.9) lumberjack (1.2.8) @@ -256,36 +235,30 @@ GEM fattr (~> 2.2, >= 2.2.0) map (~> 6.1, >= 6.1.0) map (6.6.0) - marcel (0.3.3) - mimemagic (~> 0.3.2) + marcel (1.0.0) method_source (1.0.0) metric_fu-Saikuro (1.1.3) middleware (0.1.0) mime-types (3.3.1) mime-types-data (~> 3.2015) mime-types-data (3.2021.0225) - mimemagic (0.3.6) - mini_mime (1.0.2) - - - mini_portile2 (2.4.0) - minitest (5.13.0) - msgpack (1.3.1) - multi_json (1.14.1) - + mini_mime (1.0.3) + mini_portile2 (2.5.0) + minitest (5.14.4) + msgpack (1.4.2) + multi_json (1.15.0) multi_test (0.1.2) nenv (0.3.0) - netrc (0.11.0) - nio4r (2.5.2) - nokogiri (1.10.7) - mini_portile2 (~> 2.4.0) + nio4r (2.5.7) + nokogiri (1.11.2) + mini_portile2 (~> 2.5.0) + racc (~> 1.4) notiffany (0.1.3) nenv (~> 0.1) shellany (~> 0.0) - parallel (1.19.1) - parser (2.5.3.0) - ast (~> 2.4.0) - + parallel (1.20.1) + parser (3.0.0.0) + ast (~> 2.4.1) path_expander (1.1.0) pg (1.2.3) popper_js (1.16.0) @@ -305,20 +278,18 @@ GEM rack-test (1.1.0) rack (>= 1.0, < 3) railroady (1.5.3) - - rails (5.2.4.5) - actioncable (= 5.2.4.5) - actionmailer (= 5.2.4.5) - actionpack (= 5.2.4.5) - actionview (= 5.2.4.5) - activejob (= 5.2.4.5) - activemodel (= 5.2.4.5) - activerecord (= 5.2.4.5) - activestorage (= 5.2.4.5) - activesupport (= 5.2.4.5) + rails (5.2.5) + actioncable (= 5.2.5) + actionmailer (= 5.2.5) + actionpack (= 5.2.5) + actionview (= 5.2.5) + activejob (= 5.2.5) + activemodel (= 5.2.5) + activerecord (= 5.2.5) + activestorage (= 5.2.5) + activesupport (= 5.2.5) bundler (>= 1.3.0) - railties (= 5.2.4.5) - + railties (= 5.2.5) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) @@ -337,10 +308,9 @@ GEM json require_all (~> 3.0) ruby-progressbar - - railties (5.2.4.5) - actionpack (= 5.2.4.5) - activesupport (= 5.2.4.5) + railties (5.2.5) + actionpack (= 5.2.5) + activesupport (= 5.2.5) method_source rake (>= 0.8.7) thor (>= 0.19.0, < 2.0) @@ -348,7 +318,6 @@ GEM rake (13.0.3) rb-fsevent (0.10.4) rb-inotify (0.10.1) - ffi (~> 1.0) redcard (1.1.0) reek (6.0.3) @@ -383,9 +352,7 @@ GEM rspec-support (3.10.2) ruby-progressbar (1.11.0) ruby_dep (1.5.0) - ruby_parser (3.15.1) - sexp_processor (~> 4.9) rubyzip (2.3.0) sass (3.7.4) @@ -447,22 +414,18 @@ GEM activemodel (>= 5.0) bindex (>= 0.4.0) railties (>= 5.0) - - - webdrivers (4.1.3) + webdrivers (4.6.0) nokogiri (~> 1.6) rubyzip (>= 1.3.0) selenium-webdriver (>= 3.0, < 4.0) - websocket-driver (0.7.1) - - + websocket-driver (0.7.3) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) PLATFORMS - x86_64-linux + ruby DEPENDENCIES bcrypt (~> 3.1.7) @@ -499,12 +462,10 @@ DEPENDENCIES tzinfo-data uglifier (>= 1.3.0) web-console (>= 3.3.0) - - webdrivers (~> 4.0) - + webdrivers RUBY VERSION ruby 2.7.2p137 BUNDLED WITH - 2.2.9 + 2.1.4 diff --git a/db/migrate/20191121154635_add_monitor_to_atendimentos.rb b/db/migrate/20191121154635_add_monitor_to_atendimentos.rb index 190fa11f..2431b02f 100644 --- a/db/migrate/20191121154635_add_monitor_to_atendimentos.rb +++ b/db/migrate/20191121154635_add_monitor_to_atendimentos.rb @@ -1,5 +1,5 @@ class AddMonitorToAtendimentos < ActiveRecord::Migration[5.2] def change - add_reference :atendimentos, :monitor, foreign_key: true + add_reference :atendimentos, :monitor, foreign_key: {to_table: :users} end end diff --git a/db/schema.rb b/db/schema.rb index b3b197b1..d0aa8b15 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,9 +10,10 @@ # # It's strongly recommended that you check this file into your version control system. - ActiveRecord::Schema.define(version: 2019_12_10_130811) do + # These are extensions that must be enabled in order to support this database + enable_extension "plpgsql" create_table "admins", force: :cascade do |t| t.string "name", null: false @@ -25,13 +26,13 @@ end create_table "atendimentos", force: :cascade do |t| - t.integer "motivo_id" + t.bigint "motivo_id" t.date "dia" t.string "descricao" t.string "aluno_atendido" t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.integer "monitor_id" + t.bigint "monitor_id" t.index ["monitor_id"], name: "index_atendimentos_on_monitor_id" t.index ["motivo_id"], name: "index_atendimentos_on_motivo_id" end @@ -142,7 +143,7 @@ t.boolean "feito" t.datetime "inicio" t.datetime "fim" - t.integer "monitoria_id" + t.bigint "monitoria_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.index ["monitoria_id"], name: "index_tarefas_on_monitoria_id" @@ -193,4 +194,7 @@ t.integer "c_restantes", default: 0, null: false end + add_foreign_key "atendimentos", "motivos" + add_foreign_key "atendimentos", "users", column: "monitor_id" + add_foreign_key "tarefas", "monitoria", column: "monitoria_id" end diff --git a/db/seeds.rb b/db/seeds.rb index 54463dc5..5d163dc2 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -17,26 +17,27 @@ # remember_token: nil, created_at: '2018-06-04 18:12:09.050792', updated_at: '2018-06-04 18:12:09.050792') ###################### -Disciplina.create([{id:1, nome: "APC", +Disciplina.create!([{id:1, nome: "APC", fk_tipo_disciplina_id: 1, c_prat: 2, c_teor: 4, cod_disciplina: 1}]) -Disciplina.create([{id:2, nome: "ED", +Disciplina.create!([{id:2, nome: "ED", fk_tipo_disciplina_id: 1, c_prat: 2, c_teor: 2, cod_disciplina: 2}]) ###################### -# User.create(id: 1, name: "Aluno1", email: "aluno1@gmail.com", password: "123456", -# cpf: "03638481182", rg: "2645178", matricula: "140080279") +User.create!(id: 1, name: "Aluno", email: "aluno1@gmail.com", password: "123456", password_confirmation: '123456', + cpf: "03638481182", rg: "2645178", matricula: "140080279") # User.create(id: 2, name: "Aluno2", email: "aluno2@gmail.com", password: "123456", # cpf: "03638481111", rg: "2645111", matricula: "140080211", # fk_banco: nil, remember_token: nil, created_at: '2018-06-04 19:02:24.831795', # updated_at: '2018-06-04 19:02:24.831795') -#Professor.create(id: 1, name: "Carla", email: "carla@unb.br", username: "carla", password: "123456", role: 1) +Professor.create!(id: 1, name: "Genaina", email: "genaina@unb.br", username: "genaina", password: "123456", password_confirmation: '123456', role: 1) +Professor.create!(id: 2, name: "Carla", email: "carla@unb.br", username: "carla", password: "123456", password_confirmation: '123456', role: 1) ###################### ###################### From 6f8579a799750698f243b5dec9573ba1186f3ff2 Mon Sep 17 00:00:00 2001 From: "Rafael G. de Paulo" Date: Sat, 17 Apr 2021 12:11:33 -0300 Subject: [PATCH 02/18] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Run=20bundle=20insta?= =?UTF-8?q?ll=20and=20update=20Gemfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 2 +- Gemfile.lock | 165 ++++++++++++++++++++------------------------------- 2 files changed, 64 insertions(+), 103 deletions(-) diff --git a/Gemfile b/Gemfile index bfc41880..c9ad9457 100644 --- a/Gemfile +++ b/Gemfile @@ -81,7 +81,7 @@ group :test do gem 'launchy' gem 'selenium-webdriver' # Easy installation and use of chromedriver to run system tests with Chrome - gem 'webdrivers' + # gem 'webdrivers' # Adds the RSpec stuff gem 'rspec-rails' # RSpec diff --git a/Gemfile.lock b/Gemfile.lock index c2dba9cb..0cdd996d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -20,48 +20,43 @@ GIT GEM remote: https://rubygems.org/ specs: - - abstract_type (0.0.7) - actioncable (5.2.4) - actionpack (= 5.2.4) + actioncable (5.2.5) + actionpack (= 5.2.5) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailer (5.2.4) - actionpack (= 5.2.4) - actionview (= 5.2.4) - activejob (= 5.2.4) + actionmailer (5.2.5) + actionpack (= 5.2.5) + actionview (= 5.2.5) + activejob (= 5.2.5) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.2.4) - actionview (= 5.2.4) - activesupport (= 5.2.4) - rack (~> 2.0) + actionpack (5.2.5) + actionview (= 5.2.5) + activesupport (= 5.2.5) + rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.2.4) - activesupport (= 5.2.4) - + actionview (5.2.5) + activesupport (= 5.2.5) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - - activejob (5.2.4) - activesupport (= 5.2.4) + activejob (5.2.5) + activesupport (= 5.2.5) globalid (>= 0.3.6) - activemodel (5.2.4) - activesupport (= 5.2.4) - activerecord (5.2.4) - activemodel (= 5.2.4) - activesupport (= 5.2.4) + activemodel (5.2.5) + activesupport (= 5.2.5) + activerecord (5.2.5) + activemodel (= 5.2.5) + activesupport (= 5.2.5) arel (>= 9.0) - activestorage (5.2.4) - actionpack (= 5.2.4) - activerecord (= 5.2.4) - marcel (~> 0.3.1) - activesupport (5.2.4) - + activestorage (5.2.5) + actionpack (= 5.2.5) + activerecord (= 5.2.5) + marcel (~> 1.0.0) + activesupport (5.2.5) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) @@ -70,10 +65,8 @@ GEM public_suffix (>= 2.0.2, < 5.0) arel (9.0.0) arrayfields (4.9.2) - ast (2.4.2) autoprefixer-rails (10.2.4.0) - execjs bcrypt (3.1.16) bindex (0.8.1) @@ -114,7 +107,6 @@ GEM coffee-script-source execjs coffee-script-source (1.12.2) - concurrent-ruby (1.1.8) crass (1.0.6) cucumber (5.3.0) @@ -143,13 +135,12 @@ GEM cucumber-messages (~> 13.0, >= 13.0.1) cucumber-messages (13.2.1) protobuf-cucumber (~> 3.10, >= 3.10.8) - cucumber-rails (2.2.0) + cucumber-rails (2.3.0) capybara (>= 2.18, < 4) cucumber (>= 3.0.2, < 6) mime-types (~> 3.2) - nokogiri (~> 1.8) - rails (>= 5.0, < 7) + railties (>= 5.0, < 7) cucumber-rails-training-wheels (1.0.0) cucumber-rails (>= 1.1.1) cucumber-tag-expressions (2.0.4) @@ -174,9 +165,7 @@ GEM factory_bot (~> 6.1.0) railties (>= 5.0.0) fattr (2.4.0) - ffi (1.15.0) - flay (2.12.1) erubis (~> 2.7.0) path_expander (~> 1.0) @@ -189,9 +178,7 @@ GEM formatador (0.2.5) globalid (0.4.2) activesupport (>= 4.2.0) - guard (2.16.2) - formatador (>= 0.2.4) listen (>= 2.7, < 4.0) lumberjack (>= 1.0.12, < 2.0) @@ -215,22 +202,16 @@ GEM html2haml (>= 1.0.1) railties (>= 5.1) hirb (0.7.3) - html2haml (2.2.0) erubis (~> 2.7.0) haml (>= 4.0, < 6) nokogiri (>= 1.6.0) ruby_parser (~> 3.5) - http-accept (1.7.0) - http-cookie (1.0.3) - domain_name (~> 0.5) - i18n (1.7.0) + i18n (1.8.10) concurrent-ruby (~> 1.0) - ice_nine (0.11.2) - jbuilder (2.9.1) - activesupport (>= 4.2.0) - jquery-rails (4.3.5) - + jbuilder (2.11.2) + activesupport (>= 5.0.0) + jquery-rails (4.4.0) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) @@ -242,9 +223,7 @@ GEM rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) ruby_dep (~> 1.2) - - loofah (2.9.0) - + loofah (2.9.1) crass (~> 1.0.2) nokogiri (>= 1.5.9) lumberjack (1.2.8) @@ -256,36 +235,30 @@ GEM fattr (~> 2.2, >= 2.2.0) map (~> 6.1, >= 6.1.0) map (6.6.0) - marcel (0.3.3) - mimemagic (~> 0.3.2) + marcel (1.0.1) method_source (1.0.0) metric_fu-Saikuro (1.1.3) middleware (0.1.0) mime-types (3.3.1) mime-types-data (~> 3.2015) mime-types-data (3.2021.0225) - mimemagic (0.3.6) - mini_mime (1.0.2) - - - mini_portile2 (2.4.0) - minitest (5.13.0) - msgpack (1.3.1) - multi_json (1.14.1) - + mini_mime (1.1.0) + mini_portile2 (2.5.0) + minitest (5.14.4) + msgpack (1.4.2) + multi_json (1.15.0) multi_test (0.1.2) nenv (0.3.0) - netrc (0.11.0) - nio4r (2.5.2) - nokogiri (1.10.7) - mini_portile2 (~> 2.4.0) + nio4r (2.5.7) + nokogiri (1.11.3) + mini_portile2 (~> 2.5.0) + racc (~> 1.4) notiffany (0.1.3) nenv (~> 0.1) shellany (~> 0.0) - parallel (1.19.1) - parser (2.5.3.0) - ast (~> 2.4.0) - + parallel (1.20.1) + parser (3.0.1.0) + ast (~> 2.4.1) path_expander (1.1.0) pg (1.2.3) popper_js (1.16.0) @@ -294,7 +267,7 @@ GEM middleware thor thread_safe - pry (0.14.0) + pry (0.14.1) coderay (~> 1.1) method_source (~> 1.0) psych (3.3.1) @@ -305,20 +278,18 @@ GEM rack-test (1.1.0) rack (>= 1.0, < 3) railroady (1.5.3) - - rails (5.2.4.5) - actioncable (= 5.2.4.5) - actionmailer (= 5.2.4.5) - actionpack (= 5.2.4.5) - actionview (= 5.2.4.5) - activejob (= 5.2.4.5) - activemodel (= 5.2.4.5) - activerecord (= 5.2.4.5) - activestorage (= 5.2.4.5) - activesupport (= 5.2.4.5) + rails (5.2.5) + actioncable (= 5.2.5) + actionmailer (= 5.2.5) + actionpack (= 5.2.5) + actionview (= 5.2.5) + activejob (= 5.2.5) + activemodel (= 5.2.5) + activerecord (= 5.2.5) + activestorage (= 5.2.5) + activesupport (= 5.2.5) bundler (>= 1.3.0) - railties (= 5.2.4.5) - + railties (= 5.2.5) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) @@ -337,10 +308,9 @@ GEM json require_all (~> 3.0) ruby-progressbar - - railties (5.2.4.5) - actionpack (= 5.2.4.5) - activesupport (= 5.2.4.5) + railties (5.2.5) + actionpack (= 5.2.5) + activesupport (= 5.2.5) method_source rake (>= 0.8.7) thor (>= 0.19.0, < 2.0) @@ -348,7 +318,6 @@ GEM rake (13.0.3) rb-fsevent (0.10.4) rb-inotify (0.10.1) - ffi (~> 1.0) redcard (1.1.0) reek (6.0.3) @@ -383,9 +352,7 @@ GEM rspec-support (3.10.2) ruby-progressbar (1.11.0) ruby_dep (1.5.0) - ruby_parser (3.15.1) - sexp_processor (~> 4.9) rubyzip (2.3.0) sass (3.7.4) @@ -447,22 +414,18 @@ GEM activemodel (>= 5.0) bindex (>= 0.4.0) railties (>= 5.0) - - - webdrivers (4.1.3) + webdrivers (4.6.0) nokogiri (~> 1.6) rubyzip (>= 1.3.0) selenium-webdriver (>= 3.0, < 4.0) - websocket-driver (0.7.1) - - + websocket-driver (0.7.3) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) PLATFORMS - x86_64-linux + ruby DEPENDENCIES bcrypt (~> 3.1.7) @@ -499,12 +462,10 @@ DEPENDENCIES tzinfo-data uglifier (>= 1.3.0) web-console (>= 3.3.0) - webdrivers (~> 4.0) - RUBY VERSION ruby 2.7.2p137 BUNDLED WITH - 2.2.9 + 2.1.4 From f793c31f2aac697a54b7212ef1d90f7aacd147e6 Mon Sep 17 00:00:00 2001 From: "Rafael G. de Paulo" Date: Sat, 17 Apr 2021 18:23:40 -0300 Subject: [PATCH 03/18] =?UTF-8?q?=E2=9C=85=20Add=20sad=20path=20for=20"ten?= =?UTF-8?q?tativa=20de=20inscri=C3=A7=C3=A3o=20numa=20mat=C3=A9ria=20que?= =?UTF-8?q?=20n=C3=A3o=20aceita=20monitoria"=20in=20inscreverMonitoria.fea?= =?UTF-8?q?ture?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The tests were not working even before i added these scenarios. There is some legacy code here that needs fixing. --- features/inscreverMonitoria.feature | 8 +++++++- features/step_definitions/web_steps.rb | 8 ++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/features/inscreverMonitoria.feature b/features/inscreverMonitoria.feature index 79836fb9..bfc71732 100644 --- a/features/inscreverMonitoria.feature +++ b/features/inscreverMonitoria.feature @@ -4,6 +4,7 @@ Cenário de Fundo: Dado que o banco possui um aluno e um professor E que o banco possui uma disciplina + E que o banco possui uma disciplina que nao permite monitoria E que o banco possui duas turmas cadastradas E que o banco possui uma monitoria E que eu estou na página de login de usuários @@ -31,4 +32,9 @@ E eu preencho "Descriçao" com "Nota: SS. IRA: 3." E aperto em "Cadastrar" Então eu devo estar na página de monitoria - E eu devo ver "Ocorreu um erro ao cadastrar a monitoria. Nenhuma monitoria cadastrada." \ No newline at end of file + E eu devo ver "Ocorreu um erro ao cadastrar a monitoria. Nenhuma monitoria cadastrada." + + Cenário: O aluno tenta aplicar aplicar para uma monitoria que nao aceita monitores (Sad Path) + Quando eu clico em "Monitoria" + Então eu devo estar na página de monitoria + E o link "link_3" não deve existir diff --git a/features/step_definitions/web_steps.rb b/features/step_definitions/web_steps.rb index 3436e721..7ba7804a 100644 --- a/features/step_definitions/web_steps.rb +++ b/features/step_definitions/web_steps.rb @@ -121,6 +121,10 @@ def with_scope(locator) :c_ext => 0) end +# Dado /^(?:|que )o banco possui uma disciplina que nao permite monitoria$/ do +# # TODO: implementar disciplina que não permite monitoria e inserir aqui +# end + Dado /^(?:|que )o banco possui uma turma cadastrada$/ do Turma.create!( id: 1, @@ -292,6 +296,10 @@ def with_scope(locator) ) end +# Então /^o link "([^"]*)" não deve existir$/ do +# # TODO: implementar esse step +# end + Então /^(?:|eu )devo ver todas as mensagens de falha para registro de alunos$/ do steps %( E eu devo ver "Password can't be blank" From 9180b3887a3408487dbfdd6c185e41f1f6f9d2e6 Mon Sep 17 00:00:00 2001 From: Lucas Correa Lemos <63261912+lucaslemos94@users.noreply.github.com> Date: Sun, 18 Apr 2021 17:06:10 -0300 Subject: [PATCH 04/18] Add editarDisciplina.feature --- features/editarDisciplina.feature | 37 +++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 features/editarDisciplina.feature diff --git a/features/editarDisciplina.feature b/features/editarDisciplina.feature new file mode 100644 index 00000000..fbc6495a --- /dev/null +++ b/features/editarDisciplina.feature @@ -0,0 +1,37 @@ + +# language: pt + +Épico: Coordenador pode selecionar as disciplinas e/ou turmas que podem ou não receber monitores + +Funcionalidade: Eu, como Coordenador, quero poder editar o status de disponibilidade de uma turma para a monitoria, para indicar para os alunos quais disciplinas podem receber monitor. + +Cenário de Fundo: + Dado que usuário está logado com o perfil de Coordenador + E que o usuário está na página inicial de Coordenador + +Cenário: O coordenador atualiza uma disciplina (happy path) + Quando o usuário acessa o menu "Disciplinas" + E aciona o botão "Editar Disciplina" + Quando está na página de edição de disciplina + E preenche os campos ,,,,,, + E envia o formulario para atualizar a disciplina + Quando a disciplina é atualizada no sistema + Então o usuário deve ver a mensagem "Disciplina atualizada!" na página de listagem de disciplinas. + + Exemplos: + | nome | creditosPraticos | creditosTeoricos | creditosEst | creditosExt | tipo | monitoria | + | APC | 6 | 6 | 6 | 6 | Obrigatória | checked | + | APC | 6 | 6 | 6 | 6 | Obrigatória | checked | + | BD | 6 | 6 | 6 | 6 | Obrigatória | uncheked | + +Cenário: O coordenador atualiza o nome da disciplina com outra existente (sad path) + Quando que o usuário acessa o menu "Disciplinas" + E aciona o botão "Editar Disciplina" + Quando está na página de edição de disciplina + E preenche o campo nome com um já existente + E envia o formulario para atualizar a disciplina + Então a disciplina não é atualizada no sistema + + Exemplos: + | nome | + | APC | \ No newline at end of file From 93db0d9237062300ceae5c320c95ecc7a6ca5973 Mon Sep 17 00:00:00 2001 From: lucaslemos94 Date: Tue, 4 May 2021 21:47:00 -0300 Subject: [PATCH 05/18] adicionando branch. --- features/editarDisciplina.feature | 37 +++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 features/editarDisciplina.feature diff --git a/features/editarDisciplina.feature b/features/editarDisciplina.feature new file mode 100644 index 00000000..e4e3e6af --- /dev/null +++ b/features/editarDisciplina.feature @@ -0,0 +1,37 @@ + +# language: pt + +Épico: Coordenador pode selecionar as disciplinas e/ou turmas que podem ou não receber monitores + +Funcionalidade: Eu, como Coordenador, quero poder editar o status de disponibilidade de uma turma para a monitoria, para indicar para os alunos quais disciplinas podem receber monitor. + +Cenário de Fundo: + Dado que usuário está logado com o perfil de Coordenador + E que o usuário está na página inicial de Coordenador + +Cenário: O coordenador atualiza uma disciplina (happy path) + Quando o usuário acessa o menu "Disciplinas" + E aciona o botão "Editar Disciplina" + Quando está na página de edição de disciplina + E preenche os campos ,,,,,, + E envia o formulario para atualizar a disciplina + Quando a disciplina é atualizada no sistema + Então o usuário deve ver a mensagem "Disciplina atualizada!" na página de listagem de disciplinas. + + Exemplos: + | nome | creditosPraticos | creditosTeoricos | creditosEst | creditosExt | tipo | monitoria | + | APC | 6 | 6 | 6 | 6 | Obrigatória | checked | + | APC | 6 | 6 | 6 | 6 | Obrigatória | checked | + | BD | 6 | 6 | 6 | 6 | Obrigatória | uncheked | + +Cenário: O coordenador atualiza o nome da disciplina com outra existente (sad path) + Quando que o usuário acessa o menu "Disciplinas" + E aciona o botão "Editar Disciplina" + Quando está na página de edição de disciplina + E preenche o campo nome com um já existente + E envia o formulario para atualizar a disciplina + Então a disciplina não é atualizada no sistema + + Exemplos: + | nome | + | APC | \ No newline at end of file From d911d0f1740de475d38c7e2e84eddfba760d0de2 Mon Sep 17 00:00:00 2001 From: lucaslemos94 Date: Tue, 4 May 2021 21:49:03 -0300 Subject: [PATCH 06/18] adicionando branch. --- .vscode/settings.json | 4 ++ Gemfile.lock | 24 +++++----- app/controllers/admins_controller.rb | 1 + app/controllers/dashboard_controller.rb | 7 +-- app/models/disciplina.rb | 2 +- app/views/dashboard/disciplinas.html.haml | 4 +- config/database.yml | 29 ++++++++---- db/seeds.rb | 4 +- features/editarDisciplina.feature | 43 ++++++----------- features/relatorioAtendimento.feature | 56 +++++++++++------------ features/step_definitions/web_steps.rb | 46 +++++++++++++++++++ 11 files changed, 135 insertions(+), 85 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..7f78ee20 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "git.ignoreLimitWarning": true, + "python.pythonPath": "C:\\Users\\Lucas\\AppData\\Local\\Programs\\Python\\Python39\\python.exe" +} \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index 0cdd996d..bbc62a65 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -70,7 +70,7 @@ GEM execjs bcrypt (3.1.16) bindex (0.8.1) - bootsnap (1.7.3) + bootsnap (1.7.5) msgpack (~> 1.0) bootstrap (4.3.1) autoprefixer-rails (>= 9.1.0) @@ -165,7 +165,7 @@ GEM factory_bot (~> 6.1.0) railties (>= 5.0.0) fattr (2.4.0) - ffi (1.15.0) + ffi (1.15.0-x64-mingw32) flay (2.12.1) erubis (~> 2.7.0) path_expander (~> 1.0) @@ -243,24 +243,22 @@ GEM mime-types-data (~> 3.2015) mime-types-data (3.2021.0225) mini_mime (1.1.0) - mini_portile2 (2.5.0) minitest (5.14.4) msgpack (1.4.2) multi_json (1.15.0) multi_test (0.1.2) nenv (0.3.0) nio4r (2.5.7) - nokogiri (1.11.3) - mini_portile2 (~> 2.5.0) - racc (~> 1.4) + nokogiri (1.11.3-x64-mingw32) + racc (>= 1.4) notiffany (0.1.3) nenv (~> 0.1) shellany (~> 0.0) parallel (1.20.1) - parser (3.0.1.0) + parser (3.0.1.1) ast (~> 2.4.1) path_expander (1.1.0) - pg (1.2.3) + pg (1.2.3-x64-mingw32) popper_js (1.16.0) protobuf-cucumber (3.10.8) activesupport (>= 3.2) @@ -320,7 +318,7 @@ GEM rb-inotify (0.10.1) ffi (~> 1.0) redcard (1.1.0) - reek (6.0.3) + reek (6.0.4) kwalify (~> 0.7.0) parser (~> 3.0.0) psych (~> 3.1) @@ -366,7 +364,7 @@ GEM sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) - sassc (2.4.0) + sassc (2.4.0-x64-mingw32) ffi (~> 1.9) sassc-rails (2.1.2) railties (>= 4.0.0) @@ -384,7 +382,7 @@ GEM simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) simplecov-html (0.12.3) - simplecov_json_formatter (0.1.2) + simplecov_json_formatter (0.1.3) spring (2.1.1) spring-watcher-listen (2.0.1) listen (>= 2.7, < 4.0) @@ -407,6 +405,8 @@ GEM turbolinks-source (5.2.0) tzinfo (1.2.9) thread_safe (~> 0.1) + tzinfo-data (1.2021.1) + tzinfo (>= 1.0.0) uglifier (4.2.0) execjs (>= 0.3.0, < 3) web-console (3.7.0) @@ -425,7 +425,7 @@ GEM nokogiri (~> 1.8) PLATFORMS - ruby + x64-mingw32 DEPENDENCIES bcrypt (~> 3.1.7) diff --git a/app/controllers/admins_controller.rb b/app/controllers/admins_controller.rb index dce794e9..e3ccafd0 100644 --- a/app/controllers/admins_controller.rb +++ b/app/controllers/admins_controller.rb @@ -1,6 +1,7 @@ class AdminsController < ApplicationController def index ; end + def new ; end def create diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index 9f93d455..05e69632 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -216,10 +216,10 @@ def extrai_campos_turma(node) def carregar_disciplinas(disciplinas) disciplinas.each do |d| - if !Disciplina.find_by_cod_disciplina(d[:cod_disciplina]) + if !Disciplina.find_by_id_disciplina(d[:id]) criar_disciplina( - d[:cod_disciplina], + d[:id], d[:nome_disciplina], d[:creditos] ) @@ -229,8 +229,9 @@ def carregar_disciplinas(disciplinas) ## # Método para criar uma disciplina no modelo. - def criar_disciplina(cod_disciplina, nome, creditos) + def criar_disciplina(id_disciplina,cod_disciplina, nome, creditos) Disciplina.create( + :id=> id_disciplina, :cod_disciplina => cod_disciplina, :nome => nome, :c_prat => creditos[:c_prat], diff --git a/app/models/disciplina.rb b/app/models/disciplina.rb index 627e62b4..337783f2 100644 --- a/app/models/disciplina.rb +++ b/app/models/disciplina.rb @@ -6,7 +6,7 @@ def self.all_tipos def self.all_disciplinas order(:nome).all end - + validates_presence_of :nome validates_presence_of :fk_tipo_disciplina_id validates_presence_of :c_prat diff --git a/app/views/dashboard/disciplinas.html.haml b/app/views/dashboard/disciplinas.html.haml index 0cb05b2b..a01f6f47 100644 --- a/app/views/dashboard/disciplinas.html.haml +++ b/app/views/dashboard/disciplinas.html.haml @@ -121,8 +121,8 @@ - if current_user.kind_of?(Admin) .row .col-6 - %a.btn.btn-outline-warning.btn-block{href: edit_disciplina_path(d.cod_disciplina)} + %a.btn.btn-outline-warning.btn-block{href: edit_disciplina_path(d.id)} Editar Disciplina .col-6 - =link_to "Apagar Disciplina", disciplina_path(d.cod_disciplina), method: :delete, + =link_to "Apagar Disciplina", disciplina_path(d.id), method: :delete, class: 'btn btn-outline-danger btn-block' \ No newline at end of file diff --git a/config/database.yml b/config/database.yml index c26fbd59..f012378d 100644 --- a/config/database.yml +++ b/config/database.yml @@ -11,22 +11,33 @@ default: &default timeout: 5000 development: - <<: *default - database: monitoriacic_development + adapter: postgresql + encoding: utf8 + database: monitoriacic_development + username: postgres + password: lucas # 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: &test - <<: *default - database: monitoriacic_test + adapter: postgresql + encoding: utf8 + database: monitoriacic_development + username: postgres + password: lucas production: - <<: *default - database: monitoriacic_production + adapter: postgresql + encoding: utf8 + database: monitoriacic_development + username: postgres + password: lucas cucumber: - <<: *test + adapter: postgresql + encoding: utf8 + database: monitoriacic_development + username: postgres + password: lucas -cucumber: - <<: *test diff --git a/db/seeds.rb b/db/seeds.rb index 54463dc5..66c253fd 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -13,8 +13,8 @@ Disciplina.destroy_all ###################### -#Admin.create(id: 1, name: "Admin UnB", email: "secretaria@cic.unb.br", password: "123456", -# remember_token: nil, created_at: '2018-06-04 18:12:09.050792', updated_at: '2018-06-04 18:12:09.050792') +Admin.create(id: 1, name: "Admin UnB", email: "secretaria@cic.unb.br", password: "123456", + remember_token: nil, created_at: '2018-06-04 18:12:09.050792', updated_at: '2018-06-04 18:12:09.050792') ###################### Disciplina.create([{id:1, nome: "APC", diff --git a/features/editarDisciplina.feature b/features/editarDisciplina.feature index e4e3e6af..e7c69cc3 100644 --- a/features/editarDisciplina.feature +++ b/features/editarDisciplina.feature @@ -1,37 +1,24 @@ - # language: pt - -Épico: Coordenador pode selecionar as disciplinas e/ou turmas que podem ou não receber monitores +# Dado que usuário está logado com o perfil de Coordenador Funcionalidade: Eu, como Coordenador, quero poder editar o status de disponibilidade de uma turma para a monitoria, para indicar para os alunos quais disciplinas podem receber monitor. -Cenário de Fundo: - Dado que usuário está logado com o perfil de Coordenador - E que o usuário está na página inicial de Coordenador + Cenário de Fundo: + Dado que o "admin" está logado + E eu estou na página de "dashboard" do usuário + # E que o admin está na página inicial de Coordenador -Cenário: O coordenador atualiza uma disciplina (happy path) - Quando o usuário acessa o menu "Disciplinas" - E aciona o botão "Editar Disciplina" - Quando está na página de edição de disciplina - E preenche os campos ,,,,,, - E envia o formulario para atualizar a disciplina - Quando a disciplina é atualizada no sistema - Então o usuário deve ver a mensagem "Disciplina atualizada!" na página de listagem de disciplinas. + Cenário: O coordenador atualiza uma disciplina (happy path) + Quando o usuário acessa o menu "Disciplinas" + E aciona o botão "Editar Disciplina" + Quando está na página de edição de disciplina + E preenche os campo + E envia o formulario para atualizar a disciplina + Quando a disciplina é atualizada no sistema + Então o usuário deve ver a mensagem "Disciplina atualizada!" na página de listagem de disciplinas. Exemplos: - | nome | creditosPraticos | creditosTeoricos | creditosEst | creditosExt | tipo | monitoria | + | nome | creditosPraticos | creditosTeoricos | creditosEst | creditosExt | tipo | monitoria | | APC | 6 | 6 | 6 | 6 | Obrigatória | checked | | APC | 6 | 6 | 6 | 6 | Obrigatória | checked | - | BD | 6 | 6 | 6 | 6 | Obrigatória | uncheked | - -Cenário: O coordenador atualiza o nome da disciplina com outra existente (sad path) - Quando que o usuário acessa o menu "Disciplinas" - E aciona o botão "Editar Disciplina" - Quando está na página de edição de disciplina - E preenche o campo nome com um já existente - E envia o formulario para atualizar a disciplina - Então a disciplina não é atualizada no sistema - - Exemplos: - | nome | - | APC | \ No newline at end of file + | BD | 6 | 6 | 6 | 6 | Obrigatória | uncheked | \ No newline at end of file diff --git a/features/relatorioAtendimento.feature b/features/relatorioAtendimento.feature index 110dc8c5..1dc5f959 100644 --- a/features/relatorioAtendimento.feature +++ b/features/relatorioAtendimento.feature @@ -1,33 +1,33 @@ -#language pt +#language: pt Funcionalidade: Relatorio dos atendimentos O monitor pode accesar a seu relatorio de atendimentos e os professores podem accesar aos relatorios de todos os monitores -Cenario de Fundo: - Dado que eu estou na pagina de x(accesso de relatorios) - Quando eu clico em "Visualizar relatorio" - Entao eu devo estar na pagina dos relatorios + Cenario de Fundo: + Dado que eu estou na pagina de x(accesso de relatorios) + Quando eu clico em "Visualizar relatorio" + Entao eu devo estar na pagina dos relatorios -Cenario:Monitor visualiza todos os registros(Happy Path) - Quando o monitor visualiza o relatorio - |Aluno atendido|Dia |Motivo |Descricao| - |Daniel |08/10/2019 |duvida |tirar uma duvida| - |Sergio |17/11/2019 |consulta|consulta monitor| - - E quando ele clica em registro especifico - Entao o monitor deve estar na pagina do registro selecionado - E o monitor deve ver as informacoes completas do registro - E ele pode editar ou excluir o registro de atendimento - -Cenario: Professor pode visualizar o relatorio especifico (Happy Path) - Quando professor escolhe um relatorio especifico para visualizar - Entao professor visualiza o relatorio do monitor - |Aluno atendido|Dia |Motivo |Descricao| - |Daniel |08/10/2019 |duvida |tirar uma duvida| - |Sergio |17/11/2019 |consulta|consulta monitor| - -Cenario: Professor seleciona um relatorio especifico(Sad Path ) - Quando professor escolhe um relatorio inexistente do monitor - E o professor aperta em visualizar - Entao o professor deve ficar na mesma pagina - E deve aparecer uma mensagem de erro falando que nao existe o relatorio \ No newline at end of file + Cenario:Monitor visualiza todos os registros(Happy Path) + Quando o monitor visualiza o relatorio + |Aluno atendido|Dia |Motivo |Descricao| + |Daniel |08/10/2019 |duvida |tirar uma duvida| + |Sergio |17/11/2019 |consulta|consulta monitor| + + E quando ele clica em registro especifico + Entao o monitor deve estar na pagina do registro selecionado + E o monitor deve ver as informacoes completas do registro + E ele pode editar ou excluir o registro de atendimento + + Cenario: Professor pode visualizar o relatorio especifico (Happy Path) + Quando professor escolhe um relatorio especifico para visualizar + Entao professor visualiza o relatorio do monitor + |Aluno atendido|Dia |Motivo |Descricao| + |Daniel |08/10/2019 |duvida |tirar uma duvida| + |Sergio |17/11/2019 |consulta|consulta monitor| + + Cenario: Professor seleciona um relatorio especifico(Sad Path ) + Quando professor escolhe um relatorio inexistente do monitor + E o professor aperta em visualizar + Entao o professor deve ficar na mesma pagina + E deve aparecer uma mensagem de erro falando que nao existe o relatorio \ No newline at end of file diff --git a/features/step_definitions/web_steps.rb b/features/step_definitions/web_steps.rb index 7ba7804a..d1ff447a 100644 --- a/features/step_definitions/web_steps.rb +++ b/features/step_definitions/web_steps.rb @@ -271,6 +271,7 @@ def with_scope(locator) else assert page.has_content?(text) end + end Então /^(?:|eu )não devo ver "([^"]*)"$/ do |text| @@ -368,3 +369,48 @@ def with_scope(locator) email = ActionMailer::Base.deliveries.first email.should == nil end + + + +Dado('que usuário está logado com o perfil de Coordenador') do + + +end + + + +# end +Quando('o usuário acessa o menu {string}') do |string| + + # expect(page).to have_link("Disciplinas", visible: true) + + page.should have_content(string) + +end + +Quando('aciona o botão {string}') do |string| + + f. + pending # Write code here that turns the phrase above into concrete actions +end + +Quando('está na página de edição de disciplina') do + pending # Write code here that turns the phrase above into concrete actions +end + +Quando('preenche os campo checked') do + pending # Write code here that turns the phrase above into concrete actions +end + +Quando('envia o formulario para atualizar a disciplina') do + pending # Write code here that turns the phrase above into concrete actions +end + +Quando('a disciplina é atualizada no sistema') do + + pending # Write code here that turns the phrase above into concrete actions +end + +Então('o usuário deve ver a mensagem {string} na página de listagem de disciplinas.') do |string| + pending # Write code here that turns the phrase above into concrete actions +end From a0158fd09fcd5915f660efce18d8570d19fc12aa Mon Sep 17 00:00:00 2001 From: titofrota Date: Wed, 5 May 2021 00:29:05 -0300 Subject: [PATCH 07/18] meu deus funciona --- Gemfile.lock | 7 +++++++ db/migrate/20210505021717_add_monitoria_to_disciplinas.rb | 5 +++++ 2 files changed, 12 insertions(+) create mode 100644 db/migrate/20210505021717_add_monitoria_to_disciplinas.rb diff --git a/Gemfile.lock b/Gemfile.lock index bbc62a65..be4b295d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -165,6 +165,7 @@ GEM factory_bot (~> 6.1.0) railties (>= 5.0.0) fattr (2.4.0) + ffi (1.15.0) ffi (1.15.0-x64-mingw32) flay (2.12.1) erubis (~> 2.7.0) @@ -251,6 +252,8 @@ GEM nio4r (2.5.7) nokogiri (1.11.3-x64-mingw32) racc (>= 1.4) + nokogiri (1.11.3-x86_64-linux) + racc (~> 1.4) notiffany (0.1.3) nenv (~> 0.1) shellany (~> 0.0) @@ -258,6 +261,7 @@ GEM parser (3.0.1.1) ast (~> 2.4.1) path_expander (1.1.0) + pg (1.2.3) pg (1.2.3-x64-mingw32) popper_js (1.16.0) protobuf-cucumber (3.10.8) @@ -364,6 +368,8 @@ GEM sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) + sassc (2.4.0) + ffi (~> 1.9) sassc (2.4.0-x64-mingw32) ffi (~> 1.9) sassc-rails (2.1.2) @@ -425,6 +431,7 @@ GEM nokogiri (~> 1.8) PLATFORMS + ruby x64-mingw32 DEPENDENCIES diff --git a/db/migrate/20210505021717_add_monitoria_to_disciplinas.rb b/db/migrate/20210505021717_add_monitoria_to_disciplinas.rb new file mode 100644 index 00000000..c6a6e456 --- /dev/null +++ b/db/migrate/20210505021717_add_monitoria_to_disciplinas.rb @@ -0,0 +1,5 @@ +class AddMonitoriaToDisciplinas < ActiveRecord::Migration[5.2] + def change + add_column :disciplinas, :monitoria, :boolean + end +end From e668ab87b4720496c31a3dc4c9dd233e8c5e586a Mon Sep 17 00:00:00 2001 From: titofrota Date: Thu, 6 May 2021 01:07:11 -0300 Subject: [PATCH 08/18] FIX sad and happy path for editarDisciplina + minor fixes --- app/controllers/disciplinas_controller.rb | 3 +- app/views/disciplinas/edit.html.haml | 11 ++-- app/views/disciplinas/new.html.haml | 5 ++ config/database.yml | 16 +++--- ...91121154635_add_monitor_to_atendimentos.rb | 2 +- ...0505021717_add_monitoria_to_disciplinas.rb | 2 +- db/schema.rb | 15 ++++-- db/seeds.rb | 6 +-- features/disciplinaCRUD.feature | 2 +- features/editarDisciplina.feature | 51 ++++++++++++------- features/step_definitions/web_steps.rb | 20 +++++--- features/support/paths.rb | 4 +- 12 files changed, 84 insertions(+), 53 deletions(-) diff --git a/app/controllers/disciplinas_controller.rb b/app/controllers/disciplinas_controller.rb index 1631d12c..985f2fa5 100644 --- a/app/controllers/disciplinas_controller.rb +++ b/app/controllers/disciplinas_controller.rb @@ -24,6 +24,7 @@ def update if @disciplina.update disciplina_params redirect_to dashboard_disciplinas_path, notice: "Disciplina atualizada!" else + flash[:danger] = "Ocorreu um erro ao atualizar a disciplina." render 'edit' end end @@ -45,7 +46,7 @@ def destroy private def disciplina_params - params.require(:disciplina).permit(:nome, :fk_tipo_disciplina_id, :c_prat, :c_teor, :c_est, :c_ext) + params.require(:disciplina).permit(:nome, :fk_tipo_disciplina_id, :c_prat, :c_teor, :c_est, :c_ext, :monitoria) end def find_disciplina diff --git a/app/views/disciplinas/edit.html.haml b/app/views/disciplinas/edit.html.haml index c36f64a3..ed0d1eec 100644 --- a/app/views/disciplinas/edit.html.haml +++ b/app/views/disciplinas/edit.html.haml @@ -13,10 +13,7 @@ .col -if flash[:danger] .alert.alert-danger - - flash[:danger].each do |msg| - %ul - %li - =msg + = flash[:danger] -if flash[:notice] .alert.alert-success = flash[:notice] @@ -47,11 +44,17 @@ .col-sm-10 = text_field :disciplina, :c_ext, :class => "form-control", :autocomplete => "off" + .form-group.row = label :disciplina, :fk_tipo_disciplina_id, "Tipo", class: "col-sm-2 col-form-label" .col-sm-10 = select :disciplina, :fk_tipo_disciplina_id, options_for_select(Disciplina.all_tipos) + .form-group.row + = label :disciplina, :monitoria, "Monitoria", class: "col-sm-2 col-form-label" + .col-sm-10 + = check_box :disciplina, :monitoria, {:class => "form-control", :id => "checkbox"} + %br = submit_tag 'Atualizar', class: "btn btn-outline-primary btn-block" .col-3 diff --git a/app/views/disciplinas/new.html.haml b/app/views/disciplinas/new.html.haml index adba25cd..aa2d5764 100644 --- a/app/views/disciplinas/new.html.haml +++ b/app/views/disciplinas/new.html.haml @@ -48,6 +48,11 @@ .col-sm-10 = select :disciplina, :fk_tipo_disciplina_id, options_for_select(Disciplina.all_tipos) + .form-group.row + = label :disciplina, :monitoria, "Monitoria", class: "col-sm-2 col-form-label" + .col-sm-10 + = check_box :disciplina, :monitoria, {:class => "form-control"} + %br = submit_tag 'Cadastrar', class: "btn btn-outline-primary btn-block" .col-3 diff --git a/config/database.yml b/config/database.yml index f012378d..deaf3275 100644 --- a/config/database.yml +++ b/config/database.yml @@ -14,8 +14,8 @@ development: adapter: postgresql encoding: utf8 database: monitoriacic_development - username: postgres - password: lucas + username: + password: # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". @@ -24,20 +24,20 @@ test: &test adapter: postgresql encoding: utf8 database: monitoriacic_development - username: postgres - password: lucas + username: + password: production: adapter: postgresql encoding: utf8 database: monitoriacic_development - username: postgres - password: lucas + username: + password: cucumber: adapter: postgresql encoding: utf8 database: monitoriacic_development - username: postgres - password: lucas + username: + password: diff --git a/db/migrate/20191121154635_add_monitor_to_atendimentos.rb b/db/migrate/20191121154635_add_monitor_to_atendimentos.rb index 190fa11f..2431b02f 100644 --- a/db/migrate/20191121154635_add_monitor_to_atendimentos.rb +++ b/db/migrate/20191121154635_add_monitor_to_atendimentos.rb @@ -1,5 +1,5 @@ class AddMonitorToAtendimentos < ActiveRecord::Migration[5.2] def change - add_reference :atendimentos, :monitor, foreign_key: true + add_reference :atendimentos, :monitor, foreign_key: {to_table: :users} end end diff --git a/db/migrate/20210505021717_add_monitoria_to_disciplinas.rb b/db/migrate/20210505021717_add_monitoria_to_disciplinas.rb index c6a6e456..d0d183fe 100644 --- a/db/migrate/20210505021717_add_monitoria_to_disciplinas.rb +++ b/db/migrate/20210505021717_add_monitoria_to_disciplinas.rb @@ -1,5 +1,5 @@ class AddMonitoriaToDisciplinas < ActiveRecord::Migration[5.2] def change - add_column :disciplinas, :monitoria, :boolean + add_column :disciplinas, :monitoria, :boolean, default: false end end diff --git a/db/schema.rb b/db/schema.rb index b3b197b1..556d2e40 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,9 +10,10 @@ # # It's strongly recommended that you check this file into your version control system. +ActiveRecord::Schema.define(version: 2021_05_05_021717) do -ActiveRecord::Schema.define(version: 2019_12_10_130811) do - + # These are extensions that must be enabled in order to support this database + enable_extension "plpgsql" create_table "admins", force: :cascade do |t| t.string "name", null: false @@ -25,13 +26,13 @@ end create_table "atendimentos", force: :cascade do |t| - t.integer "motivo_id" + t.bigint "motivo_id" t.date "dia" t.string "descricao" t.string "aluno_atendido" t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.integer "monitor_id" + t.bigint "monitor_id" t.index ["monitor_id"], name: "index_atendimentos_on_monitor_id" t.index ["motivo_id"], name: "index_atendimentos_on_motivo_id" end @@ -68,6 +69,7 @@ t.integer "c_est", default: 0, null: false t.integer "c_ext", default: 0, null: false t.integer "cod_disciplina", default: 0, null: false + t.boolean "monitoria", default: false t.index ["cod_disciplina"], name: "disciplinas_cod_disciplina_index" t.index ["fk_tipo_disciplina_id"], name: "fk_disciplinas_tipo_disciplina1_idx" end @@ -142,7 +144,7 @@ t.boolean "feito" t.datetime "inicio" t.datetime "fim" - t.integer "monitoria_id" + t.bigint "monitoria_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.index ["monitoria_id"], name: "index_tarefas_on_monitoria_id" @@ -193,4 +195,7 @@ t.integer "c_restantes", default: 0, null: false end + add_foreign_key "atendimentos", "motivos" + add_foreign_key "atendimentos", "users", column: "monitor_id" + add_foreign_key "tarefas", "monitoria", column: "monitoria_id" end diff --git a/db/seeds.rb b/db/seeds.rb index 66c253fd..b25fbffb 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -17,17 +17,17 @@ remember_token: nil, created_at: '2018-06-04 18:12:09.050792', updated_at: '2018-06-04 18:12:09.050792') ###################### -Disciplina.create([{id:1, nome: "APC", +Disciplina.create([{nome: "APC", fk_tipo_disciplina_id: 1, c_prat: 2, c_teor: 4, cod_disciplina: 1}]) -Disciplina.create([{id:2, nome: "ED", +Disciplina.create([{nome: "ED", fk_tipo_disciplina_id: 1, c_prat: 2, c_teor: 2, cod_disciplina: 2}]) ###################### - +puts "Seed done." # User.create(id: 1, name: "Aluno1", email: "aluno1@gmail.com", password: "123456", # cpf: "03638481182", rg: "2645178", matricula: "140080279") diff --git a/features/disciplinaCRUD.feature b/features/disciplinaCRUD.feature index 6204feba..c89822a8 100644 --- a/features/disciplinaCRUD.feature +++ b/features/disciplinaCRUD.feature @@ -21,7 +21,7 @@ Dado que o "admin" está logado E que está na página de disciplinas Quando eu clico em "Editar Disciplina" - Então eu devo estar na página de edição da disciplina 1 + Então eu devo estar na página de edição de disciplina Quando eu preencho o formulário com: | Nome | Banco de Dados | | Créditos Práticos | 2 | diff --git a/features/editarDisciplina.feature b/features/editarDisciplina.feature index e7c69cc3..504df45c 100644 --- a/features/editarDisciplina.feature +++ b/features/editarDisciplina.feature @@ -1,24 +1,37 @@ # language: pt -# Dado que usuário está logado com o perfil de Coordenador - -Funcionalidade: Eu, como Coordenador, quero poder editar o status de disponibilidade de uma turma para a monitoria, para indicar para os alunos quais disciplinas podem receber monitor. + Funcionalidade: Eu, como Coordenador, quero poder editar o status de disponibilidade de uma turma para a monitoria, para indicar para os alunos quais disciplinas podem receber monitor. Cenário de Fundo: - Dado que o "admin" está logado - E eu estou na página de "dashboard" do usuário - # E que o admin está na página inicial de Coordenador + Dado que o banco possui um adminstrador + E que o banco possui uma disciplina + E que eu estou na página de login de usuários + E que o "admin" está logado - Cenário: O coordenador atualiza uma disciplina (happy path) - Quando o usuário acessa o menu "Disciplinas" - E aciona o botão "Editar Disciplina" - Quando está na página de edição de disciplina - E preenche os campo - E envia o formulario para atualizar a disciplina - Quando a disciplina é atualizada no sistema - Então o usuário deve ver a mensagem "Disciplina atualizada!" na página de listagem de disciplinas. + Cenário: Admin edita o status de disponibilidade da disciplina 1 (happy path) + Dado que está na página de disciplinas + Quando eu clico em "Editar Disciplina" + Então eu devo estar na página de edição de disciplina + Quando eu preencho o formulário com: + | Nome | Banco de Dados | + | Créditos Práticos | 2 | + | Créditos Teóricos | 2 | + | Créditos Est | 2 | + | Créditos Ext | 2 | + E eu marco a checkbox de "Monitoria" + E eu aperto em "Atualizar" + Então eu devo estar na página de disciplinas + E eu devo ver "Disciplina atualizada!" - Exemplos: - | nome | creditosPraticos | creditosTeoricos | creditosEst | creditosExt | tipo | monitoria | - | APC | 6 | 6 | 6 | 6 | Obrigatória | checked | - | APC | 6 | 6 | 6 | 6 | Obrigatória | checked | - | BD | 6 | 6 | 6 | 6 | Obrigatória | uncheked | \ No newline at end of file + Cenário: Admin deixa o formulário de edição da disciplina 1 em branco (sad path) + Dado que está na página de disciplinas + Quando eu clico em "Editar Disciplina" + Então eu devo estar na página de edição de disciplina + Quando eu preencho o formulário com: + | Nome | Banco de Dados | + | Créditos Práticos | | + | Créditos Teóricos | | + | Créditos Est | | + | Créditos Ext | | + E eu marco a checkbox de "Monitoria" + E eu aperto em "Atualizar" + Então eu devo ver "Ocorreu um erro ao atualizar a disciplina." diff --git a/features/step_definitions/web_steps.rb b/features/step_definitions/web_steps.rb index d1ff447a..726c6c78 100644 --- a/features/step_definitions/web_steps.rb +++ b/features/step_definitions/web_steps.rb @@ -112,6 +112,7 @@ def with_scope(locator) Dado /^(?:|que )o banco possui uma disciplina$/ do Disciplina.create!( + :id => 1, :cod_disciplina => 1, :nome => "Engenharia de Software", :fk_tipo_disciplina_id => 1, @@ -256,6 +257,15 @@ def with_scope(locator) page.click('Ok') end +Quando /^(?:|eu )marco a checkbox de "([^"]*)"$/ do |label| + page.has_checked_field?('checkbox').should be false + + find('//*[@id="checkbox"]').check + + page.has_checked_field?('checkbox').should be true + +end + Então /^(?:|eu )devo estar na (.+)$/ do |page_name| current_path = URI.parse(current_url).path if current_path.respond_to? :should @@ -372,17 +382,11 @@ def with_scope(locator) -Dado('que usuário está logado com o perfil de Coordenador') do - - -end - - # end Quando('o usuário acessa o menu {string}') do |string| - # expect(page).to have_link("Disciplinas", visible: true) + expect(page).to have_link("Disciplinas", visible: true) page.should have_content(string) @@ -398,7 +402,7 @@ def with_scope(locator) pending # Write code here that turns the phrase above into concrete actions end -Quando('preenche os campo checked') do +Quando('preenche o campo checked') do pending # Write code here that turns the phrase above into concrete actions end diff --git a/features/support/paths.rb b/features/support/paths.rb index f2d86348..b306d574 100644 --- a/features/support/paths.rb +++ b/features/support/paths.rb @@ -67,8 +67,8 @@ def path_to(page_name) tarefa_path(Tarefa.find(1)) - when /^página de edição da disciplina (.*)$/ - edit_disciplina_path(Disciplina.find($1)) + when /^página de edição de disciplina$/ + edit_disciplina_path(Disciplina.find(1)) when /^página de nova disciplina$/ new_disciplina_path From e6a3a3d1ca284571ee213131682b184b4a2d0bb1 Mon Sep 17 00:00:00 2001 From: titofrota Date: Thu, 6 May 2021 02:10:49 -0300 Subject: [PATCH 09/18] ADD rendering filter for monitoria --- app/views/dashboard/monitorias.html.haml | 2 +- db/seeds.rb | 4 +- features/editarDisciplina.feature | 2 +- features/inscreverMonitoria.feature | 9 ++-- features/step_definitions/web_steps.rb | 56 ++++++------------------ features/support/paths.rb | 2 +- 6 files changed, 24 insertions(+), 51 deletions(-) diff --git a/app/views/dashboard/monitorias.html.haml b/app/views/dashboard/monitorias.html.haml index 60280a3e..3742f3c1 100644 --- a/app/views/dashboard/monitorias.html.haml +++ b/app/views/dashboard/monitorias.html.haml @@ -125,7 +125,7 @@ - @disciplinas = Disciplina.all_disciplinas - @disciplinas.each do |disciplina| - @turmas.each do |turma| - - if disciplina.cod_disciplina == turma.fk_cod_disciplina + - if ((disciplina.cod_disciplina == turma.fk_cod_disciplina) && (disciplina.monitoria == true)) .card .card-body %h5 diff --git a/db/seeds.rb b/db/seeds.rb index b25fbffb..313f7c32 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -29,7 +29,7 @@ puts "Seed done." # User.create(id: 1, name: "Aluno1", email: "aluno1@gmail.com", password: "123456", -# cpf: "03638481182", rg: "2645178", matricula: "140080279") + # cpf: "03638481182", rg: "2645178", matricula: "140080279") # User.create(id: 2, name: "Aluno2", email: "aluno2@gmail.com", password: "123456", # cpf: "03638481111", rg: "2645111", matricula: "140080211", @@ -40,6 +40,6 @@ ###################### ###################### -# Turma.create([{id:1, turma: "A", professor: "Carla", fk_cod_disciplina: 1}]) +# Turma.create([{turma: "A", professor: "Carla", fk_cod_disciplina: 1}]) ###################### diff --git a/features/editarDisciplina.feature b/features/editarDisciplina.feature index 504df45c..381ac996 100644 --- a/features/editarDisciplina.feature +++ b/features/editarDisciplina.feature @@ -3,7 +3,7 @@ Cenário de Fundo: Dado que o banco possui um adminstrador - E que o banco possui uma disciplina + E que o banco possui uma disciplina que nao permite monitoria E que eu estou na página de login de usuários E que o "admin" está logado diff --git a/features/inscreverMonitoria.feature b/features/inscreverMonitoria.feature index bfc71732..39c993a1 100644 --- a/features/inscreverMonitoria.feature +++ b/features/inscreverMonitoria.feature @@ -3,14 +3,12 @@ Cenário de Fundo: Dado que o banco possui um aluno e um professor - E que o banco possui uma disciplina - E que o banco possui uma disciplina que nao permite monitoria E que o banco possui duas turmas cadastradas - E que o banco possui uma monitoria E que eu estou na página de login de usuários E que o "aluno" está logado Cenário: O aluno efetua o processo de aplicar para monitoria (Happy Path) + Dado que o banco possui uma disciplina Quando eu clico em "Monitoria" Então eu devo estar na página de monitoria Quando eu clico em "link_1" @@ -23,6 +21,8 @@ E eu devo ver "Aplicaçao para monitoria enviada com sucesso!" Cenário: O aluno tenta aplicar novamente para monitoria na mesma turma de uma dada disciplina (Sad Path) + Dado que o banco possui uma disciplina + E que o banco possui uma monitoria Quando eu clico em "Monitoria" Então eu devo estar na página de monitoria Quando eu clico em "link_2" @@ -35,6 +35,7 @@ E eu devo ver "Ocorreu um erro ao cadastrar a monitoria. Nenhuma monitoria cadastrada." Cenário: O aluno tenta aplicar aplicar para uma monitoria que nao aceita monitores (Sad Path) + Dado que o banco possui uma disciplina que nao permite monitoria Quando eu clico em "Monitoria" Então eu devo estar na página de monitoria - E o link "link_3" não deve existir + Então eu não devo ver "Aplicar para monitoria" diff --git a/features/step_definitions/web_steps.rb b/features/step_definitions/web_steps.rb index 726c6c78..e98ea860 100644 --- a/features/step_definitions/web_steps.rb +++ b/features/step_definitions/web_steps.rb @@ -119,12 +119,22 @@ def with_scope(locator) :c_prat => 4, :c_teor => 2, :c_est => 4, - :c_ext => 0) + :c_ext => 0, + :monitoria => "true") end -# Dado /^(?:|que )o banco possui uma disciplina que nao permite monitoria$/ do -# # TODO: implementar disciplina que não permite monitoria e inserir aqui -# end +Dado /^(?:|que )o banco possui uma disciplina que nao permite monitoria$/ do + Disciplina.create!( + :id => 2, + :cod_disciplina => 1, + :nome => "Software Básico", + :fk_tipo_disciplina_id => 1, + :c_prat => 2, + :c_teor => 2, + :c_est => 0, + :c_ext => 0, + :monitoria => "false") +end Dado /^(?:|que )o banco possui uma turma cadastrada$/ do Turma.create!( @@ -380,41 +390,3 @@ def with_scope(locator) email.should == nil end - - - -# end -Quando('o usuário acessa o menu {string}') do |string| - - expect(page).to have_link("Disciplinas", visible: true) - - page.should have_content(string) - -end - -Quando('aciona o botão {string}') do |string| - - f. - pending # Write code here that turns the phrase above into concrete actions -end - -Quando('está na página de edição de disciplina') do - pending # Write code here that turns the phrase above into concrete actions -end - -Quando('preenche o campo checked') do - pending # Write code here that turns the phrase above into concrete actions -end - -Quando('envia o formulario para atualizar a disciplina') do - pending # Write code here that turns the phrase above into concrete actions -end - -Quando('a disciplina é atualizada no sistema') do - - pending # Write code here that turns the phrase above into concrete actions -end - -Então('o usuário deve ver a mensagem {string} na página de listagem de disciplinas.') do |string| - pending # Write code here that turns the phrase above into concrete actions -end diff --git a/features/support/paths.rb b/features/support/paths.rb index b306d574..3f3840d2 100644 --- a/features/support/paths.rb +++ b/features/support/paths.rb @@ -68,7 +68,7 @@ def path_to(page_name) when /^página de edição de disciplina$/ - edit_disciplina_path(Disciplina.find(1)) + edit_disciplina_path(Disciplina.find(2)) when /^página de nova disciplina$/ new_disciplina_path From 5b5091716763e4172f3d3f428eec16561ee33b93 Mon Sep 17 00:00:00 2001 From: titofrota Date: Thu, 6 May 2021 02:35:04 -0300 Subject: [PATCH 10/18] ADD more scenarios for editarDisciplina.feature --- .gitignore | 4 +- coverage/.resultset.json | 1683 ++ coverage/index.html | 19248 +++++++++++++++++++++++ features/editarDisciplina.feature | 31 +- features/step_definitions/web_steps.rb | 9 +- features/support/paths.rb | 2 +- 6 files changed, 20962 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index ca8c327d..c2c807d7 100644 --- a/.gitignore +++ b/.gitignore @@ -64,4 +64,6 @@ # .idea/misc.xml # *.ipr -# End of https://www.gitignore.io/api/ruby,rails,rubymine \ No newline at end of file +# End of https://www.gitignore.io/api/ruby,rails,rubymine + +/coverage/ \ No newline at end of file diff --git a/coverage/.resultset.json b/coverage/.resultset.json index e69de29b..16dca167 100644 --- a/coverage/.resultset.json +++ b/coverage/.resultset.json @@ -0,0 +1,1683 @@ +{ + "RSpec": { + "coverage": { + "/home/italo/unb/monitoriaCIC/app/helpers/application_helper.rb": { + "lines": [ + 1, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/helpers/atendimentos_helper.rb": { + "lines": [ + 1, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/helpers/atividades_helper.rb": { + "lines": [ + 1, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/helpers/disciplinas_helper.rb": { + "lines": [ + 1, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/helpers/historico_helper.rb": { + "lines": [ + 1, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/helpers/home_helper.rb": { + "lines": [ + 1, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/helpers/motivos_helper.rb": { + "lines": [ + 1, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/helpers/reset_senhas_helper.rb": { + "lines": [ + 1, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/helpers/sessions_helper.rb": { + "lines": [ + 1, + 1, + 5, + null, + null, + 1, + 3, + 0, + null, + null, + null, + 1, + null, + 12, + null, + null, + 1, + 3, + null, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/helpers/tarefas_helper.rb": { + "lines": [ + 1, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/controllers/admins_controller.rb": { + "lines": [ + 1, + 1, + null, + null, + 1, + null, + 1, + 3, + 3, + null, + null, + 1, + 2, + null, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/controllers/application_controller.rb": { + "lines": [ + 1, + 1, + 1, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/controllers/atendimentos_controller.rb": { + "lines": [ + 1, + 1, + null, + null, + null, + null, + 1, + 1, + 1, + null, + null, + null, + 1, + 0, + null, + null, + null, + null, + null, + null, + null, + 1, + 4, + 4, + null, + 4, + 0, + null, + 4, + null, + null, + 4, + null, + null, + null, + null, + 1, + 0, + 0, + null, + 0, + 0, + null, + 0, + null, + null, + 0, + null, + null, + null, + null, + 1, + 0, + 0, + null, + 0, + 0, + null, + null, + 1, + null, + 1, + 0, + null, + null, + null, + 1, + 3, + null, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/controllers/atividades_controller.rb": { + "lines": [ + 1, + 1, + 1, + null, + null, + null, + 1, + 0, + null, + null, + null, + null, + 1, + null, + null, + null, + null, + 1, + 1, + null, + null, + null, + 1, + null, + null, + null, + null, + null, + null, + null, + 1, + 4, + null, + 4, + 3, + 3, + null, + 1, + 1, + null, + null, + null, + null, + null, + null, + null, + 1, + null, + 3, + 3, + null, + 3, + 2, + null, + 1, + null, + null, + 3, + null, + null, + null, + null, + null, + 1, + 2, + 2, + null, + 2, + 2, + null, + null, + 1, + null, + 1, + 0, + 0, + null, + null, + null, + 1, + null, + 1, + 5, + null, + null, + null, + 1, + 6, + null, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/controllers/dados_bancarios_controller.rb": { + "lines": [ + 1, + 1, + null, + 1, + null, + 1, + 5, + null, + 1, + 0, + 0, + null, + null, + null, + null, + 0, + null, + 0, + null, + 1, + null, + null, + 1, + null, + null, + 1, + 3, + 3, + null, + null, + 1, + 0, + 0, + null, + 0, + 0, + null, + 0, + null, + null, + 0, + null, + null, + 1, + 0, + 0, + 0, + 0, + null, + 0, + 0, + null, + null, + 1, + 1, + 1, + 1, + null, + null, + null, + 1, + 4, + null, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/controllers/dashboard_controller.rb": { + "lines": [ + 1, + 1, + null, + 1, + null, + 1, + 3, + 1, + 2, + 1, + null, + 1, + 1, + null, + null, + null, + 1, + null, + 1, + null, + null, + null, + 1, + null, + 1, + null, + 1, + 2, + 2, + 2, + 2, + 0, + 0, + 0, + null, + null, + null, + null, + null, + null, + 1, + 1, + null, + null, + 1, + 2, + null, + null, + 1, + 2, + 2, + 2, + 3, + 0, + null, + null, + null, + null, + 1, + 0, + 0, + 0, + null, + 0, + null, + 0, + 0, + 0, + 0, + null, + null, + 0, + 0, + 0, + null, + null, + 0, + 0, + null, + 0, + 0, + null, + 0, + null, + null, + null, + 0, + null, + null, + 1, + 1, + null, + null, + null, + null, + null, + null, + 1, + 1, + 1, + null, + 1, + null, + null, + 1, + 1, + null, + null, + 1, + 1, + 1, + null, + null, + 1, + 1, + 2, + 2, + null, + null, + null, + null, + null, + null, + null, + null, + null, + 1, + 1, + 1, + 1, + null, + 1, + 1, + null, + 1, + null, + 1, + null, + 0, + null, + null, + null, + 1, + null, + null, + null, + null, + null, + null, + 1, + null, + 0, + null, + 0, + null, + null, + 0, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + 1, + 0, + 0, + 0, + null, + 0, + 0, + null, + 0, + null, + 0, + null, + null, + 0, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + 1, + 0, + 0, + 0, + null, + 0, + null, + null, + null, + null, + null, + null, + 1, + null, + 0, + null, + null, + null, + null, + null, + null, + 1, + 1, + null, + 0, + null, + 0, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + 1, + 0, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + 1, + null, + 1, + 1, + null, + null, + null, + 1, + null, + null, + null, + null, + 1, + 87, + null, + null, + 87, + 50, + null, + null, + null, + null, + null, + 1, + 87, + null, + null, + null, + 1, + 50, + 50, + null, + null, + null, + null, + null, + null, + null, + null, + null, + 1, + 50, + 50, + null, + null, + null, + 1, + 50, + null, + 0, + null, + 2, + null, + 34, + null, + 9, + null, + 4, + null, + null, + 0, + null, + null, + 1, + null, + null, + null, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/controllers/disciplinas_controller.rb": { + "lines": [ + 1, + 1, + 1, + 1, + null, + 1, + 2, + null, + null, + 1, + 1, + null, + 1, + 0, + null, + 1, + 1, + null, + null, + null, + 1, + null, + 1, + 0, + 0, + null, + 0, + 0, + null, + null, + null, + 1, + 0, + 0, + 0, + null, + null, + 0, + 0, + 0, + null, + null, + 0, + 0, + null, + null, + 1, + 1, + 1, + null, + null, + 1, + 4, + null, + null, + 1, + 0, + 0, + null, + null, + null, + 1, + 0, + 0, + 0, + null, + null, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/controllers/faq_controller.rb": { + "lines": [ + 1, + 1, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/controllers/home_controller.rb": { + "lines": [ + 1, + 1, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/controllers/monitorias_controller.rb": { + "lines": [ + 1, + 1, + 1, + 1, + null, + 1, + 1, + 1, + null, + null, + 1, + 4, + 4, + 4, + 4, + 4, + null, + null, + null, + 4, + 0, + null, + 4, + 4, + null, + null, + null, + 1, + 1, + null, + null, + 1, + null, + null, + 1, + 3, + 3, + null, + 0, + null, + null, + null, + 1, + 1, + 1, + null, + null, + 1, + 1, + 4, + null, + null, + 1, + 1, + null, + null, + 1, + 5, + null, + null, + 1, + 0, + 0, + null, + null, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/controllers/professors_controller.rb": { + "lines": [ + 1, + null, + null, + 1, + null, + 1, + null, + null, + 1, + null, + 1, + 6, + null, + 6, + 4, + 4, + 4, + null, + 2, + 2, + null, + null, + null, + 1, + null, + 2, + null, + 2, + null, + null, + 1, + 6, + 6, + null, + 6, + 4, + null, + 2, + null, + null, + 6, + null, + null, + 1, + null, + 1, + 9, + null, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/controllers/reset_senhas_controller.rb": { + "lines": [ + 1, + 1, + 1, + 1, + null, + 1, + null, + null, + 1, + 3, + 3, + 1, + 1, + 1, + 1, + null, + 2, + 2, + null, + null, + null, + 1, + null, + null, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + null, + 0, + null, + null, + null, + 1, + null, + null, + 1, + 5, + null, + null, + null, + 1, + 4, + 4, + null, + null, + null, + null, + 1, + 0, + 0, + 0, + null, + null, + null, + null, + 1, + 0, + null, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/controllers/sessions_controller.rb": { + "lines": [ + 1, + 1, + null, + 1, + null, + 3, + null, + null, + null, + 3, + 3, + 3, + null, + 0, + 0, + null, + null, + null, + 1, + 0, + 0, + null, + null, + null, + 1, + 6, + null, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/controllers/sobre_controller.rb": { + "lines": [ + 1, + 1, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/controllers/tarefas_controller.rb": { + "lines": [ + 1, + 1, + null, + null, + null, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + null, + null, + null, + null, + null, + null, + 1, + null, + null, + null, + null, + 1, + 1, + 1, + null, + null, + null, + 1, + null, + null, + null, + null, + 1, + 3, + 3, + 1, + null, + 1, + 1, + null, + null, + null, + null, + null, + null, + null, + 1, + 4, + 3, + null, + 1, + 1, + null, + null, + null, + null, + null, + 1, + 1, + 1, + null, + null, + 1, + null, + 1, + 7, + null, + null, + null, + 1, + 5, + null, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/controllers/turmas_controller.rb": { + "lines": [ + 1, + null, + 1, + 1, + null, + null, + 1, + 1, + null, + null, + 1, + 4, + null, + 3, + 3, + null, + 0, + null, + null, + 3, + null, + null, + 1, + 5, + 5, + null, + 4, + 4, + null, + 0, + null, + null, + 4, + null, + null, + 1, + 1, + 1, + 0, + 0, + null, + null, + 1, + 1, + 1, + null, + null, + 1, + 1, + 6, + null, + null, + 1, + 0, + null, + null, + 1, + 1, + 1, + 3, + 2, + null, + null, + 1, + null, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/controllers/users_controller.rb": { + "lines": [ + 1, + null, + 1, + null, + null, + 1, + 6, + null, + 6, + 0, + 0, + 0, + null, + 6, + 6, + null, + null, + null, + 1, + 6, + 6, + null, + 6, + 4, + null, + 2, + null, + null, + 6, + null, + null, + 1, + 1, + 12, + null, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/models/atendimento.rb": { + "lines": [ + 1, + null, + null, + 1, + null, + null, + null, + 1, + 1, + 1, + null, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/models/application_record.rb": { + "lines": [ + 1, + 1, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/models/atividade.rb": { + "lines": [ + 1, + null, + null, + 1, + 1, + 1, + 1, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/models/dados_bancarios.rb": { + "lines": [ + 1, + 1, + null, + 1, + 1, + 1, + null, + 1, + null, + null, + null, + null, + 1, + 1, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/models/disciplina.rb": { + "lines": [ + 1, + 1, + 1, + null, + null, + 1, + 0, + null, + null, + 1, + 1, + 1, + 1, + 1, + 1, + null, + null, + 1, + 1, + 1, + 1, + 1, + null, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/models/monitoria.rb": { + "lines": [ + 1, + null, + 1, + 1, + 1, + 3, + null, + 1, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + 1, + 1, + null, + 1, + 1, + 1, + 1, + 1, + null, + null, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/models/professor.rb": { + "lines": [ + 1, + 1, + null, + 1, + null, + 1, + 1, + null, + null, + null, + 1, + 1, + 1, + null, + 1, + 1, + null, + null, + 1, + null, + null, + 1, + null, + null, + null, + 1, + 1, + null, + null, + 1, + 1, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/models/tarefa.rb": { + "lines": [ + 1, + 1, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/models/turma.rb": { + "lines": [ + 1, + 1, + 1, + null, + 1, + 10, + 10, + 10, + null, + null, + 1, + null, + null, + 1, + 1, + null, + 1, + 1, + 3, + 3, + 3, + null, + null, + 1, + null, + null, + 1, + 1, + 1, + null, + 1, + 3, + 3, + 3, + null, + null, + 1, + null, + null, + 1, + null, + 1, + null, + null, + null, + null, + 1, + 1, + null, + null, + 1, + 1, + 1, + 1, + 1, + null, + 1, + 34, + null, + 34, + 8, + 3, + null, + null, + null, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/models/user.rb": { + "lines": [ + 1, + 1, + 1, + null, + 1, + null, + null, + 1, + 1, + 1, + 1, + 1, + null, + null, + 1, + 1, + 1, + 1, + null, + null, + null, + 1, + null, + null, + null, + null, + 1, + null, + 1, + 1, + null, + 1, + 1, + null, + 1, + null, + 1, + 1, + null, + null, + 1, + 230, + 230, + 230, + null, + 230, + 2106, + null, + 2106, + 2106, + null, + 230, + 230, + 103, + null, + null, + 230, + null, + null, + 1, + 115, + 115, + 1228, + null, + null, + 115, + 115, + null, + 115, + 12, + null, + null, + null, + null, + 1, + 1, + null, + 1, + null, + null, + null, + 1, + 13, + null, + null, + null, + 1, + 1, + 1, + 1, + null, + null, + null, + 1, + 1, + null, + null, + null, + 1, + 0, + null, + null, + null, + 1, + 2, + 2, + 0, + null, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/models/admin.rb": { + "lines": [ + 1, + 1, + null, + 1, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/models/motivo.rb": { + "lines": [ + 1, + null, + 1, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/mailers/professor_mailer.rb": { + "lines": [ + 1, + 1, + null, + null, + 1, + 2, + 2, + 2, + null, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/mailers/application_mailer.rb": { + "lines": [ + 1, + 1, + 1, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/mailers/user_mailer.rb": { + "lines": [ + 1, + null, + null, + null, + null, + null, + null, + 1, + 2, + 2, + null, + null + ] + }, + "/home/italo/unb/monitoriaCIC/app/channels/application_cable/channel.rb": { + "lines": [ + 0, + 0, + 0, + 0 + ], + "branches": { + } + }, + "/home/italo/unb/monitoriaCIC/app/channels/application_cable/connection.rb": { + "lines": [ + 0, + 0, + 0, + 0 + ], + "branches": { + } + }, + "/home/italo/unb/monitoriaCIC/app/jobs/application_job.rb": { + "lines": [ + 0, + 0 + ], + "branches": { + } + }, + "/home/italo/unb/monitoriaCIC/app/controllers/motivos_controller.rb": { + "lines": [ + 0, + 0, + null, + null, + null, + 0, + 0, + 0, + null, + null, + null, + 0, + 0, + null, + null, + 0, + 0, + 0, + null, + null, + 0, + 0, + null, + null, + null, + 0, + 0, + null, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + null, + null, + null, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + null, + null, + null, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + null, + 0, + null, + 0, + 0, + 0, + null, + null, + 0, + 0, + 0, + 0 + ], + "branches": { + } + }, + "/home/italo/unb/monitoriaCIC/app/controllers/historico_controller.rb": { + "lines": [ + 0, + null, + 0 + ], + "branches": { + } + } + }, + "timestamp": 1620278078 + } +} diff --git a/coverage/index.html b/coverage/index.html index e69de29b..6acc3687 100644 --- a/coverage/index.html +++ b/coverage/index.html @@ -0,0 +1,19248 @@ + + + + Code coverage for Monitoriacic + + + + + + + + +
+ loading +
+
+
Generated 2021-05-06T02:14:38-03:00
+
    + +
    +
    +

    + All Files + ( + + 74.8% + + + + covered at + + + 15.27 + + hits/line + ) +

    + + + +
    + 47 files in total. +
    + +
    + 750 relevant lines, + 561 lines covered and + 189 lines missed. + ( + 74.8% + +) +
    + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    File% coveredLinesRelevant LinesLines coveredLines missedAvg. Hits / Line
    app/channels/application_cable/channel.rb0.00 %44040.00
    app/channels/application_cable/connection.rb0.00 %44040.00
    app/controllers/admins_controller.rb100.00 %158801.63
    app/controllers/application_controller.rb100.00 %43301.00
    app/controllers/atendimentos_controller.rb58.06 %703118131.13
    app/controllers/atividades_controller.rb91.89 %90373431.78
    app/controllers/dados_bancarios_controller.rb54.29 %643519160.86
    app/controllers/dashboard_controller.rb65.87 %31312683435.52
    app/controllers/disciplinas_controller.rb53.85 %683921180.64
    app/controllers/faq_controller.rb100.00 %32201.00
    app/controllers/historico_controller.rb0.00 %32020.00
    app/controllers/home_controller.rb100.00 %32201.00
    app/controllers/monitorias_controller.rb89.19 %66373341.84
    app/controllers/motivos_controller.rb0.00 %74500500.00
    app/controllers/professors_controller.rb100.00 %49252503.20
    app/controllers/reset_senhas_controller.rb66.67 %643624121.11
    app/controllers/sessions_controller.rb71.43 %28141041.64
    app/controllers/sobre_controller.rb100.00 %32201.00
    app/controllers/tarefas_controller.rb93.94 %75333121.52
    app/controllers/turmas_controller.rb86.49 %66373251.78
    app/controllers/users_controller.rb85.00 %36201733.60
    app/helpers/application_helper.rb100.00 %21101.00
    app/helpers/atendimentos_helper.rb100.00 %21101.00
    app/helpers/atividades_helper.rb100.00 %21101.00
    app/helpers/disciplinas_helper.rb100.00 %21101.00
    app/helpers/historico_helper.rb100.00 %21101.00
    app/helpers/home_helper.rb100.00 %21101.00
    app/helpers/motivos_helper.rb100.00 %21101.00
    app/helpers/reset_senhas_helper.rb100.00 %21101.00
    app/helpers/sessions_helper.rb90.00 %2010912.80
    app/helpers/tarefas_helper.rb100.00 %21101.00
    app/jobs/application_job.rb0.00 %22020.00
    app/mailers/application_mailer.rb100.00 %43301.00
    app/mailers/professor_mailer.rb100.00 %106601.50
    app/mailers/user_mailer.rb100.00 %124401.50
    app/models/admin.rb100.00 %53301.00
    app/models/application_record.rb100.00 %32201.00
    app/models/atendimento.rb100.00 %125501.00
    app/models/atividade.rb100.00 %85501.00
    app/models/dados_bancarios.rb100.00 %158801.00
    app/models/disciplina.rb93.75 %24161510.94
    app/models/monitoria.rb100.00 %29131301.15
    app/models/motivo.rb100.00 %42201.00
    app/models/professor.rb100.00 %32161601.00
    app/models/tarefa.rb100.00 %32201.00
    app/models/turma.rb100.00 %66383804.00
    app/models/user.rb96.61 %10959572167.78
    +
    +
    + + + +
    +

    + Controllers + ( + + 67.53% + + + + covered at + + + 2.36 + + hits/line + ) +

    + + + +
    + 19 files in total. +
    + +
    + 539 relevant lines, + 364 lines covered and + 175 lines missed. + ( + 67.53% + +) +
    + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    File% coveredLinesRelevant LinesLines coveredLines missedAvg. Hits / Line
    app/controllers/admins_controller.rb100.00 %158801.63
    app/controllers/application_controller.rb100.00 %43301.00
    app/controllers/atendimentos_controller.rb58.06 %703118131.13
    app/controllers/atividades_controller.rb91.89 %90373431.78
    app/controllers/dados_bancarios_controller.rb54.29 %643519160.86
    app/controllers/dashboard_controller.rb65.87 %31312683435.52
    app/controllers/disciplinas_controller.rb53.85 %683921180.64
    app/controllers/faq_controller.rb100.00 %32201.00
    app/controllers/historico_controller.rb0.00 %32020.00
    app/controllers/home_controller.rb100.00 %32201.00
    app/controllers/monitorias_controller.rb89.19 %66373341.84
    app/controllers/motivos_controller.rb0.00 %74500500.00
    app/controllers/professors_controller.rb100.00 %49252503.20
    app/controllers/reset_senhas_controller.rb66.67 %643624121.11
    app/controllers/sessions_controller.rb71.43 %28141041.64
    app/controllers/sobre_controller.rb100.00 %32201.00
    app/controllers/tarefas_controller.rb93.94 %75333121.52
    app/controllers/turmas_controller.rb86.49 %66373251.78
    app/controllers/users_controller.rb85.00 %36201733.60
    +
    +
    + + +
    +

    + Channels + ( + + 0.0% + + + + covered at + + + 0.0 + + hits/line + ) +

    + + + +
    + 2 files in total. +
    + +
    + 8 relevant lines, + 0 lines covered and + 8 lines missed. + ( + 0.0% + +) +
    + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    File% coveredLinesRelevant LinesLines coveredLines missedAvg. Hits / Line
    app/channels/application_cable/channel.rb0.00 %44040.00
    app/channels/application_cable/connection.rb0.00 %44040.00
    +
    +
    + + +
    +

    + Models + ( + + 98.22% + + + + covered at + + + 59.91 + + hits/line + ) +

    + + + +
    + 12 files in total. +
    + +
    + 169 relevant lines, + 166 lines covered and + 3 lines missed. + ( + 98.22% + +) +
    + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    File% coveredLinesRelevant LinesLines coveredLines missedAvg. Hits / Line
    app/models/admin.rb100.00 %53301.00
    app/models/application_record.rb100.00 %32201.00
    app/models/atendimento.rb100.00 %125501.00
    app/models/atividade.rb100.00 %85501.00
    app/models/dados_bancarios.rb100.00 %158801.00
    app/models/disciplina.rb93.75 %24161510.94
    app/models/monitoria.rb100.00 %29131301.15
    app/models/motivo.rb100.00 %42201.00
    app/models/professor.rb100.00 %32161601.00
    app/models/tarefa.rb100.00 %32201.00
    app/models/turma.rb100.00 %66383804.00
    app/models/user.rb96.61 %10959572167.78
    +
    +
    + + +
    +

    + Mailers + ( + + 100.0% + + + + covered at + + + 1.38 + + hits/line + ) +

    + + + +
    + 3 files in total. +
    + +
    + 13 relevant lines, + 13 lines covered and + 0 lines missed. + ( + 100.0% + +) +
    + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    File% coveredLinesRelevant LinesLines coveredLines missedAvg. Hits / Line
    app/mailers/application_mailer.rb100.00 %43301.00
    app/mailers/professor_mailer.rb100.00 %106601.50
    app/mailers/user_mailer.rb100.00 %124401.50
    +
    +
    + + +
    +

    + Helpers + ( + + 94.74% + + + + covered at + + + 1.95 + + hits/line + ) +

    + + + +
    + 10 files in total. +
    + +
    + 19 relevant lines, + 18 lines covered and + 1 lines missed. + ( + 94.74% + +) +
    + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    File% coveredLinesRelevant LinesLines coveredLines missedAvg. Hits / Line
    app/helpers/application_helper.rb100.00 %21101.00
    app/helpers/atendimentos_helper.rb100.00 %21101.00
    app/helpers/atividades_helper.rb100.00 %21101.00
    app/helpers/disciplinas_helper.rb100.00 %21101.00
    app/helpers/historico_helper.rb100.00 %21101.00
    app/helpers/home_helper.rb100.00 %21101.00
    app/helpers/motivos_helper.rb100.00 %21101.00
    app/helpers/reset_senhas_helper.rb100.00 %21101.00
    app/helpers/sessions_helper.rb90.00 %2010912.80
    app/helpers/tarefas_helper.rb100.00 %21101.00
    +
    +
    + + +
    +

    + Jobs + ( + + 0.0% + + + + covered at + + + 0.0 + + hits/line + ) +

    + + + +
    + 1 files in total. +
    + +
    + 2 relevant lines, + 0 lines covered and + 2 lines missed. + ( + 0.0% + +) +
    + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    File% coveredLinesRelevant LinesLines coveredLines missedAvg. Hits / Line
    app/jobs/application_job.rb0.00 %22020.00
    +
    +
    + + +
    +

    + Libraries + ( + + 100.0% + + + + covered at + + + 0.0 + + hits/line + ) +

    + + + +
    + 0 files in total. +
    + +
    + 0 relevant lines, + 0 lines covered and + 0 lines missed. + ( + 100.0% + +) +
    + + + +
    + + + + + + + + + + + + + + + + +
    File% coveredLinesRelevant LinesLines coveredLines missedAvg. Hits / Line
    +
    +
    + + +
    + + + +
    + +
    +
    +

    app/channels/application_cable/channel.rb

    +

    + + 0.0% + + + lines covered +

    + + + +
    + 4 relevant lines. + 0 lines covered and + 4 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + + + + + + module ApplicationCable +
    2. +
      + +
      +
    3. + + + + + + class Channel < ActionCable::Channel::Base +
    4. +
      + +
      +
    5. + + + + + + end +
    6. +
      + +
      +
    7. + + + + + + end +
    8. +
      + +
    +
    +
    + + +
    +
    +

    app/channels/application_cable/connection.rb

    +

    + + 0.0% + + + lines covered +

    + + + +
    + 4 relevant lines. + 0 lines covered and + 4 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + + + + + + module ApplicationCable +
    2. +
      + +
      +
    3. + + + + + + class Connection < ActionCable::Connection::Base +
    4. +
      + +
      +
    5. + + + + + + end +
    6. +
      + +
      +
    7. + + + + + + end +
    8. +
      + +
    +
    +
    + + +
    +
    +

    app/controllers/admins_controller.rb

    +

    + + 100.0% + + + lines covered +

    + + + +
    + 8 relevant lines. + 8 lines covered and + 0 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + class AdminsController < ApplicationController +
    2. +
      + +
      +
    3. + 1 + + + + + def index ; end +
    4. +
      + +
      +
    5. + + + + + + +
    6. +
      + +
      +
    7. + + + + + + +
    8. +
      + +
      +
    9. + 1 + + + + + def new ; end +
    10. +
      + +
      +
    11. + + + + + + +
    12. +
      + +
      +
    13. + 1 + + + + + def create +
    14. +
      + +
      +
    15. + 3 + + + + + @admin = Admin.create(admin_params) +
    16. +
      + +
      +
    17. + 3 + + + + + redirect_to root_path +
    18. +
      + +
      +
    19. + + + + + + end +
    20. +
      + +
      +
    21. + + + + + + +
    22. +
      + +
      +
    23. + 1 + + + + + def admin_params +
    24. +
      + +
      +
    25. + 2 + + + + + params.require(:admin).permit(:id, :name, :email, :password, :password_confirmation) +
    26. +
      + +
      +
    27. + + + + + + end +
    28. +
      + +
      +
    29. + + + + + + end +
    30. +
      + +
    +
    +
    + + +
    +
    +

    app/controllers/application_controller.rb

    +

    + + 100.0% + + + lines covered +

    + + + +
    + 3 relevant lines. + 3 lines covered and + 0 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + class ApplicationController < ActionController::Base +
    2. +
      + +
      +
    3. + 1 + + + + + protect_from_forgery +
    4. +
      + +
      +
    5. + 1 + + + + + include SessionsHelper +
    6. +
      + +
      +
    7. + + + + + + end +
    8. +
      + +
    +
    +
    + + +
    +
    +

    app/controllers/atendimentos_controller.rb

    +

    + + 58.06% + + + lines covered +

    + + + +
    + 31 relevant lines. + 18 lines covered and + 13 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + class AtendimentosController < ApplicationController +
    2. +
      + +
      +
    3. + 1 + + + + + before_action :set_atendimento, only: [:edit, :update, :destroy] +
    4. +
      + +
      +
    5. + + + + + + +
    6. +
      + +
      +
    7. + + + + + + # GET /atendimentos/new +
    8. +
      + +
      +
    9. + + + + + + ## +
    10. +
      + +
      +
    11. + + + + + + # busca o usuário logado para associá-lo ao novo atendimento. +
    12. +
      + +
      +
    13. + 1 + + + + + def new +
    14. +
      + +
      +
    15. + 1 + + + + + @atendimento = Atendimento.new +
    16. +
      + +
      +
    17. + 1 + + + + + @user = current_user +
    18. +
      + +
      +
    19. + + + + + + end +
    20. +
      + +
      +
    21. + + + + + + +
    22. +
      + +
      +
    23. + + + + + + # GET /atendimentos/1/edit +
    24. +
      + +
      +
    25. + 1 + + + + + def edit +
    26. +
      + +
      +
    27. + + + + + + @user = current_user +
    28. +
      + +
      +
    29. + + + + + + end +
    30. +
      + +
      +
    31. + + + + + + +
    32. +
      + +
      +
    33. + + + + + + # POST /atendimentos +
    34. +
      + +
      +
    35. + + + + + + # POST /atendimentos.json +
    36. +
      + +
      +
    37. + + + + + + # Método para criar um atendimento, associando o atendimento ao usuário logado, +
    38. +
      + +
      +
    39. + + + + + + # que será passado pelo atendimento_params +
    40. +
      + +
      +
    41. + + + + + + # Retorna para a pagina dashboard/atendimentos +
    42. +
      + +
      +
    43. + 1 + + + + + def create +
    44. +
      + +
      +
    45. + 4 + + + + + @user = current_user +
    46. +
      + +
      +
    47. + 4 + + + + + @atendimento = Atendimento.create(atendimento_params) +
    48. +
      + +
      +
    49. + + + + + + +
    50. +
      + +
      +
    51. + 4 + + + + + if !@atendimento.errors.any? +
    52. +
      + +
      +
    53. + + + + + + flash[:notice] = "Registro de atendimento realizado com sucesso!" +
    54. +
      + +
      +
    55. + + + + + + else +
    56. +
      + +
      +
    57. + 4 + + + + + flash[:danger] = @atendimento.errors.full_messages +
    58. +
      + +
      +
    59. + + + + + + end +
    60. +
      + +
      +
    61. + + + + + + +
    62. +
      + +
      +
    63. + 4 + + + + + redirect_to dashboard_atendimentos_path +
    64. +
      + +
      +
    65. + + + + + + end +
    66. +
      + +
      +
    67. + + + + + + +
    68. +
      + +
      +
    69. + + + + + + # PATCH/PUT /atendimentos/1 +
    70. +
      + +
      +
    71. + + + + + + # PATCH/PUT /atendimentos/1.json +
    72. +
      + +
      +
    73. + 1 + + + + + def update +
    74. +
      + +
      +
    75. + + + + + + @atendimento = Atendimento.find(params[:id]) +
    76. +
      + +
      +
    77. + + + + + + @atendimento.update_attributes(atendimento_params) +
    78. +
      + +
      +
    79. + + + + + + +
    80. +
      + +
      +
    81. + + + + + + if !@atendimento.errors.any? +
    82. +
      + +
      +
    83. + + + + + + flash[:notice] = 'Atendimento atualizado com sucesso!' +
    84. +
      + +
      +
    85. + + + + + + elsif +
    86. +
      + +
      +
    87. + + + + + + flash[:danger] = @atendimento.errors.first[1] +
    88. +
      + +
      +
    89. + + + + + + end +
    90. +
      + +
      +
    91. + + + + + + +
    92. +
      + +
      +
    93. + + + + + + redirect_to dashboard_atendimentos_path +
    94. +
      + +
      +
    95. + + + + + + end +
    96. +
      + +
      +
    97. + + + + + + +
    98. +
      + +
      +
    99. + + + + + + # DELETE /atendimentos/1 +
    100. +
      + +
      +
    101. + + + + + + # DELETE /atendimentos/1.json +
    102. +
      + +
      +
    103. + 1 + + + + + def destroy +
    104. +
      + +
      +
    105. + + + + + + @atendimento = Atendimento.find(params[:id]) +
    106. +
      + +
      +
    107. + + + + + + @atendimento.delete +
    108. +
      + +
      +
    109. + + + + + + +
    110. +
      + +
      +
    111. + + + + + + flash[:notice] = 'Atendimento apagado com sucesso!' +
    112. +
      + +
      +
    113. + + + + + + redirect_to dashboard_atendimentos_path +
    114. +
      + +
      +
    115. + + + + + + end +
    116. +
      + +
      +
    117. + + + + + + +
    118. +
      + +
      +
    119. + 1 + + + + + private +
    120. +
      + +
      +
    121. + + + + + + # Use callbacks to share common setup or constraints between actions. +
    122. +
      + +
      +
    123. + 1 + + + + + def set_atendimento +
    124. +
      + +
      +
    125. + + + + + + @atendimento = Atendimento.find(params[:id]) +
    126. +
      + +
      +
    127. + + + + + + end +
    128. +
      + +
      +
    129. + + + + + + +
    130. +
      + +
      +
    131. + + + + + + # Never trust parameters from the scary internet, only allow the white list through. +
    132. +
      + +
      +
    133. + 1 + + + + + def atendimento_params +
    134. +
      + +
      +
    135. + 3 + + + + + params.require(:atendimento).permit(:motivo_id, :dia, :descricao, :aluno_atendido, :monitor_id) +
    136. +
      + +
      +
    137. + + + + + + end +
    138. +
      + +
      +
    139. + + + + + + end +
    140. +
      + +
    +
    +
    + + +
    +
    +

    app/controllers/atividades_controller.rb

    +

    + + 91.89% + + + lines covered +

    + + + +
    + 37 relevant lines. + 34 lines covered and + 3 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + class AtividadesController < ApplicationController +
    2. +
      + +
      +
    3. + 1 + + + + + before_action :user_logged +
    4. +
      + +
      +
    5. + 1 + + + + + before_action :set_atividade, only: [:show, :edit, :update, :destroy] +
    6. +
      + +
      +
    7. + + + + + + +
    8. +
      + +
      +
    9. + + + + + + # GET /atividades +
    10. +
      + +
      +
    11. + + + + + + # GET /atividades.json +
    12. +
      + +
      +
    13. + 1 + + + + + def index +
    14. +
      + +
      +
    15. + + + + + + @atividades = Atividade.all +
    16. +
      + +
      +
    17. + + + + + + end +
    18. +
      + +
      +
    19. + + + + + + +
    20. +
      + +
      +
    21. + + + + + + # GET /atividades/1 +
    22. +
      + +
      +
    23. + + + + + + # GET /atividades/1.json +
    24. +
      + +
      +
    25. + 1 + + + + + def show +
    26. +
      + +
      +
    27. + + + + + + end +
    28. +
      + +
      +
    29. + + + + + + +
    30. +
      + +
      +
    31. + + + + + + # GET /atividades/new +
    32. +
      + +
      +
    33. + + + + + + #Associa o registro de atividade ao usuario logado +
    34. +
      + +
      +
    35. + 1 + + + + + def new +
    36. +
      + +
      +
    37. + 1 + + + + + @atividade = Atividade.new +
    38. +
      + +
      +
    39. + + + + + + end +
    40. +
      + +
      +
    41. + + + + + + +
    42. +
      + +
      +
    43. + + + + + + # GET /atividades/1/edit +
    44. +
      + +
      +
    45. + 1 + + + + + def edit +
    46. +
      + +
      +
    47. + + + + + + end +
    48. +
      + +
      +
    49. + + + + + + +
    50. +
      + +
      +
    51. + + + + + + # POST /atividades +
    52. +
      + +
      +
    53. + + + + + + # POST /atividades.json +
    54. +
      + +
      +
    55. + + + + + + # Método para criar o registro de uma atividade, associando a atividade ao usuário logado, +
    56. +
      + +
      +
    57. + + + + + + # que será passado pelo atividade_params +
    58. +
      + +
      +
    59. + + + + + + # Criando ou não, retorna para o dashboard +
    60. +
      + +
      +
    61. + 1 + + + + + def create +
    62. +
      + +
      +
    63. + 4 + + + + + @atividade = Atividade.create(atividade_params) +
    64. +
      + +
      +
    65. + + + + + + +
    66. +
      + +
      +
    67. + 4 + + + + + if !@atividade.errors.any? +
    68. +
      + +
      +
    69. + 3 + + + + + flash[:notice] = "Registro de atividade realizado com sucesso!" +
    70. +
      + +
      +
    71. + 3 + + + + + redirect_to dashboard_atividades_path +
    72. +
      + +
      +
    73. + + + + + + else +
    74. +
      + +
      +
    75. + 1 + + + + + flash[:danger] = @atividade.errors.first[1] +
    76. +
      + +
      +
    77. + 1 + + + + + redirect_to dashboard_atividades_path +
    78. +
      + +
      +
    79. + + + + + + end +
    80. +
      + +
      +
    81. + + + + + + end +
    82. +
      + +
      +
    83. + + + + + + +
    84. +
      + +
      +
    85. + + + + + + # PATCH/PUT /atividades/1 +
    86. +
      + +
      +
    87. + + + + + + # PATCH/PUT /atividades/1.json +
    88. +
      + +
      +
    89. + + + + + + # Método para editar o registro de uma atividade, passando pelo atividade_params a atividade atualizada associada +
    90. +
      + +
      +
    91. + + + + + + # ao usuario que foi capturada por params[:id] +
    92. +
      + +
      +
    93. + 1 + + + + + def update +
    94. +
      + +
      +
    95. + + + + + + +
    96. +
      + +
      +
    97. + 3 + + + + + @atividade = Atividade.find(params[:id]) +
    98. +
      + +
      +
    99. + 3 + + + + + @atividade.update_attributes(atividade_params) +
    100. +
      + +
      +
    101. + + + + + + +
    102. +
      + +
      +
    103. + 3 + + + + + if !@atividade.errors.any? +
    104. +
      + +
      +
    105. + 2 + + + + + flash[:notice] = 'Atividade atualizada com sucesso!' +
    106. +
      + +
      +
    107. + + + + + + elsif +
    108. +
      + +
      +
    109. + 1 + + + + + flash[:danger] = @atividade.errors.first[1] +
    110. +
      + +
      +
    111. + + + + + + end +
    112. +
      + +
      +
    113. + + + + + + +
    114. +
      + +
      +
    115. + 3 + + + + + redirect_to dashboard_atividades_path +
    116. +
      + +
      +
    117. + + + + + + end +
    118. +
      + +
      +
    119. + + + + + + +
    120. +
      + +
      +
    121. + + + + + + # DELETE /atividades/1 +
    122. +
      + +
      +
    123. + + + + + + # DELETE /atividades/1.json +
    124. +
      + +
      +
    125. + + + + + + # Metodo utilizado para apagar uma atividade, utilizando seu id como paramentro +
    126. +
      + +
      +
    127. + 1 + + + + + def destroy +
    128. +
      + +
      +
    129. + 2 + + + + + @atividade = Atividade.find(params[:id]) +
    130. +
      + +
      +
    131. + 2 + + + + + @atividade.delete +
    132. +
      + +
      +
    133. + + + + + + +
    134. +
      + +
      +
    135. + 2 + + + + + flash[:notice] = 'Atividade apagada com sucesso!' +
    136. +
      + +
      +
    137. + 2 + + + + + redirect_to dashboard_atividades_path +
    138. +
      + +
      +
    139. + + + + + + end +
    140. +
      + +
      +
    141. + + + + + + +
    142. +
      + +
      +
    143. + 1 + + + + + private +
    144. +
      + +
      +
    145. + + + + + + # verifica se o usuario está logado para poder acessar a pagina de registro +
    146. +
      + +
      +
    147. + 1 + + + + + def user_logged +
    148. +
      + +
      +
    149. + + + + + + if !logged_in? +
    150. +
      + +
      +
    151. + + + + + + redirect_to new_session_path, notice: "Você precisa estar logado para acessar essa página" +
    152. +
      + +
      +
    153. + + + + + + end +
    154. +
      + +
      +
    155. + + + + + + end +
    156. +
      + +
      +
    157. + + + + + + +
    158. +
      + +
      +
    159. + 1 + + + + + private +
    160. +
      + +
      +
    161. + + + + + + # Use callbacks to share common setup or constraints between actions. +
    162. +
      + +
      +
    163. + 1 + + + + + def set_atividade +
    164. +
      + +
      +
    165. + 5 + + + + + @atividade = Atividade.find(params[:id]) +
    166. +
      + +
      +
    167. + + + + + + end +
    168. +
      + +
      +
    169. + + + + + + +
    170. +
      + +
      +
    171. + + + + + + # Never trust parameters from the scary internet, only allow the white list through. +
    172. +
      + +
      +
    173. + 1 + + + + + def atividade_params +
    174. +
      + +
      +
    175. + 6 + + + + + params.require(:atividade).permit(:titulo, :mensagem, :matricula_monitor, :data) +
    176. +
      + +
      +
    177. + + + + + + end +
    178. +
      + +
      +
    179. + + + + + + end +
    180. +
      + +
    +
    +
    + + +
    +
    +

    app/controllers/dados_bancarios_controller.rb

    +

    + + 54.29% + + + lines covered +

    + + + +
    + 35 relevant lines. + 19 lines covered and + 16 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + class DadosBancariosController < ApplicationController +
    2. +
      + +
      +
    3. + 1 + + + + + before_action :user_logged +
    4. +
      + +
      +
    5. + + + + + + +
    6. +
      + +
      +
    7. + 1 + + + + + def new; end +
    8. +
      + +
      +
    9. + + + + + + +
    10. +
      + +
      +
    11. + 1 + + + + + def create +
    12. +
      + +
      +
    13. + 5 + + + + + @dados_bancarios = DadosBancarios.create(dados_bancarios_params) +
    14. +
      + +
      +
    15. + + + + + + +
    16. +
      + +
      +
    17. + 1 + + + + + if !@dados_bancarios.errors.any? +
    18. +
      + +
      +
    19. + + + + + + @user = current_user +
    20. +
      + +
      +
    21. + + + + + + @fk_banco = DadosBancarios.find_by( +
    22. +
      + +
      +
    23. + + + + + + codigo: @dados_bancarios.codigo, +
    24. +
      + +
      +
    25. + + + + + + agencia: @dados_bancarios.agencia, +
    26. +
      + +
      +
    27. + + + + + + conta_corrente: @dados_bancarios.conta_corrente +
    28. +
      + +
      +
    29. + + + + + + ) +
    30. +
      + +
      +
    31. + + + + + + @user.update(fk_banco: @fk_banco.id) +
    32. +
      + +
      +
    33. + + + + + + +
    34. +
      + +
      +
    35. + + + + + + flash[:notice] = 'Dados bancários cadastrados com sucesso!' +
    36. +
      + +
      +
    37. + + + + + + else +
    38. +
      + +
      +
    39. + 1 + + + + + flash[:danger] = @dados_bancarios.errors.full_messages +
    40. +
      + +
      +
    41. + + + + + + end +
    42. +
      + +
      +
    43. + + + + + + +
    44. +
      + +
      +
    45. + 1 + + + + + redirect_to dashboard_dados_bancarios_path +
    46. +
      + +
      +
    47. + + + + + + end +
    48. +
      + +
      +
    49. + + + + + + +
    50. +
      + +
      +
    51. + 1 + + + + + def edit +
    52. +
      + +
      +
    53. + 3 + + + + + @user = current_user +
    54. +
      + +
      +
    55. + 3 + + + + + @dados_bancarios = DadosBancarios.find(@user.fk_banco) +
    56. +
      + +
      +
    57. + + + + + + end +
    58. +
      + +
      +
    59. + + + + + + +
    60. +
      + +
      +
    61. + 1 + + + + + def update +
    62. +
      + +
      +
    63. + + + + + + @dados_bancarios = DadosBancarios.find(params[:id]) +
    64. +
      + +
      +
    65. + + + + + + @dados_bancarios.update_attributes(dados_bancarios_params) +
    66. +
      + +
      +
    67. + + + + + + +
    68. +
      + +
      +
    69. + + + + + + if !@dados_bancarios.errors.any? +
    70. +
      + +
      +
    71. + + + + + + flash[:notice] = 'Dados atualizados com sucesso!' +
    72. +
      + +
      +
    73. + + + + + + elsif +
    74. +
      + +
      +
    75. + + + + + + flash[:danger] = @dados_bancarios.errors.full_messages +
    76. +
      + +
      +
    77. + + + + + + end +
    78. +
      + +
      +
    79. + + + + + + +
    80. +
      + +
      +
    81. + + + + + + redirect_to dashboard_dados_bancarios_path +
    82. +
      + +
      +
    83. + + + + + + end +
    84. +
      + +
      +
    85. + + + + + + +
    86. +
      + +
      +
    87. + 1 + + + + + def destroy +
    88. +
      + +
      +
    89. + + + + + + @user = current_user +
    90. +
      + +
      +
    91. + + + + + + @dados_bancarios = DadosBancarios.find(params[:id]) +
    92. +
      + +
      +
    93. + + + + + + @dados_bancarios.delete +
    94. +
      + +
      +
    95. + + + + + + @user.update(fk_banco: nil) +
    96. +
      + +
      +
    97. + + + + + + +
    98. +
      + +
      +
    99. + + + + + + flash[:notice] = 'Dados bancários apagados com sucesso!' +
    100. +
      + +
      +
    101. + + + + + + redirect_to dashboard_dados_bancarios_path +
    102. +
      + +
      +
    103. + + + + + + end +
    104. +
      + +
      +
    105. + + + + + + +
    106. +
      + +
      +
    107. + 1 + + + + + private +
    108. +
      + +
      +
    109. + 1 + + + + + def user_logged +
    110. +
      + +
      +
    111. + 1 + + + + + if !logged_in? +
    112. +
      + +
      +
    113. + 1 + + + + + redirect_to new_session_path, notice: "Você precisa estar logado para acessar essa página" +
    114. +
      + +
      +
    115. + + + + + + end +
    116. +
      + +
      +
    117. + + + + + + end +
    118. +
      + +
      +
    119. + + + + + + +
    120. +
      + +
      +
    121. + 1 + + + + + def dados_bancarios_params +
    122. +
      + +
      +
    123. + 4 + + + + + params.require(:dados_bancarios).permit(:codigo, :agencia, :conta_corrente) +
    124. +
      + +
      +
    125. + + + + + + end +
    126. +
      + +
      +
    127. + + + + + + end +
    128. +
      + +
    +
    +
    + + +
    +
    +

    app/controllers/dashboard_controller.rb

    +

    + + 65.87% + + + lines covered +

    + + + +
    + 126 relevant lines. + 83 lines covered and + 43 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + class DashboardController < ApplicationController +
    2. +
      + +
      +
    3. + 1 + + + + + before_action :user_logged +
    4. +
      + +
      +
    5. + + + + + + +
    6. +
      + +
      +
    7. + 1 + + + + + def index; end +
    8. +
      + +
      +
    9. + + + + + + +
    10. +
      + +
      +
    11. + 1 + + + + + def edit_user +
    12. +
      + +
      +
    13. + 3 + + + + + if current_user.kind_of?(User) +
    14. +
      + +
      +
    15. + 1 + + + + + @user = current_user +
    16. +
      + +
      +
    17. + 2 + + + + + elsif current_user.kind_of?(Professor) +
    18. +
      + +
      +
    19. + 1 + + + + + @professor = current_user +
    20. +
      + +
      +
    21. + + + + + + else +
    22. +
      + +
      +
    23. + 1 + + + + + flash[:danger] = "Apenas alunos e professores podem editar o perfil!" +
    24. +
      + +
      +
    25. + 1 + + + + + redirect_to dashboard_path +
    26. +
      + +
      +
    27. + + + + + + end +
    28. +
      + +
      +
    29. + + + + + + end +
    30. +
      + +
      +
    31. + + + + + + +
    32. +
      + +
      +
    33. + 1 + + + + + def dados_bancarios; end +
    34. +
      + +
      +
    35. + + + + + + +
    36. +
      + +
      +
    37. + 1 + + + + + def turmas; end +
    38. +
      + +
      +
    39. + + + + + + +
    40. +
      + +
      +
    41. + + + + + + ## +
    42. +
      + +
      +
    43. + + + + + + # Método chama a view dashboard/atendimentos para renderizar todos os atendimentos +
    44. +
      + +
      +
    45. + 1 + + + + + def atendimentos; end +
    46. +
      + +
      +
    47. + + + + + + +
    48. +
      + +
      +
    49. + 1 + + + + + def atividades; end +
    50. +
      + +
      +
    51. + + + + + + +
    52. +
      + +
      +
    53. + 1 + + + + + def monitorias +
    54. +
      + +
      +
    55. + 2 + + + + + @user = current_user +
    56. +
      + +
      +
    57. + 2 + + + + + @monitorias = Array.new +
    58. +
      + +
      +
    59. + 2 + + + + + Monitoria.find_each do |m| +
    60. +
      + +
      +
    61. + 2 + + + + + if @user.kind_of?(User) +
    62. +
      + +
      +
    63. + + + + + + if m.fk_matricula == @user.matricula +
    64. +
      + +
      +
    65. + + + + + + if m.fk_status_monitoria_id != 4 +
    66. +
      + +
      +
    67. + + + + + + @monitorias << m +
    68. +
      + +
      +
    69. + + + + + + end +
    70. +
      + +
      +
    71. + + + + + + end +
    72. +
      + +
      +
    73. + + + + + + end +
    74. +
      + +
      +
    75. + + + + + + end +
    76. +
      + +
      +
    77. + + + + + + end +
    78. +
      + +
      +
    79. + + + + + + +
    80. +
      + +
      +
    81. + 1 + + + + + def disciplinas +
    82. +
      + +
      +
    83. + 1 + + + + + @disciplinas = Disciplina.find_each +
    84. +
      + +
      +
    85. + + + + + + end +
    86. +
      + +
      +
    87. + + + + + + +
    88. +
      + +
      +
    89. + 1 + + + + + def apagar_alunos +
    90. +
      + +
      +
    91. + 2 + + + + + @users = User.order(:matricula) +
    92. +
      + +
      +
    93. + + + + + + end +
    94. +
      + +
      +
    95. + + + + + + +
    96. +
      + +
      +
    97. + 1 + + + + + def historico +
    98. +
      + +
      +
    99. + 2 + + + + + @user = current_user +
    100. +
      + +
      +
    101. + 2 + + + + + @mostrar = Array.new +
    102. +
      + +
      +
    103. + 2 + + + + + Monitoria.find_each do |m| +
    104. +
      + +
      +
    105. + 3 + + + + + if (@user.kind_of?(User) && m.fk_matricula == @user.matricula && m.fk_status_monitoria_id == 4) +
    106. +
      + +
      +
    107. + + + + + + @mostrar << m +
    108. +
      + +
      +
    109. + + + + + + end +
    110. +
      + +
      +
    111. + + + + + + end +
    112. +
      + +
      +
    113. + + + + + + end +
    114. +
      + +
      +
    115. + + + + + + +
    116. +
      + +
      +
    117. + 1 + + + + + def deletar_aluno +
    118. +
      + +
      +
    119. + + + + + + @matricula = params[:user][:matricula] +
    120. +
      + +
      +
    121. + + + + + + if @matricula.length == 0 +
    122. +
      + +
      +
    123. + + + + + + @matricula = nil +
    124. +
      + +
      +
    125. + + + + + + end +
    126. +
      + +
      +
    127. + + + + + + @user = User.find_by_matricula(@matricula) +
    128. +
      + +
      +
    129. + + + + + + +
    130. +
      + +
      +
    131. + + + + + + if !@user.nil? +
    132. +
      + +
      +
    133. + + + + + + @dados_bancarios = DadosBancarios.where(id: @user.fk_banco) +
    134. +
      + +
      +
    135. + + + + + + if !@dados_bancarios.nil? +
    136. +
      + +
      +
    137. + + + + + + DadosBancarios.delete(@dados_bancarios) +
    138. +
      + +
      +
    139. + + + + + + end +
    140. +
      + +
      +
    141. + + + + + + +
    142. +
      + +
      +
    143. + + + + + + @monitoria = Monitoria.where(fk_matricula: @user.matricula) +
    144. +
      + +
      +
    145. + + + + + + if !@monitoria.nil? +
    146. +
      + +
      +
    147. + + + + + + Monitoria.delete(@monitoria) +
    148. +
      + +
      +
    149. + + + + + + end +
    150. +
      + +
      +
    151. + + + + + + +
    152. +
      + +
      +
    153. + + + + + + @user = User.delete(@user.id) +
    154. +
      + +
      +
    155. + + + + + + flash[:notice] = 'Aluno apagado com sucesso!' +
    156. +
      + +
      +
    157. + + + + + + else +
    158. +
      + +
      +
    159. + + + + + + if !@matricula.nil? +
    160. +
      + +
      +
    161. + + + + + + flash[:danger] = "Aluno de matrícula #{@matricula} não existe." +
    162. +
      + +
      +
    163. + + + + + + else +
    164. +
      + +
      +
    165. + + + + + + flash[:danger] = "Digite uma matrícula para deletar algum aluno." +
    166. +
      + +
      +
    167. + + + + + + end +
    168. +
      + +
      +
    169. + + + + + + end +
    170. +
      + +
      +
    171. + + + + + + +
    172. +
      + +
      +
    173. + + + + + + redirect_to dashboard_apagar_alunos_path +
    174. +
      + +
      +
    175. + + + + + + end +
    176. +
      + +
      +
    177. + + + + + + +
    178. +
      + +
      +
    179. + 1 + + + + + def importar_disciplinas +
    180. +
      + +
      +
    181. + 1 + + + + + @disciplinas = Disciplina.all +
    182. +
      + +
      +
    183. + + + + + + end +
    184. +
      + +
      +
    185. + + + + + + +
    186. +
      + +
      +
    187. + + + + + + ## +
    188. +
      + +
      +
    189. + + + + + + # Método para raspar as disciplinas do site do MatrículaWeb +
    190. +
      + +
      +
    191. + + + + + + # e carregá-las no modelo. +
    192. +
      + +
      +
    193. + + + + + + +
    194. +
      + +
      +
    195. + 1 + + + + + def raspar_disciplinas +
    196. +
      + +
      +
    197. + 1 + + + + + disciplinas = raspar_matriculaweb_disciplinas +
    198. +
      + +
      +
    199. + 1 + + + + + carregar_disciplinas(disciplinas) +
    200. +
      + +
      +
    201. + + + + + + +
    202. +
      + +
      +
    203. + 1 + + + + + redirect_to dashboard_importar_disciplinas_path +
    204. +
      + +
      +
    205. + + + + + + end +
    206. +
      + +
      +
    207. + + + + + + +
    208. +
      + +
      +
    209. + 1 + + + + + def importar_professores +
    210. +
      + +
      +
    211. + 1 + + + + + @teachers = Professor.all +
    212. +
      + +
      +
    213. + + + + + + end +
    214. +
      + +
      +
    215. + + + + + + +
    216. +
      + +
      +
    217. + 1 + + + + + def scrape_professores +
    218. +
      + +
      +
    219. + 1 + + + + + web_scraper +
    220. +
      + +
      +
    221. + 1 + + + + + redirect_to dashboard_importar_professores_path +
    222. +
      + +
      +
    223. + + + + + + end +
    224. +
      + +
      +
    225. + + + + + + +
    226. +
      + +
      +
    227. + 1 + + + + + private +
    228. +
      + +
      +
    229. + 1 + + + + + def user_logged +
    230. +
      + +
      +
    231. + 2 + + + + + if !logged_in? +
    232. +
      + +
      +
    233. + 2 + + + + + redirect_to new_session_path, notice: "Você precisa estar logado para acessar essa página" +
    234. +
      + +
      +
    235. + + + + + + end +
    236. +
      + +
      +
    237. + + + + + + end +
    238. +
      + +
      +
    239. + + + + + + +
    240. +
      + +
      +
    241. + + + + + + +
    242. +
      + +
      +
    243. + + + + + + ## +
    244. +
      + +
      +
    245. + + + + + + # Método que faz a requisição da página das disciplinas. +
    246. +
      + +
      +
    247. + + + + + + # +
    248. +
      + +
      +
    249. + + + + + + # Retorna uma lista de hashes com os dados das disciplinas. +
    250. +
      + +
      +
    251. + + + + + + +
    252. +
      + +
      +
    253. + 1 + + + + + def raspar_matriculaweb_disciplinas(url = "https://matriculaweb.unb.br/graduacao/oferta_dis.aspx?cod=116") +
    254. +
      + +
      +
    255. + 1 + + + + + require 'open-uri' +
    256. +
      + +
      +
    257. + 1 + + + + + require 'openssl' +
    258. +
      + +
      +
    259. + 1 + + + + + require 'nokogiri' +
    260. +
      + +
      +
    261. + + + + + + +
    262. +
      + +
      +
    263. + 1 + + + + + pagina = Nokogiri::HTML(open(url)) +
    264. +
      + +
      +
    265. + 1 + + + + + tbls_disciplinas = pagina.css('#datatable').css('tr').drop(1) +
    266. +
      + +
      +
    267. + + + + + + +
    268. +
      + +
      +
    269. + 1 + + + + + disciplinas = [] +
    270. +
      + +
      +
    271. + + + + + + +
    272. +
      + +
      +
    273. + 1 + + + + + tbls_disciplinas.each do |d| +
    274. +
      + +
      +
    275. + + + + + + +
    276. +
      + +
      +
    277. + + + + + + disciplinas << extrai_campos_disciplina(d) +
    278. +
      + +
      +
    279. + + + + + + +
    280. +
      + +
      +
    281. + + + + + + end +
    282. +
      + +
      +
    283. + + + + + + +
    284. +
      + +
      +
    285. + 1 + + + + + disciplinas +
    286. +
      + +
      +
    287. + + + + + + +
    288. +
      + +
      +
    289. + + + + + + end +
    290. +
      + +
      +
    291. + + + + + + +
    292. +
      + +
      +
    293. + + + + + + ## +
    294. +
      + +
      +
    295. + + + + + + # Método que realiza as extrações dos dados da disciplina. +
    296. +
      + +
      +
    297. + + + + + + # Retorna um hash com as informações da disciplina. +
    298. +
      + +
      +
    299. + 1 + + + + + def extrai_campos_disciplina(node) +
    300. +
      + +
      +
    301. + + + + + + +
    302. +
      + +
      +
    303. + + + + + + link_disciplina = node.css('td')[1].css('a')[0][:href] +
    304. +
      + +
      +
    305. + + + + + + +
    306. +
      + +
      +
    307. + + + + + + info_disciplina = raspar_pagina_disciplina(caminho = link_disciplina) +
    308. +
      + +
      +
    309. + + + + + + +
    310. +
      + +
      +
    311. + + + + + + { +
    312. +
      + +
      +
    313. + + + + + + :cod_disciplina => node.css('td')[0].text, +
    314. +
      + +
      +
    315. + + + + + + :nome_disciplina => node.css('td')[1].text.titleize, +
    316. +
      + +
      +
    317. + + + + + + :creditos => info_disciplina[:creditos], +
    318. +
      + +
      +
    319. + + + + + + :turmas => info_disciplina[:turmas] +
    320. +
      + +
      +
    321. + + + + + + } +
    322. +
      + +
      +
    323. + + + + + + +
    324. +
      + +
      +
    325. + + + + + + end +
    326. +
      + +
      +
    327. + + + + + + +
    328. +
      + +
      +
    329. + + + + + + ## +
    330. +
      + +
      +
    331. + + + + + + # Método para fazer a requisição da página da oferta de uma disciplina específica. +
    332. +
      + +
      +
    333. + + + + + + # Retorna um hash com as informações de créditos e turmas das disciplinas. +
    334. +
      + +
      +
    335. + 1 + + + + + def raspar_pagina_disciplina(caminho, url_base = "https://matriculaweb.unb.br/graduacao/") +
    336. +
      + +
      +
    337. + + + + + + require 'open-uri' +
    338. +
      + +
      +
    339. + + + + + + require 'openssl' +
    340. +
      + +
      +
    341. + + + + + + require 'nokogiri' +
    342. +
      + +
      +
    343. + + + + + + +
    344. +
      + +
      +
    345. + + + + + + pagina = Nokogiri::HTML(open(url_base + caminho)) +
    346. +
      + +
      +
    347. + + + + + + tabelas = pagina.css('#datatable') +
    348. +
      + +
      +
    349. + + + + + + +
    350. +
      + +
      +
    351. + + + + + + c_teor, c_prat, c_ext, c_est = tabelas[0] +
    352. +
      + +
      +
    353. + + + + + + .css('tr:nth-child(4) > td') +
    354. +
      + +
      +
    355. + + + + + + .text.split('-').map {|str| str.to_i} +
    356. +
      + +
      +
    357. + + + + + + +
    358. +
      + +
      +
    359. + + + + + + { +
    360. +
      + +
      +
    361. + + + + + + :creditos => { +
    362. +
      + +
      +
    363. + + + + + + :c_prat => c_prat, +
    364. +
      + +
      +
    365. + + + + + + :c_teor => c_teor, +
    366. +
      + +
      +
    367. + + + + + + :c_est => c_est, +
    368. +
      + +
      +
    369. + + + + + + :c_ext => c_ext +
    370. +
      + +
      +
    371. + + + + + + }, +
    372. +
      + +
      +
    373. + + + + + + :turmas => extrai_turmas(tabelas) +
    374. +
      + +
      +
    375. + + + + + + } +
    376. +
      + +
      +
    377. + + + + + + +
    378. +
      + +
      +
    379. + + + + + + end +
    380. +
      + +
      +
    381. + + + + + + +
    382. +
      + +
      +
    383. + + + + + + ## +
    384. +
      + +
      +
    385. + + + + + + # Método para raspagem das turmas da disciplina. +
    386. +
      + +
      +
    387. + + + + + + # Retorna uma lista de hashes das turmas. +
    388. +
      + +
      +
    389. + 1 + + + + + def extrai_turmas(node) +
    390. +
      + +
      +
    391. + + + + + + turmas = [] +
    392. +
      + +
      +
    393. + + + + + + node.drop(1).each do |t| +
    394. +
      + +
      +
    395. + + + + + + turmas << extrai_campos_turma(t) +
    396. +
      + +
      +
    397. + + + + + + end +
    398. +
      + +
      +
    399. + + + + + + turmas +
    400. +
      + +
      +
    401. + + + + + + end +
    402. +
      + +
      +
    403. + + + + + + +
    404. +
      + +
      +
    405. + + + + + + ## +
    406. +
      + +
      +
    407. + + + + + + # Método para extração das informações da turma da página da oferta da +
    408. +
      + +
      +
    409. + + + + + + # disciplina no MatrículoWeb. +
    410. +
      + +
      +
    411. + + + + + + # Retorna um hash com nome da turma e nome do professor. +
    412. +
      + +
      +
    413. + 1 + + + + + def extrai_campos_turma(node) +
    414. +
      + +
      +
    415. + + + + + + { +
    416. +
      + +
      +
    417. + + + + + + :nome_turma => node.css('td.turma').text, +
    418. +
      + +
      +
    419. + + + + + + :nome_professor => node.css('tbody > tr > td:nth-child(5) td').text +
    420. +
      + +
      +
    421. + + + + + + } +
    422. +
      + +
      +
    423. + + + + + + end +
    424. +
      + +
      +
    425. + + + + + + +
    426. +
      + +
      +
    427. + + + + + + ## +
    428. +
      + +
      +
    429. + + + + + + # Método para carregar as disciplinas no modelo. +
    430. +
      + +
      +
    431. + 1 + + + + + def carregar_disciplinas(disciplinas) +
    432. +
      + +
      +
    433. + 1 + + + + + disciplinas.each do |d| +
    434. +
      + +
      +
    435. + + + + + + +
    436. +
      + +
      +
    437. + + + + + + if !Disciplina.find_by_id_disciplina(d[:id]) +
    438. +
      + +
      +
    439. + + + + + + +
    440. +
      + +
      +
    441. + + + + + + criar_disciplina( +
    442. +
      + +
      +
    443. + + + + + + d[:id], +
    444. +
      + +
      +
    445. + + + + + + d[:nome_disciplina], +
    446. +
      + +
      +
    447. + + + + + + d[:creditos] +
    448. +
      + +
      +
    449. + + + + + + ) +
    450. +
      + +
      +
    451. + + + + + + end +
    452. +
      + +
      +
    453. + + + + + + end +
    454. +
      + +
      +
    455. + + + + + + end +
    456. +
      + +
      +
    457. + + + + + + +
    458. +
      + +
      +
    459. + + + + + + ## +
    460. +
      + +
      +
    461. + + + + + + # Método para criar uma disciplina no modelo. +
    462. +
      + +
      +
    463. + 1 + + + + + def criar_disciplina(id_disciplina,cod_disciplina, nome, creditos) +
    464. +
      + +
      +
    465. + + + + + + Disciplina.create( +
    466. +
      + +
      +
    467. + + + + + + :id=> id_disciplina, +
    468. +
      + +
      +
    469. + + + + + + :cod_disciplina => cod_disciplina, +
    470. +
      + +
      +
    471. + + + + + + :nome => nome, +
    472. +
      + +
      +
    473. + + + + + + :c_prat => creditos[:c_prat], +
    474. +
      + +
      +
    475. + + + + + + :c_teor => creditos[:c_teor], +
    476. +
      + +
      +
    477. + + + + + + :c_est => creditos[:c_est], +
    478. +
      + +
      +
    479. + + + + + + :c_ext => creditos[:c_ext] +
    480. +
      + +
      +
    481. + + + + + + ) +
    482. +
      + +
      +
    483. + + + + + + end +
    484. +
      + +
      +
    485. + + + + + + +
    486. +
      + +
      +
    487. + + + + + + +
    488. +
      + +
      +
    489. + + + + + + # Faz um web scrape da página do CIC para adquirir os dados dos professores e cadastrá-los no BD +
    490. +
      + +
      +
    491. + 1 + + + + + def web_scraper +
    492. +
      + +
      +
    493. + + + + + + # Habilitam a abertura de webpages no código +
    494. +
      + +
      +
    495. + 1 + + + + + require 'open-uri' +
    496. +
      + +
      +
    497. + 1 + + + + + require 'openssl' +
    498. +
      + +
      +
    499. + + + + + + +
    500. +
      + +
      +
    501. + + + + + + # Cria um node a partir da página do CIC, filtrando pela 'div' em questão os elementos 'li'. Esse node contém todas +
    502. +
      + +
      +
    503. + + + + + + # as informações disponíveis de todos os professores +
    504. +
      + +
      +
    505. + 1 + + + + + teachers_list = Nokogiri::HTML(open('https://cic.unb.br/professores/', +
    506. +
      + +
      +
    507. + + + + + + :ssl_verify_mode => OpenSSL::SSL::VERIFY_NONE)). +
    508. +
      + +
      +
    509. + + + + + + css('div#main-content'). +
    510. +
      + +
      +
    511. + + + + + + css('li') +
    512. +
      + +
      +
    513. + + + + + + +
    514. +
      + +
      +
    515. + 1 + + + + + teachers_list.each do |t| +
    516. +
      + +
      +
    517. + 87 + + + + + email = t.css('span.p-email').text.reverse +
    518. +
      + +
      +
    519. + + + + + + +
    520. +
      + +
      +
    521. + + + + + + # Verifica se o e-mail pertence ao domínio da UnB e se o e-mail já está cadastrado no banco de dados +
    522. +
      + +
      +
    523. + 87 + + + + + if valid_email?(email) && !Professor.find_by_email(email) +
    524. +
      + +
      +
    525. + 50 + + + + + create_teacher(t, email) +
    526. +
      + +
      +
    527. + + + + + + end +
    528. +
      + +
      +
    529. + + + + + + end +
    530. +
      + +
      +
    531. + + + + + + end +
    532. +
      + +
      +
    533. + + + + + + +
    534. +
      + +
      +
    535. + + + + + + # Verifica se o e-mail pertence ao domínio da UnB (retorna 'true' se sim e 'false', caso contrário) +
    536. +
      + +
      +
    537. + 1 + + + + + def valid_email?(email) +
    538. +
      + +
      +
    539. + 87 + + + + + email =~ /\A[\w+\-.]+@unb\.br\z/i +
    540. +
      + +
      +
    541. + + + + + + end +
    542. +
      + +
      +
    543. + + + + + + +
    544. +
      + +
      +
    545. + + + + + + # Cadastra um professor no banco de dados +
    546. +
      + +
      +
    547. + 1 + + + + + def create_teacher(teacher, email) +
    548. +
      + +
      +
    549. + 50 + + + + + pwd = generate_password +
    550. +
      + +
      +
    551. + 50 + + + + + Professor.create(:name => teacher.css('h4.people-details-h4').text.match(/(\S+\.?\s?)+/), +
    552. +
      + +
      +
    553. + + + + + + :email => email, +
    554. +
      + +
      +
    555. + + + + + + :username => email.match(/[^@]+/), +
    556. +
      + +
      +
    557. + + + + + + :role => match_role(teacher.css('span.people-details.p-people').text), +
    558. +
      + +
      +
    559. + + + + + + :password => pwd, +
    560. +
      + +
      +
    561. + + + + + + :password_confirmation => pwd) +
    562. +
      + +
      +
    563. + + + + + + end +
    564. +
      + +
      +
    565. + + + + + + +
    566. +
      + +
      +
    567. + + + + + + # Gera uma string de caracteres aleatórios de tamanho adequado para salvar como senha do professor no BD. +
    568. +
      + +
      +
    569. + + + + + + # Essa senha é apenas um placeholder, durante o cadastro, o professor deverá modifica-la. +
    570. +
      + +
      +
    571. + 1 + + + + + def generate_password +
    572. +
      + +
      +
    573. + 50 + + + + + require 'securerandom' +
    574. +
      + +
      +
    575. + 50 + + + + + SecureRandom.base64(9) +
    576. +
      + +
      +
    577. + + + + + + end +
    578. +
      + +
      +
    579. + + + + + + +
    580. +
      + +
      +
    581. + + + + + + # Faz o match da titularidade do professor com o número esperado no BD +
    582. +
      + +
      +
    583. + 1 + + + + + def match_role(role) +
    584. +
      + +
      +
    585. + 50 + + + + + case role +
    586. +
      + +
      +
    587. + + + + + + when /substituto/i +
    588. +
      + +
      +
    589. + + + + + + 1 +
    590. +
      + +
      +
    591. + + + + + + when /colaborador/i +
    592. +
      + +
      +
    593. + 2 + + + + + 3 +
    594. +
      + +
      +
    595. + + + + + + when /adjunto/i +
    596. +
      + +
      +
    597. + 34 + + + + + 4 +
    598. +
      + +
      +
    599. + + + + + + when /associado/i +
    600. +
      + +
      +
    601. + 9 + + + + + 5 +
    602. +
      + +
      +
    603. + + + + + + when /titular/i +
    604. +
      + +
      +
    605. + 4 + + + + + 6 +
    606. +
      + +
      +
    607. + + + + + + # Cláusula específica para um erro comum do parser: retornar uma string contendo apenas caracteres de espaço +
    608. +
      + +
      +
    609. + + + + + + when /\A\s/ +
    610. +
      + +
      +
    611. + + + + + + 0 +
    612. +
      + +
      +
    613. + + + + + + # Cláusula padrão retorna um valor para cadastrar o professor com o papel de 'professor' no BD +
    614. +
      + +
      +
    615. + + + + + + else +
    616. +
      + +
      +
    617. + 1 + + + + + 2 +
    618. +
      + +
      +
    619. + + + + + + end +
    620. +
      + +
      +
    621. + + + + + + end +
    622. +
      + +
      +
    623. + + + + + + +
    624. +
      + +
      +
    625. + + + + + + end +
    626. +
      + +
    +
    +
    + + +
    +
    +

    app/controllers/disciplinas_controller.rb

    +

    + + 53.85% + + + lines covered +

    + + + +
    + 39 relevant lines. + 21 lines covered and + 18 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + class DisciplinasController < ApplicationController +
    2. +
      + +
      +
    3. + 1 + + + + + before_action :find_disciplina, only: [:show, :edit, :update, :destroy] +
    4. +
      + +
      +
    5. + 1 + + + + + before_action :is_admin, only: [:edit, :new, :create, :update, :destroy] +
    6. +
      + +
      +
    7. + 1 + + + + + before_action :logged_in +
    8. +
      + +
      +
    9. + + + + + + +
    10. +
      + +
      +
    11. + 1 + + + + + def new +
    12. +
      + +
      +
    13. + 2 + + + + + @disciplina = Disciplina.new +
    14. +
      + +
      +
    15. + + + + + + end +
    16. +
      + +
      +
    17. + + + + + + +
    18. +
      + +
      +
    19. + 1 + + + + + def create +
    20. +
      + +
      +
    21. + 1 + + + + + @disciplina = Disciplina.new disciplina_params +
    22. +
      + +
      +
    23. + + + + + + +
    24. +
      + +
      +
    25. + 1 + + + + + if @disciplina.save +
    26. +
      + +
      +
    27. + + + + + + redirect_to dashboard_disciplinas_path, notice: "Disciplina cadastrada com sucesso!" +
    28. +
      + +
      +
    29. + + + + + + else +
    30. +
      + +
      +
    31. + 1 + + + + + flash[:danger] = "Ocorreu um erro ao cadastrar a disciplina. Nenhuma disciplina cadastrada." +
    32. +
      + +
      +
    33. + 1 + + + + + render 'new' +
    34. +
      + +
      +
    35. + + + + + + end +
    36. +
      + +
      +
    37. + + + + + + end +
    38. +
      + +
      +
    39. + + + + + + +
    40. +
      + +
      +
    41. + 1 + + + + + def edit; end +
    42. +
      + +
      +
    43. + + + + + + +
    44. +
      + +
      +
    45. + 1 + + + + + def update +
    46. +
      + +
      +
    47. + + + + + + if @disciplina.update disciplina_params +
    48. +
      + +
      +
    49. + + + + + + redirect_to dashboard_disciplinas_path, notice: "Disciplina atualizada!" +
    50. +
      + +
      +
    51. + + + + + + else +
    52. +
      + +
      +
    53. + + + + + + flash[:danger] = "Ocorreu um erro ao atualizar a disciplina." +
    54. +
      + +
      +
    55. + + + + + + render 'edit' +
    56. +
      + +
      +
    57. + + + + + + end +
    58. +
      + +
      +
    59. + + + + + + end +
    60. +
      + +
      +
    61. + + + + + + +
    62. +
      + +
      +
    63. + 1 + + + + + def destroy +
    64. +
      + +
      +
    65. + + + + + + Turma.find_each do |t| +
    66. +
      + +
      +
    67. + + + + + + if t.fk_cod_disciplina == @disciplina.cod_disciplina +
    68. +
      + +
      +
    69. + + + + + + t.destroy +
    70. +
      + +
      +
    71. + + + + + + end +
    72. +
      + +
      +
    73. + + + + + + end +
    74. +
      + +
      +
    75. + + + + + + Monitoria.find_each do |m| +
    76. +
      + +
      +
    77. + + + + + + if m.fk_cod_disciplina == @disciplina.cod_disciplina +
    78. +
      + +
      +
    79. + + + + + + m.destroy +
    80. +
      + +
      +
    81. + + + + + + end +
    82. +
      + +
      +
    83. + + + + + + end +
    84. +
      + +
      +
    85. + + + + + + @disciplina.destroy +
    86. +
      + +
      +
    87. + + + + + + redirect_to dashboard_disciplinas_path, notice: "Disciplina removida!" +
    88. +
      + +
      +
    89. + + + + + + end +
    90. +
      + +
      +
    91. + + + + + + +
    92. +
      + +
      +
    93. + 1 + + + + + private +
    94. +
      + +
      +
    95. + 1 + + + + + def disciplina_params +
    96. +
      + +
      +
    97. + 1 + + + + + params.require(:disciplina).permit(:nome, :fk_tipo_disciplina_id, :c_prat, :c_teor, :c_est, :c_ext, :monitoria) +
    98. +
      + +
      +
    99. + + + + + + end +
    100. +
      + +
      +
    101. + + + + + + +
    102. +
      + +
      +
    103. + 1 + + + + + def find_disciplina +
    104. +
      + +
      +
    105. + 4 + + + + + @disciplina = Disciplina.find(params[:id]) +
    106. +
      + +
      +
    107. + + + + + + end +
    108. +
      + +
      +
    109. + + + + + + +
    110. +
      + +
      +
    111. + 1 + + + + + def logged_in +
    112. +
      + +
      +
    113. + + + + + + if !logged_in? +
    114. +
      + +
      +
    115. + + + + + + redirect_to new_session_path, notice: "Você precisa estar logado para acessar as Disciplinas" +
    116. +
      + +
      +
    117. + + + + + + end +
    118. +
      + +
      +
    119. + + + + + + end +
    120. +
      + +
      +
    121. + + + + + + +
    122. +
      + +
      +
    123. + 1 + + + + + def is_admin +
    124. +
      + +
      +
    125. + + + + + + if !current_user.kind_of?(Admin) +
    126. +
      + +
      +
    127. + + + + + + flash[:danger] = "Acesso negado." +
    128. +
      + +
      +
    129. + + + + + + redirect_to dashboard_disciplinas_path +
    130. +
      + +
      +
    131. + + + + + + end +
    132. +
      + +
      +
    133. + + + + + + end +
    134. +
      + +
      +
    135. + + + + + + end +
    136. +
      + +
    +
    +
    + + +
    +
    +

    app/controllers/faq_controller.rb

    +

    + + 100.0% + + + lines covered +

    + + + +
    + 2 relevant lines. + 2 lines covered and + 0 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + class FaqController < ApplicationController +
    2. +
      + +
      +
    3. + 1 + + + + + def index ; end +
    4. +
      + +
      +
    5. + + + + + + end +
    6. +
      + +
    +
    +
    + + +
    +
    +

    app/controllers/historico_controller.rb

    +

    + + 0.0% + + + lines covered +

    + + + +
    + 2 relevant lines. + 0 lines covered and + 2 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + + + + + + class HistoricoController < ApplicationController +
    2. +
      + +
      +
    3. + + + + + + +
    4. +
      + +
      +
    5. + + + + + + end +
    6. +
      + +
    +
    +
    + + +
    +
    +

    app/controllers/home_controller.rb

    +

    + + 100.0% + + + lines covered +

    + + + +
    + 2 relevant lines. + 2 lines covered and + 0 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + class HomeController < ApplicationController +
    2. +
      + +
      +
    3. + 1 + + + + + def index ; end +
    4. +
      + +
      +
    5. + + + + + + end +
    6. +
      + +
    +
    +
    + + +
    +
    +

    app/controllers/monitorias_controller.rb

    +

    + + 89.19% + + + lines covered +

    + + + +
    + 37 relevant lines. + 33 lines covered and + 4 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + class MonitoriasController < ApplicationController +
    2. +
      + +
      +
    3. + 1 + + + + + before_action :find_monitor, only: [:show] +
    4. +
      + +
      +
    5. + 1 + + + + + before_action :find_monitoria, only: [:destroy, :edit, :update] +
    6. +
      + +
      +
    7. + 1 + + + + + before_action :logged_in +
    8. +
      + +
      +
    9. + + + + + + +
    10. +
      + +
      +
    11. + 1 + + + + + def new +
    12. +
      + +
      +
    13. + 1 + + + + + @cod_disciplina = params[:turma] +
    14. +
      + +
      +
    15. + 1 + + + + + @user = current_user +
    16. +
      + +
      +
    17. + + + + + + end +
    18. +
      + +
      +
    19. + + + + + + +
    20. +
      + +
      +
    21. + 1 + + + + + def create +
    22. +
      + +
      +
    23. + 4 + + + + + @monitoria = Monitoria.new(monitoria_params) +
    24. +
      + +
      +
    25. + 4 + + + + + valid = true +
    26. +
      + +
      +
    27. + 4 + + + + + Monitoria.find_each do |m| +
    28. +
      + +
      +
    29. + 4 + + + + + if m.fk_matricula==@monitoria.fk_matricula and m.fk_turmas_id==@monitoria.fk_turmas_id and m.fk_cod_disciplina==@monitoria.fk_cod_disciplina +
    30. +
      + +
      +
    31. + 4 + + + + + valid = false +
    32. +
      + +
      +
    33. + + + + + + end +
    34. +
      + +
      +
    35. + + + + + + end +
    36. +
      + +
      +
    37. + + + + + + +
    38. +
      + +
      +
    39. + 4 + + + + + if valid and @monitoria.save +
    40. +
      + +
      +
    41. + + + + + + redirect_to dashboard_monitorias_path, notice: "Aplicaçao para monitoria enviada com sucesso!" +
    42. +
      + +
      +
    43. + + + + + + else +
    44. +
      + +
      +
    45. + 4 + + + + + flash[:danger] = "Ocorreu um erro ao cadastrar a monitoria. Nenhuma monitoria cadastrada." +
    46. +
      + +
      +
    47. + 4 + + + + + redirect_to dashboard_monitorias_path +
    48. +
      + +
      +
    49. + + + + + + end +
    50. +
      + +
      +
    51. + + + + + + end +
    52. +
      + +
      +
    53. + + + + + + +
    54. +
      + +
      +
    55. + 1 + + + + + def show +
    56. +
      + +
      +
    57. + 1 + + + + + @alunos = User.find_each +
    58. +
      + +
      +
    59. + + + + + + end +
    60. +
      + +
      +
    61. + + + + + + +
    62. +
      + +
      +
    63. + 1 + + + + + def edit +
    64. +
      + +
      +
    65. + + + + + + end +
    66. +
      + +
      +
    67. + + + + + + +
    68. +
      + +
      +
    69. + 1 + + + + + def update +
    70. +
      + +
      +
    71. + 3 + + + + + if @monitoria.update monitoria_params +
    72. +
      + +
      +
    73. + 3 + + + + + redirect_to dashboard_monitorias_path, notice: "Situaçao atualizada!" +
    74. +
      + +
      +
    75. + + + + + + else +
    76. +
      + +
      +
    77. + + + + + + render 'edit' +
    78. +
      + +
      +
    79. + + + + + + end +
    80. +
      + +
      +
    81. + + + + + + end +
    82. +
      + +
      +
    83. + + + + + + +
    84. +
      + +
      +
    85. + 1 + + + + + def destroy +
    86. +
      + +
      +
    87. + 1 + + + + + @monitoria.destroy +
    88. +
      + +
      +
    89. + 1 + + + + + redirect_to dashboard_monitorias_path, notice: "Monitoria removida!" +
    90. +
      + +
      +
    91. + + + + + + end +
    92. +
      + +
      +
    93. + + + + + + +
    94. +
      + +
      +
    95. + 1 + + + + + private +
    96. +
      + +
      +
    97. + 1 + + + + + def monitoria_params +
    98. +
      + +
      +
    99. + 4 + + + + + params.require(:monitoria).permit(:remuneracao, :fk_matricula, :fk_cod_disciplina, :fk_turmas_id, :descricao_status, :prioridade, :fk_status_monitoria_id) +
    100. +
      + +
      +
    101. + + + + + + end +
    102. +
      + +
      +
    103. + + + + + + +
    104. +
      + +
      +
    105. + 1 + + + + + def find_monitor +
    106. +
      + +
      +
    107. + 1 + + + + + @monitoria = Monitoria.where(fk_turmas_id: params[:id]) +
    108. +
      + +
      +
    109. + + + + + + end +
    110. +
      + +
      +
    111. + + + + + + +
    112. +
      + +
      +
    113. + 1 + + + + + def find_monitoria +
    114. +
      + +
      +
    115. + 5 + + + + + @monitoria = Monitoria.find(params[:id]) +
    116. +
      + +
      +
    117. + + + + + + end +
    118. +
      + +
      +
    119. + + + + + + +
    120. +
      + +
      +
    121. + 1 + + + + + def logged_in +
    122. +
      + +
      +
    123. + + + + + + if !logged_in? +
    124. +
      + +
      +
    125. + + + + + + redirect_to new_session_path, notice: "Você precisa estar logado para acessar a pagina Monitoria" +
    126. +
      + +
      +
    127. + + + + + + end +
    128. +
      + +
      +
    129. + + + + + + end +
    130. +
      + +
      +
    131. + + + + + + end +
    132. +
      + +
    +
    +
    + + +
    +
    +

    app/controllers/motivos_controller.rb

    +

    + + 0.0% + + + lines covered +

    + + + +
    + 50 relevant lines. + 0 lines covered and + 50 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + + + + + + class MotivosController < ApplicationController +
    2. +
      + +
      +
    3. + + + + + + before_action :set_motivo, only: [:show, :edit, :update, :destroy] +
    4. +
      + +
      +
    5. + + + + + + +
    6. +
      + +
      +
    7. + + + + + + # GET /motivos +
    8. +
      + +
      +
    9. + + + + + + # GET /motivos.json +
    10. +
      + +
      +
    11. + + + + + + def index +
    12. +
      + +
      +
    13. + + + + + + @motivos = Motivo.all +
    14. +
      + +
      +
    15. + + + + + + end +
    16. +
      + +
      +
    17. + + + + + + +
    18. +
      + +
      +
    19. + + + + + + # GET /motivos/1 +
    20. +
      + +
      +
    21. + + + + + + # GET /motivos/1.json +
    22. +
      + +
      +
    23. + + + + + + def show +
    24. +
      + +
      +
    25. + + + + + + end +
    26. +
      + +
      +
    27. + + + + + + +
    28. +
      + +
      +
    29. + + + + + + # GET /motivos/new +
    30. +
      + +
      +
    31. + + + + + + def new +
    32. +
      + +
      +
    33. + + + + + + @motivo = Motivo.new +
    34. +
      + +
      +
    35. + + + + + + end +
    36. +
      + +
      +
    37. + + + + + + +
    38. +
      + +
      +
    39. + + + + + + # GET /motivos/1/edit +
    40. +
      + +
      +
    41. + + + + + + def edit +
    42. +
      + +
      +
    43. + + + + + + end +
    44. +
      + +
      +
    45. + + + + + + +
    46. +
      + +
      +
    47. + + + + + + # POST /motivos +
    48. +
      + +
      +
    49. + + + + + + # POST /motivos.json +
    50. +
      + +
      +
    51. + + + + + + def create +
    52. +
      + +
      +
    53. + + + + + + @motivo = Motivo.new(motivo_params) +
    54. +
      + +
      +
    55. + + + + + + +
    56. +
      + +
      +
    57. + + + + + + respond_to do |format| +
    58. +
      + +
      +
    59. + + + + + + if @motivo.save +
    60. +
      + +
      +
    61. + + + + + + format.html { redirect_to @motivo, notice: 'Motivo was successfully created.' } +
    62. +
      + +
      +
    63. + + + + + + format.json { render :show, status: :created, location: @motivo } +
    64. +
      + +
      +
    65. + + + + + + else +
    66. +
      + +
      +
    67. + + + + + + format.html { render :new } +
    68. +
      + +
      +
    69. + + + + + + format.json { render json: @motivo.errors, status: :unprocessable_entity } +
    70. +
      + +
      +
    71. + + + + + + end +
    72. +
      + +
      +
    73. + + + + + + end +
    74. +
      + +
      +
    75. + + + + + + end +
    76. +
      + +
      +
    77. + + + + + + +
    78. +
      + +
      +
    79. + + + + + + # PATCH/PUT /motivos/1 +
    80. +
      + +
      +
    81. + + + + + + # PATCH/PUT /motivos/1.json +
    82. +
      + +
      +
    83. + + + + + + def update +
    84. +
      + +
      +
    85. + + + + + + respond_to do |format| +
    86. +
      + +
      +
    87. + + + + + + if @motivo.update(motivo_params) +
    88. +
      + +
      +
    89. + + + + + + format.html { redirect_to @motivo, notice: 'Motivo was successfully updated.' } +
    90. +
      + +
      +
    91. + + + + + + format.json { render :show, status: :ok, location: @motivo } +
    92. +
      + +
      +
    93. + + + + + + else +
    94. +
      + +
      +
    95. + + + + + + format.html { render :edit } +
    96. +
      + +
      +
    97. + + + + + + format.json { render json: @motivo.errors, status: :unprocessable_entity } +
    98. +
      + +
      +
    99. + + + + + + end +
    100. +
      + +
      +
    101. + + + + + + end +
    102. +
      + +
      +
    103. + + + + + + end +
    104. +
      + +
      +
    105. + + + + + + +
    106. +
      + +
      +
    107. + + + + + + # DELETE /motivos/1 +
    108. +
      + +
      +
    109. + + + + + + # DELETE /motivos/1.json +
    110. +
      + +
      +
    111. + + + + + + def destroy +
    112. +
      + +
      +
    113. + + + + + + @motivo.destroy +
    114. +
      + +
      +
    115. + + + + + + respond_to do |format| +
    116. +
      + +
      +
    117. + + + + + + format.html { redirect_to motivos_url, notice: 'Motivo was successfully destroyed.' } +
    118. +
      + +
      +
    119. + + + + + + format.json { head :no_content } +
    120. +
      + +
      +
    121. + + + + + + end +
    122. +
      + +
      +
    123. + + + + + + end +
    124. +
      + +
      +
    125. + + + + + + +
    126. +
      + +
      +
    127. + + + + + + private +
    128. +
      + +
      +
    129. + + + + + + # Use callbacks to share common setup or constraints between actions. +
    130. +
      + +
      +
    131. + + + + + + def set_motivo +
    132. +
      + +
      +
    133. + + + + + + @motivo = Motivo.find(params[:id]) +
    134. +
      + +
      +
    135. + + + + + + end +
    136. +
      + +
      +
    137. + + + + + + +
    138. +
      + +
      +
    139. + + + + + + # Never trust parameters from the scary internet, only allow the white list through. +
    140. +
      + +
      +
    141. + + + + + + def motivo_params +
    142. +
      + +
      +
    143. + + + + + + params.require(:motivo).permit(:nome) +
    144. +
      + +
      +
    145. + + + + + + end +
    146. +
      + +
      +
    147. + + + + + + end +
    148. +
      + +
    +
    +
    + + +
    +
    +

    app/controllers/professors_controller.rb

    +

    + + 100.0% + + + lines covered +

    + + + +
    + 25 relevant lines. + 25 lines covered and + 0 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + class ProfessorsController < ApplicationController +
    2. +
      + +
      +
    3. + + + + + + +
    4. +
      + +
      +
    5. + + + + + + # usando como pagina de selecao de professores (issue: select de professores) +
    6. +
      + +
      +
    7. + 1 + + + + + def index +
    8. +
      + +
      +
    9. + + + + + + # conteudo do select de professores +
    10. +
      + +
      +
    11. + 1 + + + + + @professor = Professor.all +
    12. +
      + +
      +
    13. + + + + + + end +
    14. +
      + +
      +
    15. + + + + + + +
    16. +
      + +
      +
    17. + 1 + + + + + def new ; end +
    18. +
      + +
      +
    19. + + + + + + +
    20. +
      + +
      +
    21. + 1 + + + + + def create +
    22. +
      + +
      +
    23. + 6 + + + + + @professor = Professor.create(professor_params) +
    24. +
      + +
      +
    25. + + + + + + +
    26. +
      + +
      +
    27. + 6 + + + + + if !@professor.errors.any? +
    28. +
      + +
      +
    29. + 4 + + + + + flash[:notice] = "Registro realizado com sucesso!" +
    30. +
      + +
      +
    31. + 4 + + + + + log_in(@professor) +
    32. +
      + +
      +
    33. + 4 + + + + + redirect_to dashboard_path +
    34. +
      + +
      +
    35. + + + + + + else +
    36. +
      + +
      +
    37. + 2 + + + + + flash[:danger] = @professor.errors.full_messages +
    38. +
      + +
      +
    39. + 2 + + + + + redirect_to new_professor_path +
    40. +
      + +
      +
    41. + + + + + + end +
    42. +
      + +
      +
    43. + + + + + + end +
    44. +
      + +
      +
    45. + + + + + + # usando como pagina de confirmacao dos professores +
    46. +
      + +
      +
    47. + 1 + + + + + def identityconfirmation +
    48. +
      + +
      +
    49. + + + + + + # procura o professor selecionado na lista +
    50. +
      + +
      +
    51. + 2 + + + + + @professor = Professor.where(:name => params[:professor][:name])[0] +
    52. +
      + +
      +
    53. + + + + + + # faz o envio do e-mail de confirmação para o respectivo professor +
    54. +
      + +
      +
    55. + 2 + + + + + ProfessorMailer.with(professor: @professor).key_email.deliver_now +
    56. +
      + +
      +
    57. + + + + + + end +
    58. +
      + +
      +
    59. + + + + + + +
    60. +
      + +
      +
    61. + 1 + + + + + def update +
    62. +
      + +
      +
    63. + 6 + + + + + @professor = Professor.find_by_email(session[:user_id]) +
    64. +
      + +
      +
    65. + 6 + + + + + @professor.update_attributes(professor_params) +
    66. +
      + +
      +
    67. + + + + + + +
    68. +
      + +
      +
    69. + 6 + + + + + if !@professor.errors.any? +
    70. +
      + +
      +
    71. + 4 + + + + + flash[:notice] = "Cadastro atualizado com sucesso!" +
    72. +
      + +
      +
    73. + + + + + + elsif +
    74. +
      + +
      +
    75. + 2 + + + + + flash[:danger] = @professor.errors.full_messages +
    76. +
      + +
      +
    77. + + + + + + end +
    78. +
      + +
      +
    79. + + + + + + +
    80. +
      + +
      +
    81. + 6 + + + + + redirect_to dashboard_path +
    82. +
      + +
      +
    83. + + + + + + end +
    84. +
      + +
      +
    85. + + + + + + +
    86. +
      + +
      +
    87. + 1 + + + + + protected +
    88. +
      + +
      +
    89. + + + + + + +
    90. +
      + +
      +
    91. + 1 + + + + + def professor_params +
    92. +
      + +
      +
    93. + 9 + + + + + params.require(:professor).permit(:id, :name, :username, :email, :role, :password, :password_confirmation) +
    94. +
      + +
      +
    95. + + + + + + end +
    96. +
      + +
      +
    97. + + + + + + end +
    98. +
      + +
    +
    +
    + + +
    +
    +

    app/controllers/reset_senhas_controller.rb

    +

    + + 66.67% + + + lines covered +

    + + + +
    + 36 relevant lines. + 24 lines covered and + 12 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + class ResetSenhasController < ApplicationController +
    2. +
      + +
      +
    3. + 1 + + + + + before_action :get_user, only: [:edit, :update] +
    4. +
      + +
      +
    5. + 1 + + + + + before_action :valid_user, only: [:edit, :update] +
    6. +
      + +
      +
    7. + 1 + + + + + before_action :check_expiration, only: [:edit, :update] +
    8. +
      + +
      +
    9. + + + + + + +
    10. +
      + +
      +
    11. + 1 + + + + + def new +
    12. +
      + +
      +
    13. + + + + + + end +
    14. +
      + +
      +
    15. + + + + + + +
    16. +
      + +
      +
    17. + 1 + + + + + def create +
    18. +
      + +
      +
    19. + 3 + + + + + @user = User.find_by(email: params[:reset_senha][:email].downcase) +
    20. +
      + +
      +
    21. + 3 + + + + + if @user +
    22. +
      + +
      +
    23. + 1 + + + + + @user.create_reset_digest +
    24. +
      + +
      +
    25. + 1 + + + + + @user.send_password_reset_email +
    26. +
      + +
      +
    27. + 1 + + + + + flash[:notice] = "As instruções para resetar sua senha foram enviadas para seu e-mail." +
    28. +
      + +
      +
    29. + 1 + + + + + redirect_to root_url +
    30. +
      + +
      +
    31. + + + + + + else +
    32. +
      + +
      +
    33. + 2 + + + + + flash.now[:danger] = "Seu e-mail não foi encontrado." +
    34. +
      + +
      +
    35. + 2 + + + + + render 'new' +
    36. +
      + +
      +
    37. + + + + + + end +
    38. +
      + +
      +
    39. + + + + + + end +
    40. +
      + +
      +
    41. + + + + + + +
    42. +
      + +
      +
    43. + 1 + + + + + def edit +
    44. +
      + +
      +
    45. + + + + + + end +
    46. +
      + +
      +
    47. + + + + + + +
    48. +
      + +
      +
    49. + 1 + + + + + def update +
    50. +
      + +
      +
    51. + + + + + + if params[:user][:password].empty? +
    52. +
      + +
      +
    53. + + + + + + @user.errors.add(:password, "O campo senha deve ser preenchido.") +
    54. +
      + +
      +
    55. + + + + + + render 'edit' +
    56. +
      + +
      +
    57. + + + + + + elsif @user.update_attributes(user_params) +
    58. +
      + +
      +
    59. + + + + + + log_in @user +
    60. +
      + +
      +
    61. + + + + + + flash[:success] = "Sua nova senha foi salva." +
    62. +
      + +
      +
    63. + + + + + + redirect_to dashboard_path +
    64. +
      + +
      +
    65. + + + + + + else +
    66. +
      + +
      +
    67. + + + + + + render 'edit' +
    68. +
      + +
      +
    69. + + + + + + end +
    70. +
      + +
      +
    71. + + + + + + end +
    72. +
      + +
      +
    73. + + + + + + +
    74. +
      + +
      +
    75. + 1 + + + + + private +
    76. +
      + +
      +
    77. + + + + + + +
    78. +
      + +
      +
    79. + + + + + + # Instancia o usuário em questão procurando por seu e-mail +
    80. +
      + +
      +
    81. + 1 + + + + + def get_user +
    82. +
      + +
      +
    83. + 5 + + + + + @user = User.find_by(email: params[:email]) +
    84. +
      + +
      +
    85. + + + + + + end +
    86. +
      + +
      +
    87. + + + + + + +
    88. +
      + +
      +
    89. + + + + + + # Confirma se o usuário instanciado acima é válido verificando o token que foi passado +
    90. +
      + +
      +
    91. + 1 + + + + + def valid_user +
    92. +
      + +
      +
    93. + 4 + + + + + unless @user && @user.authenticated?(:reset, params[:id]) +
    94. +
      + +
      +
    95. + 4 + + + + + redirect_to root_url +
    96. +
      + +
      +
    97. + + + + + + end +
    98. +
      + +
      +
    99. + + + + + + end +
    100. +
      + +
      +
    101. + + + + + + +
    102. +
      + +
      +
    103. + + + + + + # Verifica se o token em questão expirou +
    104. +
      + +
      +
    105. + 1 + + + + + def check_expiration +
    106. +
      + +
      +
    107. + + + + + + if @user.password_reset_expired? +
    108. +
      + +
      +
    109. + + + + + + flash[:danger] = "Password reset has expired." +
    110. +
      + +
      +
    111. + + + + + + redirect_to new_reset_senha_url +
    112. +
      + +
      +
    113. + + + + + + end +
    114. +
      + +
      +
    115. + + + + + + end +
    116. +
      + +
      +
    117. + + + + + + +
    118. +
      + +
      +
    119. + + + + + + # Filtra os parâmetros que serão passados para o BD +
    120. +
      + +
      +
    121. + 1 + + + + + def user_params +
    122. +
      + +
      +
    123. + + + + + + params.require(:user).permit(:password, :password_confirmation) +
    124. +
      + +
      +
    125. + + + + + + end +
    126. +
      + +
      +
    127. + + + + + + end +
    128. +
      + +
    +
    +
    + + +
    +
    +

    app/controllers/sessions_controller.rb

    +

    + + 71.43% + + + lines covered +

    + + + +
    + 14 relevant lines. + 10 lines covered and + 4 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + class SessionsController < ApplicationController +
    2. +
      + +
      +
    3. + 1 + + + + + def new ; end +
    4. +
      + +
      +
    5. + + + + + + +
    6. +
      + +
      +
    7. + 1 + + + + + def create +
    8. +
      + +
      +
    9. + + + + + + ## Busca aluno e professor. Retorna apenas um que for encontrado. +
    10. +
      + +
      +
    11. + 3 + + + + + @login ||= User.find_by_email(login_params[:email]) || +
    12. +
      + +
      +
    13. + + + + + + Professor.find_by_email(login_params[:email]) || +
    14. +
      + +
      +
    15. + + + + + + Admin.find_by_email(login_params[:email]) +
    16. +
      + +
      +
    17. + + + + + + +
    18. +
      + +
      +
    19. + 3 + + + + + if @login&.authenticate(login_params[:password]) +
    20. +
      + +
      +
    21. + 3 + + + + + log_in(@login) +
    22. +
      + +
      +
    23. + 3 + + + + + redirect_to dashboard_path +
    24. +
      + +
      +
    25. + + + + + + else +
    26. +
      + +
      +
    27. + + + + + + flash[:danger] = "Email ou senha inválidos" +
    28. +
      + +
      +
    29. + + + + + + redirect_to new_session_path +
    30. +
      + +
      +
    31. + + + + + + end +
    32. +
      + +
      +
    33. + + + + + + end +
    34. +
      + +
      +
    35. + + + + + + +
    36. +
      + +
      +
    37. + 1 + + + + + def destroy +
    38. +
      + +
      +
    39. + + + + + + session[:user_id] = nil +
    40. +
      + +
      +
    41. + + + + + + redirect_to root_url +
    42. +
      + +
      +
    43. + + + + + + end +
    44. +
      + +
      +
    45. + + + + + + +
    46. +
      + +
      +
    47. + + + + + + ## Define os parâmetros que serão lidos no formulário de login +
    48. +
      + +
      +
    49. + 1 + + + + + def login_params +
    50. +
      + +
      +
    51. + 6 + + + + + params.require(:user).permit(:email, :password) +
    52. +
      + +
      +
    53. + + + + + + end +
    54. +
      + +
      +
    55. + + + + + + end +
    56. +
      + +
    +
    +
    + + +
    +
    +

    app/controllers/sobre_controller.rb

    +

    + + 100.0% + + + lines covered +

    + + + +
    + 2 relevant lines. + 2 lines covered and + 0 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + class SobreController < ApplicationController +
    2. +
      + +
      +
    3. + 1 + + + + + def index ; end +
    4. +
      + +
      +
    5. + + + + + + end +
    6. +
      + +
    +
    +
    + + +
    +
    +

    app/controllers/tarefas_controller.rb

    +

    + + 93.94% + + + lines covered +

    + + + +
    + 33 relevant lines. + 31 lines covered and + 2 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + class TarefasController < ApplicationController +
    2. +
      + +
      +
    3. + 1 + + + + + before_action :set_tarefa, only: [:show, :edit, :update, :destroy] +
    4. +
      + +
      +
    5. + + + + + + +
    6. +
      + +
      +
    7. + + + + + + # GET /tarefas +
    8. +
      + +
      +
    9. + + + + + + # GET /tarefas.json +
    10. +
      + +
      +
    11. + 1 + + + + + def index +
    12. +
      + +
      +
    13. + 1 + + + + + @tarefas = [] +
    14. +
      + +
      +
    15. + 1 + + + + + @monitoria_id = params[:monitoria_id].to_i +
    16. +
      + +
      +
    17. + 1 + + + + + @all_tarefas = Tarefa.all +
    18. +
      + +
      +
    19. + 1 + + + + + @all_tarefas.each do |tarefa| +
    20. +
      + +
      +
    21. + + + + + + if tarefa.monitoria_id == @monitoria_id +
    22. +
      + +
      +
    23. + + + + + + @tarefas.push(tarefa) +
    24. +
      + +
      +
    25. + + + + + + end +
    26. +
      + +
      +
    27. + + + + + + end +
    28. +
      + +
      +
    29. + + + + + + end +
    30. +
      + +
      +
    31. + + + + + + +
    32. +
      + +
      +
    33. + + + + + + # GET /tarefas/1 +
    34. +
      + +
      +
    35. + + + + + + # GET /tarefas/1.json +
    36. +
      + +
      +
    37. + 1 + + + + + def show +
    38. +
      + +
      +
    39. + + + + + + +
    40. +
      + +
      +
    41. + + + + + + end +
    42. +
      + +
      +
    43. + + + + + + +
    44. +
      + +
      +
    45. + + + + + + # GET /tarefas/new +
    46. +
      + +
      +
    47. + 1 + + + + + def new +
    48. +
      + +
      +
    49. + 1 + + + + + @monitoria_id = params[:monitoria_id] +
    50. +
      + +
      +
    51. + 1 + + + + + @tarefa = Tarefa.new(:monitoria_id => @monitoria_id) +
    52. +
      + +
      +
    53. + + + + + + end +
    54. +
      + +
      +
    55. + + + + + + +
    56. +
      + +
      +
    57. + + + + + + # GET /tarefas/1/edit +
    58. +
      + +
      +
    59. + 1 + + + + + def edit +
    60. +
      + +
      +
    61. + + + + + + end +
    62. +
      + +
      +
    63. + + + + + + +
    64. +
      + +
      +
    65. + + + + + + # POST /tarefas +
    66. +
      + +
      +
    67. + + + + + + # POST /tarefas.json +
    68. +
      + +
      +
    69. + 1 + + + + + def create +
    70. +
      + +
      +
    71. + 3 + + + + + @tarefa = Tarefa.new(tarefa_params) +
    72. +
      + +
      +
    73. + 3 + + + + + if @tarefa.save +
    74. +
      + +
      +
    75. + 1 + + + + + redirect_to dashboard_monitorias_path, notice: "Tarefa atribuida com sucesso!" +
    76. +
      + +
      +
    77. + + + + + + else +
    78. +
      + +
      +
    79. + 1 + + + + + flash[:danger] = "Ocorreu um erro ao atribuir a tarefa." +
    80. +
      + +
      +
    81. + 1 + + + + + redirect_to dashboard_monitorias_path +
    82. +
      + +
      +
    83. + + + + + + end +
    84. +
      + +
      +
    85. + + + + + + +
    86. +
      + +
      +
    87. + + + + + + +
    88. +
      + +
      +
    89. + + + + + + end +
    90. +
      + +
      +
    91. + + + + + + +
    92. +
      + +
      +
    93. + + + + + + # PATCH/PUT /tarefas/1 +
    94. +
      + +
      +
    95. + + + + + + # PATCH/PUT /tarefas/1.json +
    96. +
      + +
      +
    97. + 1 + + + + + def update +
    98. +
      + +
      +
    99. + 4 + + + + + if @tarefa.update(tarefa_params) +
    100. +
      + +
      +
    101. + 3 + + + + + redirect_to dashboard_monitorias_path, notice: "Tarefa atualizada!" +
    102. +
      + +
      +
    103. + + + + + + else +
    104. +
      + +
      +
    105. + 1 + + + + + flash[:danger] = "Ocorreu um erro ao atualizar a tarefa." +
    106. +
      + +
      +
    107. + 1 + + + + + redirect_to dashboard_monitorias_path +
    108. +
      + +
      +
    109. + + + + + + end +
    110. +
      + +
      +
    111. + + + + + + end +
    112. +
      + +
      +
    113. + + + + + + +
    114. +
      + +
      +
    115. + + + + + + # DELETE /tarefas/1 +
    116. +
      + +
      +
    117. + + + + + + # DELETE /tarefas/1.json +
    118. +
      + +
      +
    119. + 1 + + + + + def destroy +
    120. +
      + +
      +
    121. + 1 + + + + + @tarefa.destroy +
    122. +
      + +
      +
    123. + 1 + + + + + redirect_to dashboard_monitorias_path, notice: "Tarefa removida!" +
    124. +
      + +
      +
    125. + + + + + + end +
    126. +
      + +
      +
    127. + + + + + + +
    128. +
      + +
      +
    129. + 1 + + + + + private +
    130. +
      + +
      +
    131. + + + + + + # Use callbacks to share common setup or constraints between actions. +
    132. +
      + +
      +
    133. + 1 + + + + + def set_tarefa +
    134. +
      + +
      +
    135. + 7 + + + + + @tarefa = Tarefa.find(params[:id]) +
    136. +
      + +
      +
    137. + + + + + + end +
    138. +
      + +
      +
    139. + + + + + + +
    140. +
      + +
      +
    141. + + + + + + # Never trust parameters from the scary internet, only allow the white list through. +
    142. +
      + +
      +
    143. + 1 + + + + + def tarefa_params +
    144. +
      + +
      +
    145. + 5 + + + + + params.require(:tarefa).permit(:titulo, :descricao, :nota, :feito, :inicio, :fim, :monitoria_id) +
    146. +
      + +
      +
    147. + + + + + + end +
    148. +
      + +
      +
    149. + + + + + + end +
    150. +
      + +
    +
    +
    + + +
    +
    +

    app/controllers/turmas_controller.rb

    +

    + + 86.49% + + + lines covered +

    + + + +
    + 37 relevant lines. + 32 lines covered and + 5 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + class TurmasController < ApplicationController +
    2. +
      + +
      +
    3. + + + + + + # GET #new +
    4. +
      + +
      +
    5. + 1 + + + + + def new +
    6. +
      + +
      +
    7. + 1 + + + + + @user = current_user +
    8. +
      + +
      +
    9. + + + + + + end +
    10. +
      + +
      +
    11. + + + + + + +
    12. +
      + +
      +
    13. + 1 + + + + + def edit +
    14. +
      + +
      +
    15. + 1 + + + + + @turma = Turma.find(params[:id]) +
    16. +
      + +
      +
    17. + + + + + + end +
    18. +
      + +
      +
    19. + + + + + + +
    20. +
      + +
      +
    21. + 1 + + + + + def create +
    22. +
      + +
      +
    23. + 4 + + + + + @turma = Turma.create(turma_params) +
    24. +
      + +
      +
    25. + + + + + + +
    26. +
      + +
      +
    27. + 3 + + + + + if !@turma.errors.any? +
    28. +
      + +
      +
    29. + 3 + + + + + flash[:notice] = 'Turma cadastrada com sucesso!' +
    30. +
      + +
      +
    31. + + + + + + else +
    32. +
      + +
      +
    33. + + + + + + flash[:danger] = @turma.errors.full_messages +
    34. +
      + +
      +
    35. + + + + + + end +
    36. +
      + +
      +
    37. + + + + + + +
    38. +
      + +
      +
    39. + 3 + + + + + redirect_to dashboard_turmas_path +
    40. +
      + +
      +
    41. + + + + + + end +
    42. +
      + +
      +
    43. + + + + + + +
    44. +
      + +
      +
    45. + 1 + + + + + def update +
    46. +
      + +
      +
    47. + 5 + + + + + @turma = Turma.find(params[:id]) +
    48. +
      + +
      +
    49. + 5 + + + + + @turma.update_attributes(turma_params) +
    50. +
      + +
      +
    51. + + + + + + +
    52. +
      + +
      +
    53. + 4 + + + + + if !@turma.errors.any? +
    54. +
      + +
      +
    55. + 4 + + + + + flash[:notice] = 'Turma atualizada com sucesso!' +
    56. +
      + +
      +
    57. + + + + + + else +
    58. +
      + +
      +
    59. + + + + + + flash[:danger] = @turma.errors.full_messages +
    60. +
      + +
      +
    61. + + + + + + end +
    62. +
      + +
      +
    63. + + + + + + +
    64. +
      + +
      +
    65. + 4 + + + + + redirect_to dashboard_turmas_path +
    66. +
      + +
      +
    67. + + + + + + end +
    68. +
      + +
      +
    69. + + + + + + +
    70. +
      + +
      +
    71. + 1 + + + + + def destroy +
    72. +
      + +
      +
    73. + 1 + + + + + @turma = Turma.find(params[:id]) +
    74. +
      + +
      +
    75. + 1 + + + + + Monitoria.find_each do |m| +
    76. +
      + +
      +
    77. + + + + + + if m.fk_turmas_id == @turma.id +
    78. +
      + +
      +
    79. + + + + + + m.destroy +
    80. +
      + +
      +
    81. + + + + + + end +
    82. +
      + +
      +
    83. + + + + + + end +
    84. +
      + +
      +
    85. + 1 + + + + + @turma.destroy +
    86. +
      + +
      +
    87. + 1 + + + + + flash[:notice] = 'Turma apagada com sucesso!' +
    88. +
      + +
      +
    89. + 1 + + + + + redirect_to dashboard_turmas_path +
    90. +
      + +
      +
    91. + + + + + + end +
    92. +
      + +
      +
    93. + + + + + + +
    94. +
      + +
      +
    95. + 1 + + + + + private +
    96. +
      + +
      +
    97. + 1 + + + + + def turma_params +
    98. +
      + +
      +
    99. + 6 + + + + + params.require(:turma).permit(:id, :turma, :professor, :fk_cod_disciplina, :qnt_bolsas, :fk_vagas_id) +
    100. +
      + +
      +
    101. + + + + + + end +
    102. +
      + +
      +
    103. + + + + + + +
    104. +
      + +
      +
    105. + 1 + + + + + def find_turma +
    106. +
      + +
      +
    107. + + + + + + @turma = Turma.find(params[:id]) +
    108. +
      + +
      +
    109. + + + + + + end +
    110. +
      + +
      +
    111. + + + + + + +
    112. +
      + +
      +
    113. + 1 + + + + + def self.get_turmas(professor) +
    114. +
      + +
      +
    115. + 1 + + + + + @turmas = Array.new +
    116. +
      + +
      +
    117. + 1 + + + + + @turmas_buscadas = Turma.find_each do |turma| +
    118. +
      + +
      +
    119. + 3 + + + + + if turma.professor == professor.name +
    120. +
      + +
      +
    121. + 2 + + + + + @turmas << turma +
    122. +
      + +
      +
    123. + + + + + + end +
    124. +
      + +
      +
    125. + + + + + + end +
    126. +
      + +
      +
    127. + 1 + + + + + @turmas +
    128. +
      + +
      +
    129. + + + + + + end +
    130. +
      + +
      +
    131. + + + + + + end +
    132. +
      + +
    +
    +
    + + +
    +
    +

    app/controllers/users_controller.rb

    +

    + + 85.0% + + + lines covered +

    + + + +
    + 20 relevant lines. + 17 lines covered and + 3 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + class UsersController < ApplicationController +
    2. +
      + +
      +
    3. + + + + + + ## GET /users/new +
    4. +
      + +
      +
    5. + 1 + + + + + def new ; end +
    6. +
      + +
      +
    7. + + + + + + +
    8. +
      + +
      +
    9. + + + + + + ## POST /users/sign_up +
    10. +
      + +
      +
    11. + 1 + + + + + def create +
    12. +
      + +
      +
    13. + 6 + + + + + @user = User.create(user_params) +
    14. +
      + +
      +
    15. + + + + + + +
    16. +
      + +
      +
    17. + 6 + + + + + if !@user.errors.any? +
    18. +
      + +
      +
    19. + + + + + + log_in(@user) +
    20. +
      + +
      +
    21. + + + + + + flash[:notice] = "Registro realizado com sucesso!" +
    22. +
      + +
      +
    23. + + + + + + redirect_to dashboard_path +
    24. +
      + +
      +
    25. + + + + + + else +
    26. +
      + +
      +
    27. + 6 + + + + + flash[:danger] = @user.errors.full_messages +
    28. +
      + +
      +
    29. + 6 + + + + + redirect_to new_user_path +
    30. +
      + +
      +
    31. + + + + + + end +
    32. +
      + +
      +
    33. + + + + + + end +
    34. +
      + +
      +
    35. + + + + + + +
    36. +
      + +
      +
    37. + 1 + + + + + def update +
    38. +
      + +
      +
    39. + 6 + + + + + @user = User.find_by_email(session[:user_id]) +
    40. +
      + +
      +
    41. + 6 + + + + + @user.update_attributes(user_params) +
    42. +
      + +
      +
    43. + + + + + + +
    44. +
      + +
      +
    45. + 6 + + + + + if !@user.errors.any? +
    46. +
      + +
      +
    47. + 4 + + + + + flash[:notice] = "Cadastro atualizado com sucesso!" +
    48. +
      + +
      +
    49. + + + + + + elsif +
    50. +
      + +
      +
    51. + 2 + + + + + flash[:danger] = @user.errors.full_messages +
    52. +
      + +
      +
    53. + + + + + + end +
    54. +
      + +
      +
    55. + + + + + + +
    56. +
      + +
      +
    57. + 6 + + + + + redirect_to dashboard_path +
    58. +
      + +
      +
    59. + + + + + + end +
    60. +
      + +
      +
    61. + + + + + + +
    62. +
      + +
      +
    63. + 1 + + + + + private +
    64. +
      + +
      +
    65. + 1 + + + + + def user_params +
    66. +
      + +
      +
    67. + 12 + + + + + params.require(:user).permit(:id, :name, :matricula, :email, :cpf, :rg, :password, :password_confirmation) +
    68. +
      + +
      +
    69. + + + + + + end +
    70. +
      + +
      +
    71. + + + + + + end +
    72. +
      + +
    +
    +
    + + +
    +
    +

    app/helpers/application_helper.rb

    +

    + + 100.0% + + + lines covered +

    + + + +
    + 1 relevant lines. + 1 lines covered and + 0 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + module ApplicationHelper +
    2. +
      + +
      +
    3. + + + + + + end +
    4. +
      + +
    +
    +
    + + +
    +
    +

    app/helpers/atendimentos_helper.rb

    +

    + + 100.0% + + + lines covered +

    + + + +
    + 1 relevant lines. + 1 lines covered and + 0 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + module AtendimentosHelper +
    2. +
      + +
      +
    3. + + + + + + end +
    4. +
      + +
    +
    +
    + + +
    +
    +

    app/helpers/atividades_helper.rb

    +

    + + 100.0% + + + lines covered +

    + + + +
    + 1 relevant lines. + 1 lines covered and + 0 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + module AtividadesHelper +
    2. +
      + +
      +
    3. + + + + + + end +
    4. +
      + +
    +
    +
    + + +
    +
    +

    app/helpers/disciplinas_helper.rb

    +

    + + 100.0% + + + lines covered +

    + + + +
    + 1 relevant lines. + 1 lines covered and + 0 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + module DisciplinasHelper +
    2. +
      + +
      +
    3. + + + + + + end +
    4. +
      + +
    +
    +
    + + +
    +
    +

    app/helpers/historico_helper.rb

    +

    + + 100.0% + + + lines covered +

    + + + +
    + 1 relevant lines. + 1 lines covered and + 0 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + module HistoricoHelper +
    2. +
      + +
      +
    3. + + + + + + end +
    4. +
      + +
    +
    +
    + + +
    +
    +

    app/helpers/home_helper.rb

    +

    + + 100.0% + + + lines covered +

    + + + +
    + 1 relevant lines. + 1 lines covered and + 0 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + module HomeHelper +
    2. +
      + +
      +
    3. + + + + + + end +
    4. +
      + +
    +
    +
    + + +
    +
    +

    app/helpers/motivos_helper.rb

    +

    + + 100.0% + + + lines covered +

    + + + +
    + 1 relevant lines. + 1 lines covered and + 0 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + module MotivosHelper +
    2. +
      + +
      +
    3. + + + + + + end +
    4. +
      + +
    +
    +
    + + +
    +
    +

    app/helpers/reset_senhas_helper.rb

    +

    + + 100.0% + + + lines covered +

    + + + +
    + 1 relevant lines. + 1 lines covered and + 0 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + module ResetSenhasHelper +
    2. +
      + +
      +
    3. + + + + + + end +
    4. +
      + +
    +
    +
    + + +
    +
    +

    app/helpers/sessions_helper.rb

    +

    + + 90.0% + + + lines covered +

    + + + +
    + 10 relevant lines. + 9 lines covered and + 1 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + module SessionsHelper +
    2. +
      + +
      +
    3. + 1 + + + + + def log_in(user) +
    4. +
      + +
      +
    5. + 5 + + + + + session[:user_id] = user.email +
    6. +
      + +
      +
    7. + + + + + + end +
    8. +
      + +
      +
    9. + + + + + + +
    10. +
      + +
      +
    11. + 1 + + + + + def logged_user +
    12. +
      + +
      +
    13. + 3 + + + + + if !current_user.nil? +
    14. +
      + +
      +
    15. + + + + + + current_user +
    16. +
      + +
      +
    17. + + + + + + end +
    18. +
      + +
      +
    19. + + + + + + end +
    20. +
      + +
      +
    21. + + + + + + +
    22. +
      + +
      +
    23. + 1 + + + + + def current_user +
    24. +
      + +
      +
    25. + + + + + + ## Determina se o usuário logado é um aluno ou professor +
    26. +
      + +
      +
    27. + 12 + + + + + @current_user ||= User.find_by(email: session[:user_id]) || Professor.find_by(email: session[:user_id]) || Admin.find_by(email: session[:user_id]) +
    28. +
      + +
      +
    29. + + + + + + end +
    30. +
      + +
      +
    31. + + + + + + +
    32. +
      + +
      +
    33. + 1 + + + + + def logged_in? +
    34. +
      + +
      +
    35. + 3 + + + + + !logged_user.nil? +
    36. +
      + +
      +
    37. + + + + + + end +
    38. +
      + +
      +
    39. + + + + + + end +
    40. +
      + +
    +
    +
    + + +
    +
    +

    app/helpers/tarefas_helper.rb

    +

    + + 100.0% + + + lines covered +

    + + + +
    + 1 relevant lines. + 1 lines covered and + 0 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + module TarefasHelper +
    2. +
      + +
      +
    3. + + + + + + end +
    4. +
      + +
    +
    +
    + + +
    +
    +

    app/jobs/application_job.rb

    +

    + + 0.0% + + + lines covered +

    + + + +
    + 2 relevant lines. + 0 lines covered and + 2 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + + + + + + class ApplicationJob < ActiveJob::Base +
    2. +
      + +
      +
    3. + + + + + + end +
    4. +
      + +
    +
    +
    + + +
    +
    +

    app/mailers/application_mailer.rb

    +

    + + 100.0% + + + lines covered +

    + + + +
    + 3 relevant lines. + 3 lines covered and + 0 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + class ApplicationMailer < ActionMailer::Base +
    2. +
      + +
      +
    3. + 1 + + + + + default from: 'noreply@example.com' # TODO: mudar esse campo após definir o domínio utilizado pela plataforma +
    4. +
      + +
      +
    5. + 1 + + + + + layout 'mailer' +
    6. +
      + +
      +
    7. + + + + + + end +
    8. +
      + +
    +
    +
    + + +
    +
    +

    app/mailers/professor_mailer.rb

    +

    + + 100.0% + + + lines covered +

    + + + +
    + 6 relevant lines. + 6 lines covered and + 0 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + class ProfessorMailer < ApplicationMailer +
    2. +
      + +
      +
    3. + 1 + + + + + default from: 'notifications@example.com' +
    4. +
      + +
      +
    5. + + + + + + +
    6. +
      + +
      +
    7. + + + + + + # as configuracoes de envio de email de confirmacao para professores eh feita aqui +
    8. +
      + +
      +
    9. + 1 + + + + + def key_email +
    10. +
      + +
      +
    11. + 2 + + + + + @professor = params[:professor] +
    12. +
      + +
      +
    13. + 2 + + + + + @url = 'http://localhost:3000/sessions/new' +
    14. +
      + +
      +
    15. + 2 + + + + + mail(to: @professor.email, subject: 'Saudações querido(a) professor(a)!') +
    16. +
      + +
      +
    17. + + + + + + end +
    18. +
      + +
      +
    19. + + + + + + end +
    20. +
      + +
    +
    +
    + + +
    +
    +

    app/mailers/user_mailer.rb

    +

    + + 100.0% + + + lines covered +

    + + + +
    + 4 relevant lines. + 4 lines covered and + 0 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + class UserMailer < ApplicationMailer +
    2. +
      + +
      +
    3. + + + + + + +
    4. +
      + +
      +
    5. + + + + + + # Subject can be set in your I18n file at config/locales/en.yml +
    6. +
      + +
      +
    7. + + + + + + # with the following lookup: +
    8. +
      + +
      +
    9. + + + + + + # +
    10. +
      + +
      +
    11. + + + + + + # en.user_mailer.reset_senha.subject +
    12. +
      + +
      +
    13. + + + + + + # +
    14. +
      + +
      +
    15. + 1 + + + + + def reset_senha(user) +
    16. +
      + +
      +
    17. + 2 + + + + + @user = user +
    18. +
      + +
      +
    19. + 2 + + + + + mail to: user.email, subject: "Recuperação de senha" +
    20. +
      + +
      +
    21. + + + + + + end +
    22. +
      + +
      +
    23. + + + + + + end +
    24. +
      + +
    +
    +
    + + +
    +
    +

    app/models/admin.rb

    +

    + + 100.0% + + + lines covered +

    + + + +
    + 3 relevant lines. + 3 lines covered and + 0 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + class Admin < ActiveRecord::Base +
    2. +
      + +
      +
    3. + 1 + + + + + has_secure_password +
    4. +
      + +
      +
    5. + + + + + + +
    6. +
      + +
      +
    7. + 1 + + + + + self.primary_key = :id +
    8. +
      + +
      +
    9. + + + + + + end +
    10. +
      + +
    +
    +
    + + +
    +
    +

    app/models/application_record.rb

    +

    + + 100.0% + + + lines covered +

    + + + +
    + 2 relevant lines. + 2 lines covered and + 0 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + class ApplicationRecord < ActiveRecord::Base +
    2. +
      + +
      +
    3. + 1 + + + + + self.abstract_class = true +
    4. +
      + +
      +
    5. + + + + + + end +
    6. +
      + +
    +
    +
    + + +
    +
    +

    app/models/atendimento.rb

    +

    + + 100.0% + + + lines covered +

    + + + +
    + 5 relevant lines. + 5 lines covered and + 0 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + class Atendimento < ApplicationRecord +
    2. +
      + +
      +
    3. + + + + + + ## +
    4. +
      + +
      +
    5. + + + + + + # Cada atendimento está associado à um monitor +
    6. +
      + +
      +
    7. + 1 + + + + + belongs_to :motivo +
    8. +
      + +
      +
    9. + + + + + + +
    10. +
      + +
      +
    11. + + + + + + ## +
    12. +
      + +
      +
    13. + + + + + + # atendimento possui os campos obrigatórios monitor_id, motivo_id e dia +
    14. +
      + +
      +
    15. + 1 + + + + + validates_presence_of :monitor_id +
    16. +
      + +
      +
    17. + 1 + + + + + validates_presence_of :motivo_id +
    18. +
      + +
      +
    19. + 1 + + + + + validates_presence_of :dia +
    20. +
      + +
      +
    21. + + + + + + +
    22. +
      + +
      +
    23. + + + + + + end +
    24. +
      + +
    +
    +
    + + +
    +
    +

    app/models/atividade.rb

    +

    + + 100.0% + + + lines covered +

    + + + +
    + 5 relevant lines. + 5 lines covered and + 0 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + class Atividade < ApplicationRecord +
    2. +
      + +
      +
    3. + + + + + + +
    4. +
      + +
      +
    5. + + + + + + ## Verifica se o formulário foi preenchido de acordo com a especificação +
    6. +
      + +
      +
    7. + 1 + + + + + validates_presence_of :titulo, message: "Campo obrigatório 'Título' não preenchido! Registro não realizado." +
    8. +
      + +
      +
    9. + 1 + + + + + validates_presence_of :mensagem, message: "Campo obrigatório 'Descrição' não preenchido! Registro não realizado." +
    10. +
      + +
      +
    11. + 1 + + + + + validates_presence_of :data, message: "Campo obrigatório 'Data' não preenchido! Registro não realizado." +
    12. +
      + +
      +
    13. + 1 + + + + + validates_presence_of :matricula_monitor, message: "Campo obrigatório 'Matrícula' não preenchido! Registro não realizado." +
    14. +
      + +
      +
    15. + + + + + + end +
    16. +
      + +
    +
    +
    + + +
    +
    +

    app/models/dados_bancarios.rb

    +

    + + 100.0% + + + lines covered +

    + + + +
    + 8 relevant lines. + 8 lines covered and + 0 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + class DadosBancarios < ActiveRecord::Base +
    2. +
      + +
      +
    3. + 1 + + + + + self.primary_key = :id +
    4. +
      + +
      +
    5. + + + + + + +
    6. +
      + +
      +
    7. + 1 + + + + + validates_presence_of :codigo +
    8. +
      + +
      +
    9. + 1 + + + + + validates_presence_of :agencia +
    10. +
      + +
      +
    11. + 1 + + + + + validates_presence_of :conta_corrente +
    12. +
      + +
      +
    13. + + + + + + +
    14. +
      + +
      +
    15. + 1 + + + + + validates :codigo, length: { in: 6..25 }, format: { +
    16. +
      + +
      +
    17. + + + + + + without: /[\d]+|['"!¹@²#³$£%¢¨¬&\*\(\)\-_\+=§`´\[\]{}\^~ªº°\?\/:;>.<,\|\\]+/, +
    18. +
      + +
      +
    19. + + + + + + message: 'only letters and spaces' +
    20. +
      + +
      +
    21. + + + + + + } +
    22. +
      + +
      +
    23. + + + + + + +
    24. +
      + +
      +
    25. + 1 + + + + + validates :agencia, format: { with: /\A[\d]+\z/, message: "only numbers" } +
    26. +
      + +
      +
    27. + 1 + + + + + validates :conta_corrente, format: { with: /\A[\d]+\z/, message: "only numbers" } +
    28. +
      + +
      +
    29. + + + + + + end +
    30. +
      + +
    +
    +
    + + +
    +
    +

    app/models/disciplina.rb

    +

    + + 93.75% + + + lines covered +

    + + + +
    + 16 relevant lines. + 15 lines covered and + 1 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + class Disciplina < ApplicationRecord +
    2. +
      + +
      +
    3. + 1 + + + + + def self.all_tipos +
    4. +
      + +
      +
    5. + 1 + + + + + return [['Obrigatória', 1], ['Optativa', 2]] +
    6. +
      + +
      +
    7. + + + + + + end +
    8. +
      + +
      +
    9. + + + + + + +
    10. +
      + +
      +
    11. + 1 + + + + + def self.all_disciplinas +
    12. +
      + +
      +
    13. + + + + + + order(:nome).all +
    14. +
      + +
      +
    15. + + + + + + end +
    16. +
      + +
      +
    17. + + + + + + +
    18. +
      + +
      +
    19. + 1 + + + + + validates_presence_of :nome +
    20. +
      + +
      +
    21. + 1 + + + + + validates_presence_of :fk_tipo_disciplina_id +
    22. +
      + +
      +
    23. + 1 + + + + + validates_presence_of :c_prat +
    24. +
      + +
      +
    25. + 1 + + + + + validates_presence_of :c_teor +
    26. +
      + +
      +
    27. + 1 + + + + + validates_presence_of :c_est +
    28. +
      + +
      +
    29. + 1 + + + + + validates_presence_of :c_ext +
    30. +
      + +
      +
    31. + + + + + + +
    32. +
      + +
      +
    33. + + + + + + +
    34. +
      + +
      +
    35. + 1 + + + + + validates :nome, format: { without: /[\d]+|['"!¹@²#³$£%¢¨¬&\*\(\)\-_\+=§`´\[\]{}\^~ªº°\?\/:;>.<,\|\\]+/, message: 'apenas letras e espaços'} +
    36. +
      + +
      +
    37. + 1 + + + + + validates :c_prat, format: { with: /\A[\d]+\z/, message: "apenas numeros" } +
    38. +
      + +
      +
    39. + 1 + + + + + validates :c_teor, format: { with: /\A[\d]+\z/, message: "apenas numeros" } +
    40. +
      + +
      +
    41. + 1 + + + + + validates :c_est, format: { with: /\A[\d]+\z/, message: "apenas numeros" } +
    42. +
      + +
      +
    43. + 1 + + + + + validates :c_ext, format: { with: /\A[\d]+\z/, message: "apenas numeros" } +
    44. +
      + +
      +
    45. + + + + + + +
    46. +
      + +
      +
    47. + + + + + + end +
    48. +
      + +
    +
    +
    + + +
    +
    +

    app/models/monitoria.rb

    +

    + + 100.0% + + + lines covered +

    + + + +
    + 13 relevant lines. + 13 lines covered and + 0 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + class Monitoria < ApplicationRecord +
    2. +
      + +
      +
    3. + + + + + + +
    4. +
      + +
      +
    5. + 1 + + + + + def self.all_disciplinas +
    6. +
      + +
      +
    7. + 1 + + + + + @disciplinas = Array.new +
    8. +
      + +
      +
    9. + 1 + + + + + Disciplina.find_each do |d| +
    10. +
      + +
      +
    11. + 3 + + + + + @disciplinas << [d.nome, d.cod_disciplina] +
    12. +
      + +
      +
    13. + + + + + + end +
    14. +
      + +
      +
    15. + 1 + + + + + @disciplinas +
    16. +
      + +
      +
    17. + + + + + + end +
    18. +
      + +
      +
    19. + + + + + + +
    20. +
      + +
      +
    21. + + + + + + # def self.all_turmas +
    22. +
      + +
      +
    23. + + + + + + # @turmas = Array.new +
    24. +
      + +
      +
    25. + + + + + + # Turma.find_each do |t| +
    26. +
      + +
      +
    27. + + + + + + # @turmas << [t.turma, t.id] +
    28. +
      + +
      +
    29. + + + + + + # end +
    30. +
      + +
      +
    31. + + + + + + # @turmas +
    32. +
      + +
      +
    33. + + + + + + # end +
    34. +
      + +
      +
    35. + + + + + + +
    36. +
      + +
      +
    37. + 1 + + + + + def self.all_status +
    38. +
      + +
      +
    39. + 1 + + + + + return [['Pendente', 1], ['Recusado', 2], ['Aceito', 3], ['Encerrado', 4]] +
    40. +
      + +
      +
    41. + + + + + + end +
    42. +
      + +
      +
    43. + 1 + + + + + validates_presence_of :remuneracao +
    44. +
      + +
      +
    45. + 1 + + + + + validates_presence_of :fk_matricula +
    46. +
      + +
      +
    47. + 1 + + + + + validates_presence_of :fk_cod_disciplina +
    48. +
      + +
      +
    49. + 1 + + + + + validates_presence_of :fk_turmas_id +
    50. +
      + +
      +
    51. + 1 + + + + + validates_presence_of :fk_status_monitoria_id +
    52. +
      + +
      +
    53. + + + + + + +
    54. +
      + +
      +
    55. + + + + + + +
    56. +
      + +
      +
    57. + + + + + + end +
    58. +
      + +
    +
    +
    + + +
    +
    +

    app/models/motivo.rb

    +

    + + 100.0% + + + lines covered +

    + + + +
    + 2 relevant lines. + 2 lines covered and + 0 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + class Motivo < ApplicationRecord +
    2. +
      + +
      +
    3. + + + + + + #belongs_to:organization,:class_name=>'User',:foreign_key=>'user_id' +
    4. +
      + +
      +
    5. + 1 + + + + + CLASS_LIST=["Duvida","Pergunta","Falar com o coordenador"] +
    6. +
      + +
      +
    7. + + + + + + end +
    8. +
      + +
    +
    +
    + + +
    +
    +

    app/models/professor.rb

    +

    + + 100.0% + + + lines covered +

    + + + +
    + 16 relevant lines. + 16 lines covered and + 0 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + class Professor < ActiveRecord::Base +
    2. +
      + +
      +
    3. + 1 + + + + + has_secure_password +
    4. +
      + +
      +
    5. + + + + + + +
    6. +
      + +
      +
    7. + 1 + + + + + self.primary_key = :id +
    8. +
      + +
      +
    9. + + + + + + +
    10. +
      + +
      +
    11. + 1 + + + + + def self.all_roles +
    12. +
      + +
      +
    13. + 1 + + + + + return [['Professor(a) substituto(a)', 1], ['Professor(a)', 2], ['Professor(a) Colaborador(a)', 3], +
    14. +
      + +
      +
    15. + + + + + + ['Professor(a) Adjunto(a)', 4], ['Professor(a) Associado(a)', 5], ['Professor(a) Titular', 6]] +
    16. +
      + +
      +
    17. + + + + + + end +
    18. +
      + +
      +
    19. + + + + + + +
    20. +
      + +
      +
    21. + 1 + + + + + validates_presence_of :name +
    22. +
      + +
      +
    23. + 1 + + + + + validates_presence_of :username +
    24. +
      + +
      +
    25. + 1 + + + + + validates_presence_of :email +
    26. +
      + +
      +
    27. + + + + + + +
    28. +
      + +
      +
    29. + 1 + + + + + validates_uniqueness_of :username +
    30. +
      + +
      +
    31. + 1 + + + + + validates_uniqueness_of :email +
    32. +
      + +
      +
    33. + + + + + + +
    34. +
      + +
      +
    35. + + + + + + # Verificação do nome +
    36. +
      + +
      +
    37. + 1 + + + + + validates :name, length: { in: 3..50 }, format: { without: /[\d]+|[!@#$%*\(\)\|\\;\:\/?\]\[=\+\-_",\.]+/, +
    38. +
      + +
      +
    39. + + + + + + message: "only letters and spaces" } +
    40. +
      + +
      +
    41. + + + + + + # Verificação do username +
    42. +
      + +
      +
    43. + 1 + + + + + validates :username, length: { in: 3..15 }, format: { +
    44. +
      + +
      +
    45. + + + + + + with: /\A[\w+]+\z/, message: "only word characters (letter, numbers, underscore...)" } +
    46. +
      + +
      +
    47. + + + + + + +
    48. +
      + +
      +
    49. + + + + + + # Verificação do email +
    50. +
      + +
      +
    51. + 1 + + + + + VALID_EMAIL_REGEX = /\A[\w+\-.]+@unb\.br\z/i +
    52. +
      + +
      +
    53. + 1 + + + + + validates :email, format: { with: VALID_EMAIL_REGEX, message: "not a UnB email" } +
    54. +
      + +
      +
    55. + + + + + + +
    56. +
      + +
      +
    57. + + + + + + # Verificação da senha e confirmação de senha +
    58. +
      + +
      +
    59. + 1 + + + + + validates :password, length: { in: 6..12, message: "must be between 6 and 12 characters" }, on: :create +
    60. +
      + +
      +
    61. + 1 + + + + + validates :password_confirmation, length: { in: 6..12, message: "must be between 6 and 12 characters" }, on: :create +
    62. +
      + +
      +
    63. + + + + + + end +
    64. +
      + +
    +
    +
    + + +
    +
    +

    app/models/tarefa.rb

    +

    + + 100.0% + + + lines covered +

    + + + +
    + 2 relevant lines. + 2 lines covered and + 0 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + class Tarefa < ApplicationRecord +
    2. +
      + +
      +
    3. + 1 + + + + + belongs_to :monitoria +
    4. +
      + +
      +
    5. + + + + + + end +
    6. +
      + +
    +
    +
    + + +
    +
    +

    app/models/turma.rb

    +

    + + 100.0% + + + lines covered +

    + + + +
    + 38 relevant lines. + 38 lines covered and + 0 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + class Turma < ActiveRecord::Base +
    2. +
      + +
      +
    3. + 1 + + + + + def self.qnt_bolsas +
    4. +
      + +
      +
    5. + 1 + + + + + @qnt_bolsas = [] +
    6. +
      + +
      +
    7. + + + + + + +
    8. +
      + +
      +
    9. + 1 + + + + + for i in 1..10 +
    10. +
      + +
      +
    11. + 10 + + + + + @vaga = [] +
    12. +
      + +
      +
    13. + 10 + + + + + @vaga = [i.to_s, i] +
    14. +
      + +
      +
    15. + 10 + + + + + @qnt_bolsas.insert(-1, @vaga) +
    16. +
      + +
      +
    17. + + + + + + end +
    18. +
      + +
      +
    19. + + + + + + +
    20. +
      + +
      +
    21. + 1 + + + + + return @qnt_bolsas +
    22. +
      + +
      +
    23. + + + + + + end +
    24. +
      + +
      +
    25. + + + + + + +
    26. +
      + +
      +
    27. + 1 + + + + + def self.sel_disciplinas +
    28. +
      + +
      +
    29. + 1 + + + + + @disciplinas = Disciplina.select('cod_disciplina', 'nome') +
    30. +
      + +
      +
    31. + + + + + + +
    32. +
      + +
      +
    33. + 1 + + + + + @select = [] +
    34. +
      + +
      +
    35. + 1 + + + + + @disciplinas.each do |disciplina| +
    36. +
      + +
      +
    37. + 3 + + + + + @atual = [] +
    38. +
      + +
      +
    39. + 3 + + + + + @atual = [disciplina.nome, disciplina.cod_disciplina] +
    40. +
      + +
      +
    41. + 3 + + + + + @select.insert(-1, @atual) +
    42. +
      + +
      +
    43. + + + + + + end +
    44. +
      + +
      +
    45. + + + + + + +
    46. +
      + +
      +
    47. + 1 + + + + + return @select +
    48. +
      + +
      +
    49. + + + + + + end +
    50. +
      + +
      +
    51. + + + + + + +
    52. +
      + +
      +
    53. + 1 + + + + + def self.show_disciplinas +
    54. +
      + +
      +
    55. + 1 + + + + + @disciplinas = Disciplina.select('nome') +
    56. +
      + +
      +
    57. + 1 + + + + + @show = [] +
    58. +
      + +
      +
    59. + + + + + + +
    60. +
      + +
      +
    61. + 1 + + + + + @disciplinas.each do |disciplina| +
    62. +
      + +
      +
    63. + 3 + + + + + @atual = String.new +
    64. +
      + +
      +
    65. + 3 + + + + + @atual = disciplina.nome +
    66. +
      + +
      +
    67. + 3 + + + + + @show.insert(-1, @atual) +
    68. +
      + +
      +
    69. + + + + + + end +
    70. +
      + +
      +
    71. + + + + + + +
    72. +
      + +
      +
    73. + 1 + + + + + return @show +
    74. +
      + +
      +
    75. + + + + + + end +
    76. +
      + +
      +
    77. + + + + + + +
    78. +
      + +
      +
    79. + 1 + + + + + def self.sel_turmas +
    80. +
      + +
      +
    81. + + + + + + [ +
    82. +
      + +
      +
    83. + 1 + + + + + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', +
    84. +
      + +
      +
    85. + + + + + + 'AA', 'BB', 'CC', 'DD', 'EE', 'FF', 'GG', 'HH' +
    86. +
      + +
      +
    87. + + + + + + ] +
    88. +
      + +
      +
    89. + + + + + + end +
    90. +
      + +
      +
    91. + + + + + + +
    92. +
      + +
      +
    93. + 1 + + + + + def self.all_turmas +
    94. +
      + +
      +
    95. + 1 + + + + + find_each() +
    96. +
      + +
      +
    97. + + + + + + end +
    98. +
      + +
      +
    99. + + + + + + +
    100. +
      + +
      +
    101. + 1 + + + + + validates_presence_of :turma +
    102. +
      + +
      +
    103. + 1 + + + + + validates_presence_of :professor +
    104. +
      + +
      +
    105. + 1 + + + + + validates_presence_of :fk_cod_disciplina +
    106. +
      + +
      +
    107. + 1 + + + + + validates_presence_of :qnt_bolsas +
    108. +
      + +
      +
    109. + 1 + + + + + validate :turma_unica +
    110. +
      + +
      +
    111. + + + + + + +
    112. +
      + +
      +
    113. + 1 + + + + + def turma_unica +
    114. +
      + +
      +
    115. + 34 + + + + + @turmas = Turma.where(fk_cod_disciplina: fk_cod_disciplina) +
    116. +
      + +
      +
    117. + + + + + + +
    118. +
      + +
      +
    119. + 34 + + + + + @turmas.each do |t| +
    120. +
      + +
      +
    121. + 8 + + + + + if t.turma == turma +
    122. +
      + +
      +
    123. + 3 + + + + + errors.add(:turma, "#{turma} não é a única para a disciplina #{Disciplina.find(fk_cod_disciplina).nome}") +
    124. +
      + +
      +
    125. + + + + + + end +
    126. +
      + +
      +
    127. + + + + + + end +
    128. +
      + +
      +
    129. + + + + + + end +
    130. +
      + +
      +
    131. + + + + + + end +
    132. +
      + +
    +
    +
    + + +
    +
    +

    app/models/user.rb

    +

    + + 96.61% + + + lines covered +

    + + + +
    + 59 relevant lines. + 57 lines covered and + 2 lines missed. +
    + + + +
    + +
    +    
      + +
      +
    1. + 1 + + + + + class User < ActiveRecord::Base +
    2. +
      + +
      +
    3. + 1 + + + + + attr_accessor :remember_token, :reset_token +
    4. +
      + +
      +
    5. + 1 + + + + + has_secure_password +
    6. +
      + +
      +
    7. + + + + + + +
    8. +
      + +
      +
    9. + 1 + + + + + self.primary_key = :id +
    10. +
      + +
      +
    11. + + + + + + +
    12. +
      + +
      +
    13. + + + + + + ## Verifica se o formulário foi preenchido de acordo com a especificação +
    14. +
      + +
      +
    15. + 1 + + + + + validates_presence_of :name +
    16. +
      + +
      +
    17. + 1 + + + + + validates_presence_of :email +
    18. +
      + +
      +
    19. + 1 + + + + + validates_presence_of :cpf +
    20. +
      + +
      +
    21. + 1 + + + + + validates_presence_of :rg +
    22. +
      + +
      +
    23. + 1 + + + + + validates_presence_of :matricula +
    24. +
      + +
      +
    25. + + + + + + +
    26. +
      + +
      +
    27. + + + + + + ## Verifica se as informações não se repetem no Banco de Dados +
    28. +
      + +
      +
    29. + 1 + + + + + validates_uniqueness_of :email +
    30. +
      + +
      +
    31. + 1 + + + + + validates_uniqueness_of :cpf +
    32. +
      + +
      +
    33. + 1 + + + + + validates_uniqueness_of :rg +
    34. +
      + +
      +
    35. + 1 + + + + + validates_uniqueness_of :matricula +
    36. +
      + +
      +
    37. + + + + + + +
    38. +
      + +
      +
    39. + + + + + + ## Verifica se os campos tem o tamanho correto +
    40. +
      + +
      +
    41. + + + + + + # Verificação do nome +
    42. +
      + +
      +
    43. + 1 + + + + + validates :name, length: { in: 3..50 }, format: { +
    44. +
      + +
      +
    45. + + + + + + without: /[\d]+|['"!¹@²#³$£%¢¨¬&\*\(\)\-_\+=§`´\[\]{}\^~ªº°\?\/:;>.<,\|\\]+/, +
    46. +
      + +
      +
    47. + + + + + + message: 'only letters and spaces' +
    48. +
      + +
      +
    49. + + + + + + } +
    50. +
      + +
      +
    51. + + + + + + # Verificação da matrícula +
    52. +
      + +
      +
    53. + 1 + + + + + validates :matricula, length: { is: 9 }, format: { with: /\A[\d]+\z/, message: "only numbers" } +
    54. +
      + +
      +
    55. + + + + + + # Verificação do email +
    56. +
      + +
      +
    57. + 1 + + + + + VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-]+(?:\.[a-z\d\-]+)*\.[a-z]+\z/i +
    58. +
      + +
      +
    59. + 1 + + + + + validates :email, format: { with: VALID_EMAIL_REGEX, message: "invalid email format" } +
    60. +
      + +
      +
    61. + + + + + + # Verificação do CPF +
    62. +
      + +
      +
    63. + 1 + + + + + validates :cpf, length: { is: 11 }, format: { with: /\A[\d]+\z/, message: "only numbers" } +
    64. +
      + +
      +
    65. + 1 + + + + + validate :valid_cpf +
    66. +
      + +
      +
    67. + + + + + + # Verificação do RG +
    68. +
      + +
      +
    69. + 1 + + + + + validates :rg, length: { minimum: 7 }, format: { with: /\A[\d]+\z/, message: "only numbers" } +
    70. +
      + +
      +
    71. + + + + + + # Verificação da senha e confirmação de senha +
    72. +
      + +
      +
    73. + 1 + + + + + validates :password, length: { in: 6...12, message: "must be between 6 and 12 characters" }, on: :create +
    74. +
      + +
      +
    75. + 1 + + + + + validates :password_confirmation, length: { in: 6...12, message: "must be between 6 and 12 characters" }, on: :create +
    76. +
      + +
      +
    77. + + + + + + +
    78. +
      + +
      +
    79. + + + + + + # Cálculo de validação dp CPF +
    80. +
      + +
      +
    81. + 1 + + + + + def nth_validation_digit(cpf_array, digit) +
    82. +
      + +
      +
    83. + 230 + + + + + @somatorio = 0 +
    84. +
      + +
      +
    85. + 230 + + + + + @aux = 0 +
    86. +
      + +
      +
    87. + 230 + + + + + @peso = 12-digit +
    88. +
      + +
      +
    89. + + + + + + +
    90. +
      + +
      +
    91. + 230 + + + + + cpf_array.each do |value| +
    92. +
      + +
      +
    93. + 2106 + + + + + @somatorio += value*(@peso-(@aux)) +
    94. +
      + +
      +
    95. + + + + + + +
    96. +
      + +
      +
    97. + 2106 + + + + + @aux += 1 +
    98. +
      + +
      +
    99. + 2106 + + + + + break if @aux == (11-digit) +
    100. +
      + +
      +
    101. + + + + + + end +
    102. +
      + +
      +
    103. + 230 + + + + + @validation_digit = 11-(@somatorio%11) +
    104. +
      + +
      +
    105. + 230 + + + + + if @validation_digit > 9 +
    106. +
      + +
      +
    107. + 103 + + + + + @validation_digit = 0 +
    108. +
      + +
      +
    109. + + + + + + end +
    110. +
      + +
      +
    111. + + + + + + +
    112. +
      + +
      +
    113. + 230 + + + + + return @validation_digit +
    114. +
      + +
      +
    115. + + + + + + end +
    116. +
      + +
      +
    117. + + + + + + +
    118. +
      + +
      +
    119. + 1 + + + + + def valid_cpf +
    120. +
      + +
      +
    121. + 115 + + + + + @cpf_array = Array.new +
    122. +
      + +
      +
    123. + 115 + + + + + for x in 0...(cpf.length) +
    124. +
      + +
      +
    125. + 1228 + + + + + @cpf_array[x] = cpf[x].to_i +
    126. +
      + +
      +
    127. + + + + + + end +
    128. +
      + +
      +
    129. + + + + + + +
    130. +
      + +
      +
    131. + 115 + + + + + @first = nth_validation_digit(@cpf_array, 2) # Calcula o @first com base nos 9 digitos +
    132. +
      + +
      +
    133. + 115 + + + + + @second = nth_validation_digit(@cpf_array, 1) # Calcula o @second com base nos 9 digitos + 1o validação +
    134. +
      + +
      +
    135. + + + + + + +
    136. +
      + +
      +
    137. + 115 + + + + + if (cpf[9].to_i) != @first || (cpf[10].to_i) != @second +
    138. +
      + +
      +
    139. + 12 + + + + + errors.add(:cpf, "is invalid") +
    140. +
      + +
      +
    141. + + + + + + end +
    142. +
      + +
      +
    143. + + + + + + end +
    144. +
      + +
      +
    145. + + + + + + +
    146. +
      + +
      +
    147. + + + + + + # Retorna o digest de um hash de uma string passada para o método +
    148. +
      + +
      +
    149. + 1 + + + + + def User.digest(string) +
    150. +
      + +
      +
    151. + 1 + + + + + cost = ActiveModel::SecurePassword.min_cost ? BCrypt::Engine::MIN_COST : +
    152. +
      + +
      +
    153. + + + + + + BCrypt::Engine.cost +
    154. +
      + +
      +
    155. + 1 + + + + + BCrypt::Password.create(string, cost: cost) +
    156. +
      + +
      +
    157. + + + + + + end +
    158. +
      + +
      +
    159. + + + + + + +
    160. +
      + +
      +
    161. + + + + + + # Retorna um token aleatório +
    162. +
      + +
      +
    163. + 1 + + + + + def User.new_token +
    164. +
      + +
      +
    165. + 13 + + + + + SecureRandom.urlsafe_base64 +
    166. +
      + +
      +
    167. + + + + + + end +
    168. +
      + +
      +
    169. + + + + + + +
    170. +
      + +
      +
    171. + + + + + + # Define os atributos para resetar a senha +
    172. +
      + +
      +
    173. + 1 + + + + + def create_reset_digest +
    174. +
      + +
      +
    175. + 1 + + + + + self.reset_token = User.new_token +
    176. +
      + +
      +
    177. + 1 + + + + + update_attribute(:reset_digest, User.digest(reset_token)) +
    178. +
      + +
      +
    179. + 1 + + + + + update_attribute(:reset_sent_at, Time.zone.now) +
    180. +
      + +
      +
    181. + + + + + + end +
    182. +
      + +
      +
    183. + + + + + + +
    184. +
      + +
      +
    185. + + + + + + # Envia o e-mail para resetar a senha +
    186. +
      + +
      +
    187. + 1 + + + + + def send_password_reset_email +
    188. +
      + +
      +
    189. + 1 + + + + + UserMailer.reset_senha(self).deliver_now +
    190. +
      + +
      +
    191. + + + + + + end +
    192. +
      + +
      +
    193. + + + + + + +
    194. +
      + +
      +
    195. + + + + + + # Retorna true se o parâmetro password reset expirou +
    196. +
      + +
      +
    197. + 1 + + + + + def password_reset_expired? +
    198. +
      + +
      +
    199. + + + + + + reset_sent_at < 2.hours.ago +
    200. +
      + +
      +
    201. + + + + + + end +
    202. +
      + +
      +
    203. + + + + + + +
    204. +
      + +
      +
    205. + + + + + + # Retorna true se o token passado é o mesmo que o digest armazenado no banco +
    206. +
      + +
      +
    207. + 1 + + + + + def authenticated?(attribute, token) +
    208. +
      + +
      +
    209. + 2 + + + + + digest = send("#{attribute}_digest") +
    210. +
      + +
      +
    211. + 2 + + + + + return false if digest.nil? +
    212. +
      + +
      +
    213. + + + + + + BCrypt::Password.new(digest).is_password?(token) +
    214. +
      + +
      +
    215. + + + + + + end +
    216. +
      + +
      +
    217. + + + + + + end +
    218. +
      + +
    +
    +
    + + +
    +
    + + diff --git a/features/editarDisciplina.feature b/features/editarDisciplina.feature index 381ac996..a2c8f177 100644 --- a/features/editarDisciplina.feature +++ b/features/editarDisciplina.feature @@ -3,12 +3,12 @@ Cenário de Fundo: Dado que o banco possui um adminstrador - E que o banco possui uma disciplina que nao permite monitoria E que eu estou na página de login de usuários E que o "admin" está logado - Cenário: Admin edita o status de disponibilidade da disciplina 1 (happy path) - Dado que está na página de disciplinas + Cenário: Admin atualiza a disciplina 1 (happy path) + Dado que o banco possui uma disciplina + E que eu estou na página de disciplinas Quando eu clico em "Editar Disciplina" Então eu devo estar na página de edição de disciplina Quando eu preencho o formulário com: @@ -17,13 +17,13 @@ | Créditos Teóricos | 2 | | Créditos Est | 2 | | Créditos Ext | 2 | - E eu marco a checkbox de "Monitoria" E eu aperto em "Atualizar" Então eu devo estar na página de disciplinas E eu devo ver "Disciplina atualizada!" Cenário: Admin deixa o formulário de edição da disciplina 1 em branco (sad path) - Dado que está na página de disciplinas + Dado que o banco possui uma disciplina + E que eu estou na página de disciplinas Quando eu clico em "Editar Disciplina" Então eu devo estar na página de edição de disciplina Quando eu preencho o formulário com: @@ -32,6 +32,25 @@ | Créditos Teóricos | | | Créditos Est | | | Créditos Ext | | - E eu marco a checkbox de "Monitoria" E eu aperto em "Atualizar" Então eu devo ver "Ocorreu um erro ao atualizar a disciplina." + + Cenário: Admin disponibiliza monitoria para a disciplina 1 (happy path) + Dado que o banco possui uma disciplina que nao permite monitoria + E que eu estou na página de disciplinas + Quando eu clico em "Editar Disciplina" + Então eu devo estar na página de edição de disciplina + E eu marco a checkbox de "Monitoria" + E eu aperto em "Atualizar" + Então eu devo estar na página de disciplinas + E eu devo ver "Disciplina atualizada!" + + Cenário: Admin indisponibiliza monitoria para a disciplina 1 (happy path) + Dado que o banco possui uma disciplina + E que eu estou na página de disciplinas + Quando eu clico em "Editar Disciplina" + Então eu devo estar na página de edição de disciplina + E eu marco a checkbox de "Monitoria" + E eu aperto em "Atualizar" + Então eu devo estar na página de disciplinas + E eu devo ver "Disciplina atualizada!" \ No newline at end of file diff --git a/features/step_definitions/web_steps.rb b/features/step_definitions/web_steps.rb index e98ea860..035cfad4 100644 --- a/features/step_definitions/web_steps.rb +++ b/features/step_definitions/web_steps.rb @@ -125,7 +125,7 @@ def with_scope(locator) Dado /^(?:|que )o banco possui uma disciplina que nao permite monitoria$/ do Disciplina.create!( - :id => 2, + :id => 1, :cod_disciplina => 1, :nome => "Software Básico", :fk_tipo_disciplina_id => 1, @@ -268,12 +268,7 @@ def with_scope(locator) end Quando /^(?:|eu )marco a checkbox de "([^"]*)"$/ do |label| - page.has_checked_field?('checkbox').should be false - - find('//*[@id="checkbox"]').check - - page.has_checked_field?('checkbox').should be true - + find('//*[@id="checkbox"]').click end Então /^(?:|eu )devo estar na (.+)$/ do |page_name| diff --git a/features/support/paths.rb b/features/support/paths.rb index 3f3840d2..b306d574 100644 --- a/features/support/paths.rb +++ b/features/support/paths.rb @@ -68,7 +68,7 @@ def path_to(page_name) when /^página de edição de disciplina$/ - edit_disciplina_path(Disciplina.find(2)) + edit_disciplina_path(Disciplina.find(1)) when /^página de nova disciplina$/ new_disciplina_path From 2bf74788de366fd8a175c0b9170b27a4fb80b654 Mon Sep 17 00:00:00 2001 From: titofrota Date: Thu, 6 May 2021 11:22:43 -0300 Subject: [PATCH 11/18] REFACTOR disciplinas_controller_spec --- coverage/.last_run.json | 4 +- coverage/.resultset.json | 178 +++--- coverage/index.html | 546 +++++++++--------- db/seeds.rb | 2 +- features/step_definitions/web_steps.rb | 2 +- .../disciplinas_controller_spec.rb | 180 ++++-- spec/factories/disciplina.rb | 4 +- 7 files changed, 505 insertions(+), 411 deletions(-) diff --git a/coverage/.last_run.json b/coverage/.last_run.json index 04ed82cb..dc96f216 100644 --- a/coverage/.last_run.json +++ b/coverage/.last_run.json @@ -1,7 +1,5 @@ { "result": { - - "covered_percent": 12.93 - + "line": 8.24 } } diff --git a/coverage/.resultset.json b/coverage/.resultset.json index 16dca167..d137e786 100644 --- a/coverage/.resultset.json +++ b/coverage/.resultset.json @@ -53,7 +53,7 @@ "lines": [ 1, 1, - 5, + 3, null, null, 1, @@ -371,10 +371,10 @@ 1, null, 1, - 2, - 2, - 2, - 2, + 0, + 0, + 0, + 0, 0, 0, 0, @@ -393,10 +393,10 @@ null, null, 1, - 2, - 2, - 2, - 3, + 0, + 0, + 0, + 0, 0, null, null, @@ -606,7 +606,7 @@ null, null, 87, - 50, + 48, null, null, null, @@ -618,8 +618,8 @@ null, null, 1, - 50, - 50, + 48, + 48, null, null, null, @@ -630,19 +630,19 @@ null, null, 1, - 50, - 50, + 48, + 48, null, null, null, 1, - 50, + 48, null, 0, null, 2, null, - 34, + 32, null, 9, null, @@ -667,14 +667,14 @@ 1, null, 1, - 2, + 1, null, null, 1, - 1, + 4, null, - 1, - 0, + 4, + 3, null, 1, 1, @@ -684,36 +684,36 @@ 1, null, 1, - 0, - 0, + 4, + 3, null, - 0, - 0, + 1, + 1, null, null, null, 1, - 0, + 1, 0, 0, null, null, - 0, - 0, + 1, + 1, 0, null, null, - 0, - 0, + 1, + 1, null, null, 1, 1, - 1, + 5, null, null, 1, - 4, + 6, null, null, 1, @@ -761,8 +761,8 @@ 4, 4, 4, - 4, - 4, + 8, + 8, null, null, null, @@ -831,12 +831,12 @@ 6, null, 6, - 4, - 4, - 4, - null, 2, 2, + 2, + null, + 4, + 4, null, null, null, @@ -983,10 +983,10 @@ null, null, 1, - 1, - 1, - 1, - 1, + 0, + 0, + 0, + 0, 0, 0, null, @@ -1001,8 +1001,8 @@ null, null, 1, - 1, - 1, + 0, + 0, null, null, null, @@ -1012,12 +1012,12 @@ null, null, 1, - 3, - 3, - 1, + 0, + 0, + 0, null, - 1, - 1, + 0, + 0, null, null, null, @@ -1026,30 +1026,30 @@ null, null, 1, - 4, - 3, + 0, + 0, null, - 1, - 1, + 0, + 0, null, null, null, null, null, 1, - 1, - 1, + 0, + 0, null, null, 1, null, 1, - 7, + 0, null, null, null, 1, - 5, + 0, null, null ] @@ -1069,26 +1069,26 @@ 1, 4, null, - 3, + 4, 3, null, - 0, + 1, null, null, - 3, + 4, null, null, 1, 5, 5, null, - 4, + 5, 4, null, - 0, + 1, null, null, - 4, + 5, null, null, 1, @@ -1113,13 +1113,13 @@ null, null, 1, - 1, - 1, - 3, - 2, + 0, + 0, + 0, + 0, null, null, - 1, + 0, null, null ] @@ -1251,11 +1251,11 @@ 1, null, 1, - 1, - 1, - 3, + 0, + 0, + 0, null, - 1, + 0, null, null, null, @@ -1338,29 +1338,29 @@ null, null, 1, - 1, + 0, null, - 1, - 1, - 3, - 3, - 3, + 0, + 0, + 0, + 0, + 0, null, null, - 1, + 0, null, null, 1, - 1, - 1, + 0, + 0, null, - 1, - 3, - 3, - 3, + 0, + 0, + 0, + 0, null, null, - 1, + 0, null, null, 1, @@ -1381,10 +1381,10 @@ 1, null, 1, - 34, + 31, null, - 34, - 8, + 31, + 7, 3, null, null, @@ -1678,6 +1678,6 @@ } } }, - "timestamp": 1620278078 + "timestamp": 1620310763 } } diff --git a/coverage/index.html b/coverage/index.html index 6acc3687..9cd257ca 100644 --- a/coverage/index.html +++ b/coverage/index.html @@ -14,7 +14,7 @@ loading
    -
    Generated 2021-05-06T02:14:38-03:00
    +
    Generated 2021-05-06T11:19:23-03:00
      @@ -23,14 +23,14 @@

      All Files ( - 74.8% + 69.73% covered at - 15.27 + 15.16 hits/line ) @@ -44,10 +44,10 @@

      750 relevant lines, - 561 lines covered and - 189 lines missed. + 523 lines covered and + 227 lines missed. ( - 74.8% + 69.73% )
      @@ -149,23 +149,23 @@

      app/controllers/dashboard_controller.rb - 65.87 % + 59.52 % 313 126 - 83 - 43 - 5.52 + 75 + 51 + 5.27 app/controllers/disciplinas_controller.rb - 53.85 % + 79.49 % 68 39 - 21 - 18 - 0.64 + 31 + 8 + 1.36 @@ -209,7 +209,7 @@

      37 33 4 - 1.84 + 2.05 @@ -231,7 +231,7 @@

      25 25 0 - 3.20 + 3.12 @@ -270,23 +270,23 @@

      app/controllers/tarefas_controller.rb - 93.94 % + 36.36 % 75 33 - 31 - 2 - 1.52 + 12 + 21 + 0.36 app/controllers/turmas_controller.rb - 86.49 % + 78.38 % 66 37 - 32 - 5 - 1.78 + 29 + 8 + 1.73 @@ -396,7 +396,7 @@

      10 9 1 - 2.80 + 2.60 @@ -523,12 +523,12 @@

      app/models/monitoria.rb - 100.00 % + 69.23 % 29 13 - 13 - 0 - 1.15 + 9 + 4 + 0.69 @@ -567,12 +567,12 @@

      app/models/turma.rb - 100.00 % + 63.16 % 66 38 - 38 - 0 - 4.00 + 24 + 14 + 3.13 @@ -599,14 +599,14 @@

      Controllers ( - 67.53% + 63.82% covered at - 2.36 + 2.29 hits/line ) @@ -620,10 +620,10 @@

      539 relevant lines, - 364 lines covered and - 175 lines missed. + 344 lines covered and + 195 lines missed. ( - 67.53% + 63.82% )
      @@ -703,23 +703,23 @@

      app/controllers/dashboard_controller.rb - 65.87 % + 59.52 % 313 126 - 83 - 43 - 5.52 + 75 + 51 + 5.27 app/controllers/disciplinas_controller.rb - 53.85 % + 79.49 % 68 39 - 21 - 18 - 0.64 + 31 + 8 + 1.36 @@ -763,7 +763,7 @@

      37 33 4 - 1.84 + 2.05 @@ -785,7 +785,7 @@

      25 25 0 - 3.20 + 3.12 @@ -824,23 +824,23 @@

      app/controllers/tarefas_controller.rb - 93.94 % + 36.36 % 75 33 - 31 - 2 - 1.52 + 12 + 21 + 0.36 app/controllers/turmas_controller.rb - 86.49 % + 78.38 % 66 37 - 32 - 5 - 1.78 + 29 + 8 + 1.73 @@ -945,15 +945,15 @@

      Models ( - - 98.22% + + 87.57% covered at - 59.91 + 59.67 hits/line ) @@ -967,10 +967,10 @@

      169 relevant lines, - 166 lines covered and - 3 lines missed. - ( - 98.22% + 148 lines covered and + 21 lines missed. + ( + 87.57% )
      @@ -1061,12 +1061,12 @@

      app/models/monitoria.rb - 100.00 % + 69.23 % 29 13 - 13 - 0 - 1.15 + 9 + 4 + 0.69 @@ -1105,12 +1105,12 @@

      app/models/turma.rb - 100.00 % + 63.16 % 66 38 - 38 - 0 - 4.00 + 24 + 14 + 3.13 @@ -1234,7 +1234,7 @@

      covered at - 1.95 + 1.84 hits/line ) @@ -1369,7 +1369,7 @@

      10 9 1 - 2.80 + 2.60 @@ -4510,7 +4510,7 @@

      app/controllers/dashboard_controller.rb

      - 65.87% + 59.52% lines covered @@ -4520,8 +4520,8 @@

      126 relevant lines. - 83 lines covered and - 43 lines missed. + 75 lines covered and + 51 lines missed.
      @@ -4829,8 +4829,8 @@

      -
    • - 2 +
    • + @@ -4840,8 +4840,8 @@

    • -
    • - 2 +
    • + @@ -4851,8 +4851,8 @@

    • -
    • - 2 +
    • + @@ -4862,8 +4862,8 @@

    • -
    • - 2 +
    • + @@ -5071,8 +5071,8 @@

    • -
    • - 2 +
    • + @@ -5082,8 +5082,8 @@

    • -
    • - 2 +
    • + @@ -5093,8 +5093,8 @@

    • -
    • - 2 +
    • + @@ -5104,8 +5104,8 @@

    • -
    • - 3 +
    • + @@ -7414,8 +7414,8 @@

    • -
    • - 50 +
    • + 48 @@ -7546,8 +7546,8 @@

    • -
    • - 50 +
    • + 48 @@ -7557,8 +7557,8 @@

    • -
    • - 50 +
    • + 48 @@ -7678,8 +7678,8 @@

    • -
    • - 50 +
    • + 48 @@ -7689,8 +7689,8 @@

    • -
    • - 50 +
    • + 48 @@ -7744,8 +7744,8 @@

    • -
    • - 50 +
    • + 48 @@ -7810,8 +7810,8 @@

    • -
    • - 34 +
    • + 32 @@ -7984,7 +7984,7 @@

      app/controllers/disciplinas_controller.rb

      - 53.85% + 79.49% lines covered @@ -7994,8 +7994,8 @@

      39 relevant lines. - 21 lines covered and - 18 lines missed. + 31 lines covered and + 8 lines missed.
      @@ -8072,8 +8072,8 @@

    • -
    • - 2 +
    • + 1 @@ -8116,8 +8116,8 @@

    • -
    • - 1 +
    • + 4 @@ -8138,8 +8138,8 @@

    • -
    • - 1 +
    • + 4 @@ -8149,8 +8149,8 @@

    • -
    • - +
    • + 3 @@ -8259,8 +8259,8 @@

    • -
    • - +
    • + 4 @@ -8270,8 +8270,8 @@

    • -
    • - +
    • + 3 @@ -8292,8 +8292,8 @@

    • -
    • - +
    • + 1 @@ -8303,8 +8303,8 @@

    • -
    • - +
    • + 1 @@ -8358,8 +8358,8 @@

    • -
    • - +
    • + 1 @@ -8413,8 +8413,8 @@

    • -
    • - +
    • + 1 @@ -8424,8 +8424,8 @@

    • -
    • - +
    • + 1 @@ -8468,8 +8468,8 @@

    • -
    • - +
    • + 1 @@ -8479,8 +8479,8 @@

    • -
    • - +
    • + 1 @@ -8534,8 +8534,8 @@

    • -
    • - 1 +
    • + 5 @@ -8578,8 +8578,8 @@

    • -
    • - 4 +
    • + 6 @@ -9131,8 +9131,8 @@

    • -
    • - 4 +
    • + 8 @@ -9142,8 +9142,8 @@

    • -
    • - 4 +
    • + 8 @@ -10733,8 +10733,8 @@

    • -
    • - 4 +
    • + 2 @@ -10744,8 +10744,8 @@

    • -
    • - 4 +
    • + 2 @@ -10755,8 +10755,8 @@

    • -
    • - 4 +
    • + 2 @@ -10777,8 +10777,8 @@

    • -
    • - 2 +
    • + 4 @@ -10788,8 +10788,8 @@

    • -
    • - 2 +
    • + 4 @@ -12264,8 +12264,8 @@

      app/controllers/tarefas_controller.rb

      - - 93.94% + + 36.36% lines covered @@ -12275,8 +12275,8 @@

      33 relevant lines. - 31 lines covered and - 2 lines missed. + 12 lines covered and + 21 lines missed.
      @@ -12353,8 +12353,8 @@

      -
    • - 1 +
    • + @@ -12364,8 +12364,8 @@

    • -
    • - 1 +
    • + @@ -12375,8 +12375,8 @@

    • -
    • - 1 +
    • + @@ -12386,8 +12386,8 @@

    • -
    • - 1 +
    • + @@ -12551,8 +12551,8 @@

    • -
    • - 1 +
    • + @@ -12562,8 +12562,8 @@

    • -
    • - 1 +
    • + @@ -12672,8 +12672,8 @@

    • -
    • - 3 +
    • + @@ -12683,8 +12683,8 @@

    • -
    • - 3 +
    • + @@ -12694,8 +12694,8 @@

    • -
    • - 1 +
    • + @@ -12716,8 +12716,8 @@

    • -
    • - 1 +
    • + @@ -12727,8 +12727,8 @@

    • -
    • - 1 +
    • + @@ -12826,8 +12826,8 @@

    • -
    • - 4 +
    • + @@ -12837,8 +12837,8 @@

    • -
    • - 3 +
    • + @@ -12859,8 +12859,8 @@

    • -
    • - 1 +
    • + @@ -12870,8 +12870,8 @@

    • -
    • - 1 +
    • + @@ -12947,8 +12947,8 @@

    • -
    • - 1 +
    • + @@ -12958,8 +12958,8 @@

    • -
    • - 1 +
    • + @@ -13024,8 +13024,8 @@

    • -
    • - 7 +
    • + @@ -13079,8 +13079,8 @@

    • -
    • - 5 +
    • + @@ -13120,8 +13120,8 @@

      app/controllers/turmas_controller.rb

      - - 86.49% + + 78.38% lines covered @@ -13131,8 +13131,8 @@

      37 relevant lines. - 32 lines covered and - 5 lines missed. + 29 lines covered and + 8 lines missed.
      @@ -13286,8 +13286,8 @@

      -
    • - 3 +
    • + 4 @@ -13319,8 +13319,8 @@

    • -
    • - +
    • + 1 @@ -13352,8 +13352,8 @@

    • -
    • - 3 +
    • + 4 @@ -13429,8 +13429,8 @@

    • -
    • - 4 +
    • + 5 @@ -13462,8 +13462,8 @@

    • -
    • - +
    • + 1 @@ -13495,8 +13495,8 @@

    • -
    • - 4 +
    • + 5 @@ -13770,8 +13770,8 @@

    • -
    • - 1 +
    • + @@ -13781,8 +13781,8 @@

    • -
    • - 1 +
    • + @@ -13792,8 +13792,8 @@

    • -
    • - 3 +
    • + @@ -13803,8 +13803,8 @@

    • -
    • - 2 +
    • + @@ -13836,8 +13836,8 @@

    • -
    • - 1 +
    • + @@ -14773,8 +14773,8 @@

    • -
    • - 5 +
    • + 3 @@ -16387,8 +16387,8 @@

      app/models/monitoria.rb

      - - 100.0% + + 69.23% lines covered @@ -16398,8 +16398,8 @@

      13 relevant lines. - 13 lines covered and - 0 lines missed. + 9 lines covered and + 4 lines missed.
      @@ -16443,8 +16443,8 @@

      -
    • - 1 +
    • + @@ -16454,8 +16454,8 @@

    • -
    • - 1 +
    • + @@ -16465,8 +16465,8 @@

    • -
    • - 3 +
    • + @@ -16487,8 +16487,8 @@

    • -
    • - 1 +
    • + @@ -17259,8 +17259,8 @@

      app/models/turma.rb

      - - 100.0% + + 63.16% lines covered @@ -17270,8 +17270,8 @@

      38 relevant lines. - 38 lines covered and - 0 lines missed. + 24 lines covered and + 14 lines missed.
      @@ -17436,8 +17436,8 @@

      -
    • - 1 +
    • + @@ -17458,8 +17458,8 @@

    • -
    • - 1 +
    • + @@ -17469,8 +17469,8 @@

    • -
    • - 1 +
    • + @@ -17480,8 +17480,8 @@

    • -
    • - 3 +
    • + @@ -17491,8 +17491,8 @@

    • -
    • - 3 +
    • + @@ -17502,8 +17502,8 @@

    • -
    • - 3 +
    • + @@ -17535,8 +17535,8 @@

    • -
    • - 1 +
    • + @@ -17579,8 +17579,8 @@

    • -
    • - 1 +
    • + @@ -17590,8 +17590,8 @@

    • -
    • - 1 +
    • + @@ -17612,8 +17612,8 @@

    • -
    • - 1 +
    • + @@ -17623,8 +17623,8 @@

    • -
    • - 3 +
    • + @@ -17634,8 +17634,8 @@

    • -
    • - 3 +
    • + @@ -17645,8 +17645,8 @@

    • -
    • - 3 +
    • + @@ -17678,8 +17678,8 @@

    • -
    • - 1 +
    • + @@ -17909,8 +17909,8 @@

    • -
    • - 34 +
    • + 31 @@ -17931,8 +17931,8 @@

    • -
    • - 34 +
    • + 31 @@ -17942,8 +17942,8 @@

    • -
    • - 8 +
    • + 7 diff --git a/db/seeds.rb b/db/seeds.rb index 313f7c32..ef2477d7 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -19,7 +19,7 @@ ###################### Disciplina.create([{nome: "APC", fk_tipo_disciplina_id: 1, c_prat: 2, c_teor: 4, - cod_disciplina: 1}]) + cod_disciplina: 1, monitoria: true}]) Disciplina.create([{nome: "ED", diff --git a/features/step_definitions/web_steps.rb b/features/step_definitions/web_steps.rb index 035cfad4..a7e76e77 100644 --- a/features/step_definitions/web_steps.rb +++ b/features/step_definitions/web_steps.rb @@ -120,7 +120,7 @@ def with_scope(locator) :c_teor => 2, :c_est => 4, :c_ext => 0, - :monitoria => "true") + :monitoria => true) end Dado /^(?:|que )o banco possui uma disciplina que nao permite monitoria$/ do diff --git a/spec/controllers/disciplinas_controller_spec.rb b/spec/controllers/disciplinas_controller_spec.rb index 96c5d2d0..83d86d31 100644 --- a/spec/controllers/disciplinas_controller_spec.rb +++ b/spec/controllers/disciplinas_controller_spec.rb @@ -4,17 +4,15 @@ before :each do allow_any_instance_of(DisciplinasController).to receive(:logged_in).and_return true allow_any_instance_of(DisciplinasController).to receive(:is_admin).and_return true - @engenharia = Disciplina.new(:nome => "Engenharia de Software", :fk_tipo_disciplina_id => 1, :c_prat => 4, :c_teor => 2, :c_est => 4, :c_ext => 0) - @params = Hash.new - @params[:disciplina] = @engenharia end describe "instance methods" do - describe "Localiza disciplina" do - it "atribui a disciplina procurada para @disciplina" do - @engenharia.save - disciplina = Disciplina.find(1) - expect(disciplina).to eq(@engenharia) + describe "#find_disciplina" do + it "encontra a disciplina no banco" do + @disciplina = FactoryBot.create(:disciplina, id: '1') + @disciplina.save + disciplina = Disciplina.find(1) + expect(disciplina).to eq(@disciplina) end end @@ -61,69 +59,165 @@ describe "POST #create" do context "Happy Path" do + before :each do + @info = { + nome: 'Engenharia de Software', + fk_tipo_disciplina_id: '1', + c_prat: '4', + c_teor: '2', + c_est: '4', + c_ext: '0', + monitoria: true + } + + @disciplina = FactoryBot.create(:disciplina, id: 1) + @params = {} + @params[:disciplina] = @info + end + + it '#disciplina_params' do + expect_any_instance_of(DisciplinasController).to receive(:disciplina_params) + .and_return @params[:disciplina] + post :create, params: @params + end + it "saves the new disciplina in the database" do - expect(@engenharia.save).to be true + @disciplina = Disciplina.new(@params[:disciplina]) + post :create, params: @params + expect(@disciplina.save).to be true end - it "redirects to the disciplinas_path" do - post :create, params: {disciplina:@params} - expect(response).to be_successful - end + + it "redirects to dashboard_disciplinas_path" do + @disciplina = FactoryBot.build(:disciplina) + + allow_any_instance_of(DisciplinasController).to receive(:disciplina_params) + .and_return(@params[:disciplina]) + allow(Disciplina).to receive(:create).and_return @disciplina + + post :create, params: @params + expect(subject).to redirect_to dashboard_disciplinas_path + end end context "Sad Path" do + before :each do + @invalid_info = { + nome: 'Engenharia de Software', + fk_tipo_disciplina_id: '1', + c_prat: '', + c_teor: '', + c_est: '', + c_ext: '', + monitoria: true + } + + @cadastro = Disciplina.new(@invalid_info) + @cadastro.save + @params = {} + @params[:disciplina] = @invalid_info + end + it "does not save the new disciplina in the database" do - @engenharia.nome="" - expect(@engenharia.save).to be false + post :create, params: @params + expect(flash[:danger]).to include( + "Ocorreu um erro ao cadastrar a disciplina. Nenhuma disciplina cadastrada." + ) + expect(response).to render_template(:new) end - it "re-renders the :new view" do - get :new - expect(response).to render_template :new - end end - end describe "GET #edit" do it "renders the :edit view" do - @engenharia.save - get :edit, params: { id: @engenharia.cod_disciplina } - expect(response).to render_template :edit - end + disciplina = FactoryBot.create(:disciplina) + params = {} + params[:id] = 1 + get :edit, params: params + expect(response).to render_template(:edit) + end end describe "PUT #update" do context "Happy Path" do - it "updates the disciplina in the database" do - expect(@engenharia.update(:nome => "Software")).to be true - end - it "redirects to the dashboard_disciplinas_path" do - @engenharia.save - put :update, {params: { disciplina: @params, id: @engenharia.cod_disciplina}} - expect(response).to redirect_to dashboard_disciplinas_path - end + before :each do + @db_disciplina = FactoryBot.create(:disciplina, id: '1') + @info = { + nome: 'Engenharia de Software', + fk_tipo_disciplina_id: '1', + c_prat: '2', + c_teor: '4', + c_est: '4', + c_ext: '0', + monitoria: false + } + + @params = {} + @params[:disciplina] = @info + @params[:id] = '1' + end + + it 'finds the disciplina in the database' do + expect(Disciplina).to receive(:find).with(@params[:id]).and_return(@db_disciplina) + put :update, params: @params + end + + it '#disciplina_params' do + allow(Disciplina).to receive(:find).and_return(@db_disciplina) + expect_any_instance_of(DisciplinasController).to receive(:disciplina_params) + .and_return(@params[:disciplina]) + put :update, params: @params + end + + it 'updates the disciplina in the databse' do + allow(Disciplina).to receive(:find).and_return(@db_disciplina) + put :update, params: @params + expect(flash[:notice]).to eq('Disciplina atualizada!') + expect(subject).to redirect_to dashboard_disciplinas_path + end end context "Sad Path" do + before :each do + @db_disciplina = FactoryBot.create(:disciplina, id: '1') + @invalid_info = { + nome: '', + fk_tipo_disciplina_id: '', + c_prat: '', + c_teor: '', + c_est: '', + c_ext: '' + } + + @params = {} + @params[:disciplina] = @invalid_info + @params[:id] = '1' + end + it "does not update the disciplina in the database" do - expect(@engenharia.update(:nome => "")).to be false + allow(Disciplina).to receive(:find).and_return(@db_disciplina) + put :update, params: @params + expect(flash[:danger]).to eq('Ocorreu um erro ao atualizar a disciplina.') + expect(subject).to render_template(:edit) end - it "re-renders the :edit view" do - @engenharia.save - get :edit, params: { id: @engenharia.cod_disciplina } - expect(response).to render_template :edit - end end end describe "DELETE #destroy" do + before :each do + @db_disciplina = FactoryBot.create(:disciplina, id: '1') + @params = {} + @params[:id] = '1' + end + it "deletes the disciplina" do - @engenharia.save - expect(@engenharia.destroy).to eq(@engenharia) + @db_disciplina.save + expect(@db_disciplina.destroy).to eq(@db_disciplina) end + it "redirects to the dashboard_disciplinas_path" do - @engenharia.save - post :destroy, params: {id: @engenharia.cod_disciplina} - expect(response).to redirect_to dashboard_disciplinas_path + delete :destroy, params: @params + expect(flash[:notice]).to eq('Disciplina removida!') + expect(subject).to redirect_to dashboard_disciplinas_path end end end diff --git a/spec/factories/disciplina.rb b/spec/factories/disciplina.rb index 9685a929..de8e86df 100644 --- a/spec/factories/disciplina.rb +++ b/spec/factories/disciplina.rb @@ -1,10 +1,12 @@ FactoryBot.define do factory :disciplina do - nome {"Engenharia de Software"} + id {'1'} + nome {"Engenharia de Software"} fk_tipo_disciplina_id {1} c_prat {4} c_teor {2} c_est {4} c_ext {0} + monitoria {true} end end \ No newline at end of file From e956e96891ff9abd3a31d0ee0bfb587ec0870cfb Mon Sep 17 00:00:00 2001 From: "Rafael G. de Paulo" Date: Fri, 7 May 2021 02:11:29 -0300 Subject: [PATCH 12/18] =?UTF-8?q?=E2=9C=A8=20Add=20hepler=20method=20to=20?= =?UTF-8?q?disciplina=20Model.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/disciplina.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/models/disciplina.rb b/app/models/disciplina.rb index 337783f2..10b3ed35 100644 --- a/app/models/disciplina.rb +++ b/app/models/disciplina.rb @@ -6,6 +6,10 @@ def self.all_tipos def self.all_disciplinas order(:nome).all end + + def self.com_monitoria + return where(monitoria: true) + end validates_presence_of :nome validates_presence_of :fk_tipo_disciplina_id From 9479334c5713f3437d5ad61516d39c06707f73e8 Mon Sep 17 00:00:00 2001 From: lucaslemos94 Date: Fri, 7 May 2021 16:15:30 -0300 Subject: [PATCH 13/18] ADD sprint_2.MD file. --- sprint_2.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 sprint_2.md diff --git a/sprint_2.md b/sprint_2.md new file mode 100644 index 00000000..acec22c8 --- /dev/null +++ b/sprint_2.md @@ -0,0 +1,17 @@ +## _Engenharia de Software - Grupo 4 - Sprint 2_ + +- Caroline Ferreira Pinto - 16/0067766 // (@CarolFP1896) +- Davi Martins Torres - 15/0122896 // (@torresdavi) +- Ítalo Eduardo Dias Frota - 18/0019279 // (@titofrota) +- Lucas Correa Lemos - 17/0149412 // (@lucaslemos94) +- Rafael Gonçalves de Paulo - 17/0043959 // (@rafael-g-depaulo) + + - **Épico: 4. Coordenador pode selecionar as disciplinas e/ou turmas que podem ou não receber monitores** + +## Features + +- Remodelagem do cenários existentes e adição de outros cenários. Ficando da seguinte forma: + * Cenário: O coordenador atualiza uma disciplina (happy path) + * Cenário: Admin edita o status de disponibilidade da disciplina 1 (happy path) + * Cenário: Admin deixa o formulário de edição da disciplina 1 em branco (sad path) +- Testes do RSPEC implementados. \ No newline at end of file From 21aa6e425bf928bccbd90ee68f3c5962ad8d7f57 Mon Sep 17 00:00:00 2001 From: titofrota Date: Fri, 7 May 2021 20:33:49 -0300 Subject: [PATCH 14/18] FIX disciplinas_controller_spec --- coverage/.resultset.json | 6 +- coverage/index.html | 130 ++++++++++++------ .../disciplinas_controller_spec.rb | 2 +- spec/factories/disciplina.rb | 3 +- 4 files changed, 95 insertions(+), 46 deletions(-) diff --git a/coverage/.resultset.json b/coverage/.resultset.json index d137e786..35a1262c 100644 --- a/coverage/.resultset.json +++ b/coverage/.resultset.json @@ -1230,6 +1230,10 @@ null, null, 1, + 0, + null, + null, + 1, 1, 1, 1, @@ -1678,6 +1682,6 @@ } } }, - "timestamp": 1620310763 + "timestamp": 1620430360 } } diff --git a/coverage/index.html b/coverage/index.html index 9cd257ca..4b610ae8 100644 --- a/coverage/index.html +++ b/coverage/index.html @@ -14,7 +14,7 @@ loading
    • -
      Generated 2021-05-06T11:19:23-03:00
      +
      Generated 2021-05-07T20:32:41-03:00
        @@ -23,14 +23,14 @@

        All Files ( - 69.73% + 69.68% covered at - 15.16 + 15.13 hits/line ) @@ -43,11 +43,11 @@

        - 750 relevant lines, - 523 lines covered and - 227 lines missed. + 752 relevant lines, + 524 lines covered and + 228 lines missed. ( - 69.73% + 69.68% )
        @@ -512,12 +512,12 @@

        app/models/disciplina.rb - 93.75 % - 24 + 88.89 % + 28 + 18 16 - 15 - 1 - 0.94 + 2 + 0.89 @@ -946,14 +946,14 @@

        Models ( - 87.57% + 87.13% covered at - 59.67 + 58.98 hits/line ) @@ -966,11 +966,11 @@

        - 169 relevant lines, - 148 lines covered and - 21 lines missed. + 171 relevant lines, + 149 lines covered and + 22 lines missed. ( - 87.57% + 87.13% )
        @@ -1050,12 +1050,12 @@

        app/models/disciplina.rb - 93.75 % - 24 + 88.89 % + 28 + 18 16 - 15 - 1 - 0.94 + 2 + 0.89 @@ -16092,8 +16092,8 @@

        app/models/disciplina.rb

        - - 93.75% + + 88.89% lines covered @@ -16102,9 +16102,9 @@

        - 16 relevant lines. - 15 lines covered and - 1 lines missed. + 18 relevant lines. + 16 lines covered and + 2 lines missed.
        @@ -16209,7 +16209,7 @@

        - +

      • @@ -16220,12 +16220,56 @@

        + def self.com_monitoria +

      • +
        + +
        +
      • + + + + + + return where(monitoria: true) +
      • +
        + +
        +
      • + + + + + + end +
      • +
        + +
        +
      • + + + + + + +
      • +
        + +
        +
      • + 1 + + + + validates_presence_of :nome
      • -
      • +
      • 1 @@ -16236,7 +16280,7 @@

      • -
      • +
      • 1 @@ -16247,7 +16291,7 @@

      • -
      • +
      • 1 @@ -16258,7 +16302,7 @@

      • -
      • +
      • 1 @@ -16269,7 +16313,7 @@

      • -
      • +
      • 1 @@ -16280,7 +16324,7 @@

      • -
      • +
      • @@ -16291,7 +16335,7 @@

      • -
      • +
      • @@ -16302,7 +16346,7 @@

      • -
      • +
      • 1 @@ -16313,7 +16357,7 @@

      • -
      • +
      • 1 @@ -16324,7 +16368,7 @@

      • -
      • +
      • 1 @@ -16335,7 +16379,7 @@

      • -
      • +
      • 1 @@ -16346,7 +16390,7 @@

      • -
      • +
      • 1 @@ -16357,7 +16401,7 @@

      • -
      • +
      • @@ -16368,7 +16412,7 @@

      • -
      • +
      • diff --git a/spec/controllers/disciplinas_controller_spec.rb b/spec/controllers/disciplinas_controller_spec.rb index 83d86d31..90361bd4 100644 --- a/spec/controllers/disciplinas_controller_spec.rb +++ b/spec/controllers/disciplinas_controller_spec.rb @@ -204,7 +204,7 @@ describe "DELETE #destroy" do before :each do - @db_disciplina = FactoryBot.create(:disciplina, id: '1') + @db_disciplina = FactoryBot.create(:disciplina, cod_disciplina: '10') @params = {} @params[:id] = '1' end diff --git a/spec/factories/disciplina.rb b/spec/factories/disciplina.rb index de8e86df..1a710fab 100644 --- a/spec/factories/disciplina.rb +++ b/spec/factories/disciplina.rb @@ -1,12 +1,13 @@ FactoryBot.define do factory :disciplina do - id {'1'} + id {1} nome {"Engenharia de Software"} fk_tipo_disciplina_id {1} c_prat {4} c_teor {2} c_est {4} c_ext {0} + cod_disciplina {113468} monitoria {true} end end \ No newline at end of file From a5db31df7a6d53b96bfc7cae8493c4ec699d0498 Mon Sep 17 00:00:00 2001 From: titofrota Date: Fri, 7 May 2021 20:41:46 -0300 Subject: [PATCH 15/18] FIX rspec test for disciplinas --- coverage/.resultset.json | 10 +-- coverage/index.html | 64 +++++++++---------- .../disciplinas_controller_spec.rb | 1 + 3 files changed, 38 insertions(+), 37 deletions(-) diff --git a/coverage/.resultset.json b/coverage/.resultset.json index 35a1262c..d664e35c 100644 --- a/coverage/.resultset.json +++ b/coverage/.resultset.json @@ -694,8 +694,8 @@ null, 1, 1, - 0, - 0, + 1, + 1, null, null, 1, @@ -1385,9 +1385,9 @@ 1, null, 1, - 31, + 33, null, - 31, + 33, 7, 3, null, @@ -1682,6 +1682,6 @@ } } }, - "timestamp": 1620430360 + "timestamp": 1620430844 } } diff --git a/coverage/index.html b/coverage/index.html index 4b610ae8..a04ec441 100644 --- a/coverage/index.html +++ b/coverage/index.html @@ -14,7 +14,7 @@ loading
      • -
        Generated 2021-05-07T20:32:41-03:00
        +
        Generated 2021-05-07T20:40:44-03:00
          @@ -23,7 +23,7 @@

          All Files ( - 69.68% + 69.95% @@ -44,10 +44,10 @@

          752 relevant lines, - 524 lines covered and - 228 lines missed. + 526 lines covered and + 226 lines missed. ( - 69.68% + 69.95% )
          @@ -160,12 +160,12 @@

          app/controllers/disciplinas_controller.rb - 79.49 % + 84.62 % 68 39 - 31 - 8 - 1.36 + 33 + 6 + 1.41 @@ -572,7 +572,7 @@

          38 24 14 - 3.13 + 3.24 @@ -599,7 +599,7 @@

          Controllers ( - 63.82% + 64.19% @@ -620,10 +620,10 @@

          539 relevant lines, - 344 lines covered and - 195 lines missed. + 346 lines covered and + 193 lines missed. ( - 63.82% + 64.19% )
          @@ -714,12 +714,12 @@

          app/controllers/disciplinas_controller.rb - 79.49 % + 84.62 % 68 39 - 31 - 8 - 1.36 + 33 + 6 + 1.41 @@ -953,7 +953,7 @@

          covered at - 58.98 + 59.01 hits/line ) @@ -1110,7 +1110,7 @@

          38 24 14 - 3.13 + 3.24 @@ -7983,8 +7983,8 @@

          app/controllers/disciplinas_controller.rb

          - - 79.49% + + 84.62% lines covered @@ -7994,8 +7994,8 @@

          39 relevant lines. - 31 lines covered and - 8 lines missed. + 33 lines covered and + 6 lines missed.
          @@ -8369,8 +8369,8 @@

          -
        • - +
        • + 1 @@ -8380,8 +8380,8 @@

        • -
        • - +
        • + 1 @@ -17953,8 +17953,8 @@

        • -
        • - 31 +
        • + 33 @@ -17975,8 +17975,8 @@

        • -
        • - 31 +
        • + 33 diff --git a/spec/controllers/disciplinas_controller_spec.rb b/spec/controllers/disciplinas_controller_spec.rb index 90361bd4..a9507cb5 100644 --- a/spec/controllers/disciplinas_controller_spec.rb +++ b/spec/controllers/disciplinas_controller_spec.rb @@ -205,6 +205,7 @@ describe "DELETE #destroy" do before :each do @db_disciplina = FactoryBot.create(:disciplina, cod_disciplina: '10') + @db_turma = FactoryBot.create(:turma, fk_cod_disciplina: '10') @params = {} @params[:id] = '1' end From d0aa9b47d9472473b46a684be495a3b593873a65 Mon Sep 17 00:00:00 2001 From: titofrota Date: Fri, 7 May 2021 20:59:04 -0300 Subject: [PATCH 16/18] REMOVE sprint2.md --- sprint_2.md | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 sprint_2.md diff --git a/sprint_2.md b/sprint_2.md deleted file mode 100644 index acec22c8..00000000 --- a/sprint_2.md +++ /dev/null @@ -1,17 +0,0 @@ -## _Engenharia de Software - Grupo 4 - Sprint 2_ - -- Caroline Ferreira Pinto - 16/0067766 // (@CarolFP1896) -- Davi Martins Torres - 15/0122896 // (@torresdavi) -- Ítalo Eduardo Dias Frota - 18/0019279 // (@titofrota) -- Lucas Correa Lemos - 17/0149412 // (@lucaslemos94) -- Rafael Gonçalves de Paulo - 17/0043959 // (@rafael-g-depaulo) - - - **Épico: 4. Coordenador pode selecionar as disciplinas e/ou turmas que podem ou não receber monitores** - -## Features - -- Remodelagem do cenários existentes e adição de outros cenários. Ficando da seguinte forma: - * Cenário: O coordenador atualiza uma disciplina (happy path) - * Cenário: Admin edita o status de disponibilidade da disciplina 1 (happy path) - * Cenário: Admin deixa o formulário de edição da disciplina 1 em branco (sad path) -- Testes do RSPEC implementados. \ No newline at end of file From 5318e7d89d40875819708f85caf7e1b80ebfaf11 Mon Sep 17 00:00:00 2001 From: Lucas Correa Date: Wed, 19 May 2021 22:38:02 -0300 Subject: [PATCH 17/18] adding Rdoc and Cycromatic. --- Gemfile | 3 + Gemfile.lock | 123 +- app/controllers/disciplinas_controller.rb | 66 +- app/models/disciplina.rb | 19 +- cyclomatic_disciplina.txt | Bin 0 -> 1154 bytes cyclomatic_result.txt | Bin 0 -> 81966 bytes doc/3_1_7.html | 306 +- doc/AddMonitorToAtendimentos.html | 39 +- doc/AddMonitoriaToDisciplinas.html | 134 + doc/Admin.html | 17 +- doc/AdminsController.html | 82 +- doc/ApplicationCable.html | 12 +- doc/ApplicationCable/Channel.html | 17 +- doc/ApplicationCable/Connection.html | 17 +- doc/ApplicationController.html | 24 +- doc/ApplicationHelper.html | 12 +- doc/ApplicationJob.html | 17 +- doc/ApplicationMailer.html | 17 +- doc/ApplicationRecord.html | 17 +- doc/Atendimento.html | 50 +- doc/AtendimentosController.html | 89 +- doc/AtendimentosHelper.html | 12 +- doc/Atividade.html | 17 +- doc/AtividadesController.html | 115 +- doc/AtividadesHelper.html | 12 +- doc/ChangeColumnNull.html | 135 + doc/CreateAdmin.html | 37 +- doc/CreateAtendimentos.html | 37 +- doc/CreateAtividades.html | 37 +- doc/CreateBolsas.html | 37 +- doc/CreateDadosBancarios.html | 37 +- doc/CreateDescricaoPeriodo.html | 37 +- doc/CreateDisciplinas.html | 38 +- doc/CreateMigrations.html | 37 +- doc/CreateMonitoria.html | 37 +- doc/CreateMotivos.html | 37 +- doc/CreatePasswordResets.html | 37 +- doc/CreatePeriodos.html | 37 +- doc/CreateProfessors.html | 37 +- doc/CreateStatusMonitoria.html | 37 +- doc/CreateStatusTurma.html | 37 +- doc/CreateTarefas.html | 144 + doc/CreateTipoDisciplina.html | 37 +- doc/CreateTurmas.html | 37 +- doc/CreateUsers.html | 37 +- doc/CreateVagas.html | 37 +- doc/DadosBancarios.html | 17 +- doc/DadosBancariosController.html | 89 +- doc/DashboardController.html | 219 +- doc/Disciplina.html | 87 +- doc/DisciplinasController.html | 325 +- doc/DisciplinasHelper.html | 12 +- doc/FaqController.html | 37 +- doc/Gemfile.html | 316 +- doc/Gemfile_lock.html | 762 +- doc/Guardfile.html | 306 +- doc/HistoricoController.html | 17 +- doc/HistoricoHelper.html | 12 +- doc/HomeController.html | 37 +- doc/HomeHelper.html | 12 +- doc/HtmlSelectorsHelpers.html | 32 +- doc/Monitoria.html | 50 +- doc/MonitoriaCIC.html | 12 +- doc/MonitoriaCIC/Application.html | 17 +- doc/MonitoriasController.html | 102 +- doc/Motivo.html | 22 +- doc/MotivosController.html | 115 +- doc/MotivosHelper.html | 12 +- doc/NavigationHelpers.html | 134 +- doc/Object.html | 52 +- doc/Professor.html | 42 +- doc/ProfessorMailer.html | 37 +- doc/ProfessorsController.html | 105 +- doc/README_md.html | 306 +- doc/Rakefile.html | 306 +- doc/ResetSenhasController.html | 76 +- doc/ResetSenhasHelper.html | 12 +- doc/SPRINT2_md.html | 306 +- doc/SessionsController.html | 76 +- doc/SessionsHelper.html | 71 +- doc/SobreController.html | 37 +- doc/Tarefa.html | 97 + doc/TarefasController.html | 287 + doc/TarefasHelper.html | 91 + doc/Turma.html | 105 +- doc/TurmasController.html | 89 +- doc/User.html | 144 +- doc/UserMailer.html | 37 +- doc/UsersController.html | 63 +- doc/WithinHelpers.html | 32 +- doc/app/assets/config/manifest_js.html | 306 +- .../assets/javascripts/application_js.html | 308 +- .../javascripts/atendimentos_coffee.html | 306 +- .../assets/javascripts/atividades_coffee.html | 306 +- doc/app/assets/javascripts/cable_js.html | 306 +- .../javascripts/disciplinas_coffee.html | 306 +- .../assets/javascripts/historico_coffee.html | 306 +- doc/app/assets/javascripts/home_coffee.html | 306 +- .../assets/javascripts/motivos_coffee.html | 306 +- doc/app/assets/javascripts/popper_min_js.html | 306 +- .../javascripts/reset_senhas_coffee.html | 306 +- .../assets/javascripts/sessions_coffee.html | 306 +- .../assets/javascripts/tarefas_coffee.html | 379 + .../assets/stylesheets/application_scss.html | 306 +- .../assets/stylesheets/atendimentos_scss.html | 306 +- .../assets/stylesheets/atividades_scss.html | 306 +- doc/app/assets/stylesheets/custom_scss.html | 306 +- .../assets/stylesheets/disciplinas_scss.html | 306 +- .../assets/stylesheets/historico_scss.html | 306 +- doc/app/assets/stylesheets/home_scss.html | 306 +- doc/app/assets/stylesheets/motivos_scss.html | 306 +- .../assets/stylesheets/reset_senhas_scss.html | 306 +- .../assets/stylesheets/scaffolds_scss.html | 306 +- doc/app/assets/stylesheets/sessions_scss.html | 306 +- doc/app/assets/stylesheets/tarefas_scss.html | 379 + doc/app/views/admins/new_html_haml.html | 306 +- .../_atendimento_json_jbuilder.html | 306 +- .../views/atendimentos/edit_html_haml.html | 309 +- .../atendimentos/index_json_jbuilder.html | 306 +- doc/app/views/atendimentos/new_html_haml.html | 308 +- .../views/atendimentos/show_html_haml.html | 306 +- .../atendimentos/show_json_jbuilder.html | 306 +- doc/app/views/atividades/edit_html_haml.html | 306 +- doc/app/views/atividades/new_html_haml.html | 306 +- .../views/dados_bancarios/edit_html_haml.html | 306 +- .../views/dados_bancarios/new_html_haml.html | 306 +- .../dashboard/apagar_alunos_html_haml.html | 306 +- .../dashboard/atendimentos_html_haml.html | 306 +- .../views/dashboard/atividades_html_haml.html | 306 +- .../dashboard/dados_bancarios_html_haml.html | 306 +- .../dashboard/disciplinas_html_haml.html | 310 +- .../views/dashboard/edit_user_html_haml.html | 306 +- .../views/dashboard/historico_html_haml.html | 306 +- .../importar_disciplinas_html_haml.html | 306 +- .../importar_professores_html_haml.html | 306 +- doc/app/views/dashboard/index_html_haml.html | 306 +- .../views/dashboard/monitorias_html_haml.html | 308 +- doc/app/views/dashboard/turmas_html_haml.html | 306 +- doc/app/views/disciplinas/edit_html_haml.html | 316 +- doc/app/views/disciplinas/new_html_haml.html | 311 +- doc/app/views/faq/index_html_haml.html | 306 +- doc/app/views/home/index_html_haml.html | 306 +- .../views/layouts/application_html_haml.html | 306 +- doc/app/views/monitorias/edit_html_haml.html | 306 +- doc/app/views/monitorias/new_html_haml.html | 306 +- doc/app/views/monitorias/show_html_haml.html | 309 +- .../views/motivos/_motivo_json_jbuilder.html | 306 +- .../views/motivos/index_json_jbuilder.html | 306 +- doc/app/views/motivos/show_json_jbuilder.html | 306 +- .../identityconfirmation_html_haml.html | 306 +- doc/app/views/professors/index_html_haml.html | 306 +- doc/app/views/professors/new_html_haml.html | 306 +- .../views/reset_senhas/edit_html_haml.html | 306 +- doc/app/views/reset_senhas/new_html_haml.html | 306 +- doc/app/views/sessions/new_html_haml.html | 306 +- doc/app/views/sobre/index_html_haml.html | 306 +- doc/app/views/tarefas/_form_html_haml.html | 403 + .../views/tarefas/_formedit_html_haml.html | 394 + .../views/tarefas/_tarefa_json_jbuilder.html | 379 + doc/app/views/tarefas/edit_html_haml.html | 397 + doc/app/views/tarefas/index_html_haml.html | 413 + .../views/tarefas/index_json_jbuilder.html | 379 + doc/app/views/tarefas/new_html_haml.html | 392 + doc/app/views/tarefas/show_html_haml.html | 424 + doc/app/views/tarefas/show_json_jbuilder.html | 379 + doc/app/views/turmas/edit_html_haml.html | 306 +- doc/app/views/turmas/new_html_haml.html | 306 +- .../user_mailer/reset_senha_html_haml.html | 306 +- .../user_mailer/reset_senha_text_haml.html | 306 +- doc/app/views/users/new_html_haml.html | 306 +- doc/config/credentials_yml_enc.html | 306 +- doc/config_ru.html | 306 +- .../assets/0_10_2/application_css.html | 306 +- .../assets/0_10_2/application_js.html | 310 +- doc/coverage/index_html.html | 16052 +++++++++----- doc/created.rid | 6917 ++---- doc/css/rdoc.css | 22 +- doc/database_sqlite3.html | 306 +- doc/development_sqlite3.html | 306 +- doc/features/adicionarTarefa_feature.html | 404 + doc/features/apagarAluno_feature.html | 306 +- .../apagarDadosBancarios_feature.html | 306 +- doc/features/apagarTurma_feature.html | 306 +- doc/features/avaliarTarefa_feature.html | 404 + .../cadastrarDadosBancarios_feature.html | 306 +- doc/features/cadastrarTurma_feature.html | 306 +- doc/features/disciplinaCRUD_feature.html | 308 +- doc/features/editarAtendimento_feature.html | 306 +- doc/features/editarAtividade_feature.html | 306 +- .../editarDadosBancarios_feature.html | 306 +- doc/features/editarDisciplina_feature.html | 435 + doc/features/editarMonitoria_feature.html | 306 +- doc/features/editarPerfilAluno_feature.html | 306 +- .../editarPerfilProfessor_feature.html | 306 +- doc/features/editarTurma_feature.html | 306 +- .../historicoDisciplinas_feature.html | 306 +- doc/features/importarDisciplinas_feature.html | 306 +- doc/features/importarProfessor_feature.html | 306 +- doc/features/inscreverMonitoria_feature.html | 319 +- doc/features/loginAdmin_feature.html | 306 +- doc/features/loginAluno_feature.html | 306 +- doc/features/loginProfessor_feature.html | 306 +- doc/features/menuInscricao_feature.html | 306 +- doc/features/paginaFAQ_feature.html | 306 +- doc/features/paginaSobre_feature.html | 306 +- doc/features/registrarAluno_feature.html | 306 +- .../registrarAtendimento_feature.html | 306 +- doc/features/registrarAtividade_feature.html | 306 +- doc/features/registrarProfessor_feature.html | 306 +- .../relatorioAtendimento_feature.html | 364 +- doc/features/removerMonitoria_feature.html | 306 +- .../remuneracaoMonitoria_feature.html | 306 +- doc/features/resetSenha_feature.html | 306 +- .../selectProfessoresEmail_feature.html | 306 +- doc/features/selectProfessores_feature.html | 306 +- doc/features/statusEncerrado_feature.html | 306 +- doc/index.html | 387 +- doc/js/navigation.js.gz | Bin 833 -> 833 bytes doc/js/search_index.js | 2 +- doc/js/search_index.js.gz | Bin 10370 -> 15795 bytes doc/js/searcher.js.gz | Bin 1688 -> 1688 bytes doc/lib/tasks/cucumber_rake.html | 308 +- doc/log/development_log.html | 8778 +------- doc/package_json.html | 308 +- doc/public/404_html.html | 306 +- doc/public/422_html.html | 306 +- doc/public/500_html.html | 306 +- .../apple-touch-icon-precomposed_png.html | 306 +- doc/public/apple-touch-icon_png.html | 306 +- doc/public/favicon_ico.html | 306 +- doc/public/robots_txt.html | 308 +- doc/sprint_2_md.html | 415 + doc/table_of_contents.html | 1383 +- .../fc/4d97e6179ffc0e_tmp_8kvu7r.html | 377 + doc/tmp/development_secret_txt.html | 308 +- doc/tmp/restart_txt.html | 306 +- .../application_cable/channel_html.html | 504 + .../application_cable/connection_html.html | 504 + .../controllers/admins_controller_html.html | 514 + .../application_controller_html.html | 504 + .../atendimentos_controller_html.html | 570 + .../atividades_controller_html.html | 590 + .../dados_bancarios_controller_html.html | 564 + .../dashboard_controller_html.html | 810 + .../disciplinas_controller_html.html | 568 + .../app/controllers/faq_controller_html.html | 503 + .../historico_controller_html.html | 502 + .../app/controllers/home_controller_html.html | 503 + .../monitorias_controller_html.html | 566 + .../controllers/motivos_controller_html.html | 574 + .../professors_controller_html.html | 549 + .../reset_senhas_controller_html.html | 564 + .../controllers/sessions_controller_html.html | 528 + .../controllers/sobre_controller_html.html | 503 + .../controllers/tarefas_controller_html.html | 574 + .../controllers/turmas_controller_html.html | 566 + .../controllers/users_controller_html.html | 536 + .../app/helpers/application_helper_html.html | 502 + .../app/helpers/atendimentos_helper_html.html | 502 + .../app/helpers/atividades_helper_html.html | 502 + .../app/helpers/disciplinas_helper_html.html | 502 + .../app/helpers/historico_helper_html.html | 502 + .../app/helpers/home_helper_html.html | 502 + .../app/helpers/motivos_helper_html.html | 502 + .../app/helpers/reset_senhas_helper_html.html | 502 + .../app/helpers/sessions_helper_html.html | 520 + .../app/helpers/tarefas_helper_html.html | 502 + .../app/jobs/application_job_html.html | 502 + .../app/mailers/application_mailer_html.html | 504 + .../app/mailers/professor_mailer_html.html | 510 + .../app/mailers/user_mailer_html.html | 512 + doc/tmp/rubycritic/app/models/admin_html.html | 505 + .../app/models/application_record_html.html | 503 + .../app/models/atendimento_html.html | 511 + .../rubycritic/app/models/atividade_html.html | 508 + .../app/models/dados_bancarios_html.html | 515 + .../app/models/disciplina_html.html | 526 + .../rubycritic/app/models/monitoria_html.html | 527 + .../rubycritic/app/models/motivo_html.html | 504 + .../rubycritic/app/models/professor_html.html | 532 + .../rubycritic/app/models/tarefa_html.html | 503 + doc/tmp/rubycritic/app/models/turma_html.html | 566 + doc/tmp/rubycritic/app/models/user_html.html | 609 + .../assets/javascripts/application_js.html | 707 + .../assets/stylesheets/application_css.html | 1032 + .../vendor/javascripts/bootstrap_min_js.html | 386 + .../javascripts/highcharts_src-4_0_1_js.html | 18292 ++++++++++++++++ .../jquery_filtertable_min_js.html | 393 + .../vendor/javascripts/jquery_min_js.html | 379 + .../javascripts/jquery_scrollTo_min_js.html | 387 + .../javascripts/jquery_tablesorter_js.html | 1409 ++ .../jquery_tablesorter_min_js.html | 379 + .../vendor/javascripts/jquery_timeago_js.html | 614 + .../vendor/javascripts/prettify_js.html | 395 + .../vendor/stylesheets/bootstrap_min_css.html | 386 + .../stylesheets/font-awesome_min_css.html | 383 + .../vendor/stylesheets/prettify_css.html | 379 + .../prettify_custom_theme_css.html | 476 + doc/tmp/rubycritic/code_index_html.html | 3106 +++ .../rubycritic/config/application_html.html | 522 + doc/tmp/rubycritic/config/boot_html.html | 502 + .../rubycritic/config/environment_html.html | 504 + .../config/environments/development_html.html | 572 + .../config/environments/production_html.html | 594 + .../config/environments/test_html.html | 555 + .../application_controller_renderer_html.html | 502 + .../config/initializers/assets_html.html | 506 + .../backtrace_silencers_html.html | 504 + .../content_security_policy_html.html | 510 + .../initializers/cookies_serializer_html.html | 502 + .../filter_parameter_logging_html.html | 502 + .../config/initializers/inflections_html.html | 504 + .../config/initializers/mime_types_html.html | 502 + .../initializers/session_store_html.html | 502 + .../initializers/wrap_parameters_html.html | 511 + doc/tmp/rubycritic/config/puma_html.html | 512 + doc/tmp/rubycritic/config/routes_html.html | 548 + doc/tmp/rubycritic/config/spring_html.html | 506 + .../20191025181734_create_admin_html.html | 513 + .../20191025182246_create_bolsas_html.html | 508 + ...025182328_create_dados_bancarios_html.html | 509 + ...5182418_create_descricao_periodo_html.html | 507 + ...0191025182504_create_disciplinas_html.html | 515 + ...20191025182624_create_migrations_html.html | 508 + .../20191025182656_create_monitoria_html.html | 518 + ...025182829_create_password_resets_html.html | 511 + .../20191025182920_create_periodos_html.html | 512 + ...20191025183018_create_professors_html.html | 515 + ...25183120_create_status_monitoria_html.html | 507 + ...191025183206_create_status_turma_html.html | 507 + ...025183258_create_tipo_disciplina_html.html | 507 + .../20191025183323_create_turmas_html.html | 515 + .../20191025183520_create_users_html.html | 523 + .../20191025183553_create_vagas_html.html | 512 + .../20191119111242_create_motivos_html.html | 509 + ...191119114540_create_atendimentos_html.html | 512 + .../20191119134000_create_tarefas_html.html | 515 + ...20191120225259_create_atividades_html.html | 512 + ...4635_add_monitor_to_atendimentos_html.html | 505 + ...0191210130811_change_column_null_html.html | 506 + ...717_add_monitoria_to_disciplinas_html.html | 505 + doc/tmp/rubycritic/db/schema_html.html | 693 + doc/tmp/rubycritic/db/seeds_html.html | 533 + .../step_definitions/web_steps_html.html | 962 + .../rubycritic/features/support/env_html.html | 527 + .../features/support/paths_html.html | 637 + .../features/support/selectors_html.html | 542 + doc/tmp/rubycritic/overview_html.html | 565 + doc/tmp/rubycritic/simple_cov_index_html.html | 2083 ++ doc/tmp/rubycritic/smells_index_html.html | 9756 +++++++++ .../admins_controller_spec_html.html | 548 + .../atendimentos_controller_spec_html.html | 654 + .../atividades_controller_spec_html.html | 671 + .../dados_bancarios_controller_spec_html.html | 774 + .../dashboard_controller_spec_html.html | 757 + .../disciplinas_controller_spec_html.html | 725 + .../controllers/faq_controller_spec_html.html | 513 + .../home_controller_spec_html.html | 513 + .../monitorias_controller_spec_html.html | 703 + .../professors_controller_spec_html.html | 764 + .../reset_senhas_controller_spec_html.html | 698 + .../sessions_controller_spec_html.html | 531 + .../sobre_controller_spec_html.html | 511 + .../tarefas_controller_spec_html.html | 687 + .../turmas_controller_spec_html.html | 703 + .../users_controller_spec_html.html | 731 + .../spec/factories/atendimento_html.html | 512 + .../spec/factories/atividade_html.html | 509 + .../spec/factories/dados_bancarios_html.html | 508 + .../spec/factories/disciplina_html.html | 513 + .../spec/factories/monitoria_html.html | 512 + .../spec/factories/motivo_html.html | 507 + .../spec/factories/professor_html.html | 510 + .../spec/factories/tarefa_html.html | 510 + .../rubycritic/spec/factories/turma_html.html | 511 + .../rubycritic/spec/factories/user_html.html | 512 + .../spec/models/atendimento_spec_html.html | 567 + .../spec/models/atividade_spec_html.html | 566 + .../models/dados_bancarios_spec_html.html | 608 + .../spec/models/disciplina_spec_html.html | 652 + .../spec/models/monitoria_spec_html.html | 574 + .../spec/models/professor_spec_html.html | 674 + .../spec/models/tarefa_spec_html.html | 535 + .../spec/models/turma_spec_html.html | 633 + .../spec/models/user_spec_html.html | 780 + .../rubycritic/spec/rails_helper_html.html | 538 + doc/tmp/rubycritic/spec/spec_helper_html.html | 596 + 387 files changed, 158289 insertions(+), 40049 deletions(-) create mode 100644 cyclomatic_disciplina.txt create mode 100644 cyclomatic_result.txt create mode 100644 doc/AddMonitoriaToDisciplinas.html create mode 100644 doc/ChangeColumnNull.html create mode 100644 doc/CreateTarefas.html create mode 100644 doc/Tarefa.html create mode 100644 doc/TarefasController.html create mode 100644 doc/TarefasHelper.html create mode 100644 doc/app/assets/javascripts/tarefas_coffee.html create mode 100644 doc/app/assets/stylesheets/tarefas_scss.html create mode 100644 doc/app/views/tarefas/_form_html_haml.html create mode 100644 doc/app/views/tarefas/_formedit_html_haml.html create mode 100644 doc/app/views/tarefas/_tarefa_json_jbuilder.html create mode 100644 doc/app/views/tarefas/edit_html_haml.html create mode 100644 doc/app/views/tarefas/index_html_haml.html create mode 100644 doc/app/views/tarefas/index_json_jbuilder.html create mode 100644 doc/app/views/tarefas/new_html_haml.html create mode 100644 doc/app/views/tarefas/show_html_haml.html create mode 100644 doc/app/views/tarefas/show_json_jbuilder.html create mode 100644 doc/features/adicionarTarefa_feature.html create mode 100644 doc/features/avaliarTarefa_feature.html create mode 100644 doc/features/editarDisciplina_feature.html create mode 100644 doc/sprint_2_md.html create mode 100644 doc/tmp/cache/bootsnap/compile-cache/fc/4d97e6179ffc0e_tmp_8kvu7r.html create mode 100644 doc/tmp/rubycritic/app/channels/application_cable/channel_html.html create mode 100644 doc/tmp/rubycritic/app/channels/application_cable/connection_html.html create mode 100644 doc/tmp/rubycritic/app/controllers/admins_controller_html.html create mode 100644 doc/tmp/rubycritic/app/controllers/application_controller_html.html create mode 100644 doc/tmp/rubycritic/app/controllers/atendimentos_controller_html.html create mode 100644 doc/tmp/rubycritic/app/controllers/atividades_controller_html.html create mode 100644 doc/tmp/rubycritic/app/controllers/dados_bancarios_controller_html.html create mode 100644 doc/tmp/rubycritic/app/controllers/dashboard_controller_html.html create mode 100644 doc/tmp/rubycritic/app/controllers/disciplinas_controller_html.html create mode 100644 doc/tmp/rubycritic/app/controllers/faq_controller_html.html create mode 100644 doc/tmp/rubycritic/app/controllers/historico_controller_html.html create mode 100644 doc/tmp/rubycritic/app/controllers/home_controller_html.html create mode 100644 doc/tmp/rubycritic/app/controllers/monitorias_controller_html.html create mode 100644 doc/tmp/rubycritic/app/controllers/motivos_controller_html.html create mode 100644 doc/tmp/rubycritic/app/controllers/professors_controller_html.html create mode 100644 doc/tmp/rubycritic/app/controllers/reset_senhas_controller_html.html create mode 100644 doc/tmp/rubycritic/app/controllers/sessions_controller_html.html create mode 100644 doc/tmp/rubycritic/app/controllers/sobre_controller_html.html create mode 100644 doc/tmp/rubycritic/app/controllers/tarefas_controller_html.html create mode 100644 doc/tmp/rubycritic/app/controllers/turmas_controller_html.html create mode 100644 doc/tmp/rubycritic/app/controllers/users_controller_html.html create mode 100644 doc/tmp/rubycritic/app/helpers/application_helper_html.html create mode 100644 doc/tmp/rubycritic/app/helpers/atendimentos_helper_html.html create mode 100644 doc/tmp/rubycritic/app/helpers/atividades_helper_html.html create mode 100644 doc/tmp/rubycritic/app/helpers/disciplinas_helper_html.html create mode 100644 doc/tmp/rubycritic/app/helpers/historico_helper_html.html create mode 100644 doc/tmp/rubycritic/app/helpers/home_helper_html.html create mode 100644 doc/tmp/rubycritic/app/helpers/motivos_helper_html.html create mode 100644 doc/tmp/rubycritic/app/helpers/reset_senhas_helper_html.html create mode 100644 doc/tmp/rubycritic/app/helpers/sessions_helper_html.html create mode 100644 doc/tmp/rubycritic/app/helpers/tarefas_helper_html.html create mode 100644 doc/tmp/rubycritic/app/jobs/application_job_html.html create mode 100644 doc/tmp/rubycritic/app/mailers/application_mailer_html.html create mode 100644 doc/tmp/rubycritic/app/mailers/professor_mailer_html.html create mode 100644 doc/tmp/rubycritic/app/mailers/user_mailer_html.html create mode 100644 doc/tmp/rubycritic/app/models/admin_html.html create mode 100644 doc/tmp/rubycritic/app/models/application_record_html.html create mode 100644 doc/tmp/rubycritic/app/models/atendimento_html.html create mode 100644 doc/tmp/rubycritic/app/models/atividade_html.html create mode 100644 doc/tmp/rubycritic/app/models/dados_bancarios_html.html create mode 100644 doc/tmp/rubycritic/app/models/disciplina_html.html create mode 100644 doc/tmp/rubycritic/app/models/monitoria_html.html create mode 100644 doc/tmp/rubycritic/app/models/motivo_html.html create mode 100644 doc/tmp/rubycritic/app/models/professor_html.html create mode 100644 doc/tmp/rubycritic/app/models/tarefa_html.html create mode 100644 doc/tmp/rubycritic/app/models/turma_html.html create mode 100644 doc/tmp/rubycritic/app/models/user_html.html create mode 100644 doc/tmp/rubycritic/assets/javascripts/application_js.html create mode 100644 doc/tmp/rubycritic/assets/stylesheets/application_css.html create mode 100644 doc/tmp/rubycritic/assets/vendor/javascripts/bootstrap_min_js.html create mode 100644 doc/tmp/rubycritic/assets/vendor/javascripts/highcharts_src-4_0_1_js.html create mode 100644 doc/tmp/rubycritic/assets/vendor/javascripts/jquery_filtertable_min_js.html create mode 100644 doc/tmp/rubycritic/assets/vendor/javascripts/jquery_min_js.html create mode 100644 doc/tmp/rubycritic/assets/vendor/javascripts/jquery_scrollTo_min_js.html create mode 100644 doc/tmp/rubycritic/assets/vendor/javascripts/jquery_tablesorter_js.html create mode 100644 doc/tmp/rubycritic/assets/vendor/javascripts/jquery_tablesorter_min_js.html create mode 100644 doc/tmp/rubycritic/assets/vendor/javascripts/jquery_timeago_js.html create mode 100644 doc/tmp/rubycritic/assets/vendor/javascripts/prettify_js.html create mode 100644 doc/tmp/rubycritic/assets/vendor/stylesheets/bootstrap_min_css.html create mode 100644 doc/tmp/rubycritic/assets/vendor/stylesheets/font-awesome_min_css.html create mode 100644 doc/tmp/rubycritic/assets/vendor/stylesheets/prettify_css.html create mode 100644 doc/tmp/rubycritic/assets/vendor/stylesheets/prettify_custom_theme_css.html create mode 100644 doc/tmp/rubycritic/code_index_html.html create mode 100644 doc/tmp/rubycritic/config/application_html.html create mode 100644 doc/tmp/rubycritic/config/boot_html.html create mode 100644 doc/tmp/rubycritic/config/environment_html.html create mode 100644 doc/tmp/rubycritic/config/environments/development_html.html create mode 100644 doc/tmp/rubycritic/config/environments/production_html.html create mode 100644 doc/tmp/rubycritic/config/environments/test_html.html create mode 100644 doc/tmp/rubycritic/config/initializers/application_controller_renderer_html.html create mode 100644 doc/tmp/rubycritic/config/initializers/assets_html.html create mode 100644 doc/tmp/rubycritic/config/initializers/backtrace_silencers_html.html create mode 100644 doc/tmp/rubycritic/config/initializers/content_security_policy_html.html create mode 100644 doc/tmp/rubycritic/config/initializers/cookies_serializer_html.html create mode 100644 doc/tmp/rubycritic/config/initializers/filter_parameter_logging_html.html create mode 100644 doc/tmp/rubycritic/config/initializers/inflections_html.html create mode 100644 doc/tmp/rubycritic/config/initializers/mime_types_html.html create mode 100644 doc/tmp/rubycritic/config/initializers/session_store_html.html create mode 100644 doc/tmp/rubycritic/config/initializers/wrap_parameters_html.html create mode 100644 doc/tmp/rubycritic/config/puma_html.html create mode 100644 doc/tmp/rubycritic/config/routes_html.html create mode 100644 doc/tmp/rubycritic/config/spring_html.html create mode 100644 doc/tmp/rubycritic/db/migrate/20191025181734_create_admin_html.html create mode 100644 doc/tmp/rubycritic/db/migrate/20191025182246_create_bolsas_html.html create mode 100644 doc/tmp/rubycritic/db/migrate/20191025182328_create_dados_bancarios_html.html create mode 100644 doc/tmp/rubycritic/db/migrate/20191025182418_create_descricao_periodo_html.html create mode 100644 doc/tmp/rubycritic/db/migrate/20191025182504_create_disciplinas_html.html create mode 100644 doc/tmp/rubycritic/db/migrate/20191025182624_create_migrations_html.html create mode 100644 doc/tmp/rubycritic/db/migrate/20191025182656_create_monitoria_html.html create mode 100644 doc/tmp/rubycritic/db/migrate/20191025182829_create_password_resets_html.html create mode 100644 doc/tmp/rubycritic/db/migrate/20191025182920_create_periodos_html.html create mode 100644 doc/tmp/rubycritic/db/migrate/20191025183018_create_professors_html.html create mode 100644 doc/tmp/rubycritic/db/migrate/20191025183120_create_status_monitoria_html.html create mode 100644 doc/tmp/rubycritic/db/migrate/20191025183206_create_status_turma_html.html create mode 100644 doc/tmp/rubycritic/db/migrate/20191025183258_create_tipo_disciplina_html.html create mode 100644 doc/tmp/rubycritic/db/migrate/20191025183323_create_turmas_html.html create mode 100644 doc/tmp/rubycritic/db/migrate/20191025183520_create_users_html.html create mode 100644 doc/tmp/rubycritic/db/migrate/20191025183553_create_vagas_html.html create mode 100644 doc/tmp/rubycritic/db/migrate/20191119111242_create_motivos_html.html create mode 100644 doc/tmp/rubycritic/db/migrate/20191119114540_create_atendimentos_html.html create mode 100644 doc/tmp/rubycritic/db/migrate/20191119134000_create_tarefas_html.html create mode 100644 doc/tmp/rubycritic/db/migrate/20191120225259_create_atividades_html.html create mode 100644 doc/tmp/rubycritic/db/migrate/20191121154635_add_monitor_to_atendimentos_html.html create mode 100644 doc/tmp/rubycritic/db/migrate/20191210130811_change_column_null_html.html create mode 100644 doc/tmp/rubycritic/db/migrate/20210505021717_add_monitoria_to_disciplinas_html.html create mode 100644 doc/tmp/rubycritic/db/schema_html.html create mode 100644 doc/tmp/rubycritic/db/seeds_html.html create mode 100644 doc/tmp/rubycritic/features/step_definitions/web_steps_html.html create mode 100644 doc/tmp/rubycritic/features/support/env_html.html create mode 100644 doc/tmp/rubycritic/features/support/paths_html.html create mode 100644 doc/tmp/rubycritic/features/support/selectors_html.html create mode 100644 doc/tmp/rubycritic/overview_html.html create mode 100644 doc/tmp/rubycritic/simple_cov_index_html.html create mode 100644 doc/tmp/rubycritic/smells_index_html.html create mode 100644 doc/tmp/rubycritic/spec/controllers/admins_controller_spec_html.html create mode 100644 doc/tmp/rubycritic/spec/controllers/atendimentos_controller_spec_html.html create mode 100644 doc/tmp/rubycritic/spec/controllers/atividades_controller_spec_html.html create mode 100644 doc/tmp/rubycritic/spec/controllers/dados_bancarios_controller_spec_html.html create mode 100644 doc/tmp/rubycritic/spec/controllers/dashboard_controller_spec_html.html create mode 100644 doc/tmp/rubycritic/spec/controllers/disciplinas_controller_spec_html.html create mode 100644 doc/tmp/rubycritic/spec/controllers/faq_controller_spec_html.html create mode 100644 doc/tmp/rubycritic/spec/controllers/home_controller_spec_html.html create mode 100644 doc/tmp/rubycritic/spec/controllers/monitorias_controller_spec_html.html create mode 100644 doc/tmp/rubycritic/spec/controllers/professors_controller_spec_html.html create mode 100644 doc/tmp/rubycritic/spec/controllers/reset_senhas_controller_spec_html.html create mode 100644 doc/tmp/rubycritic/spec/controllers/sessions_controller_spec_html.html create mode 100644 doc/tmp/rubycritic/spec/controllers/sobre_controller_spec_html.html create mode 100644 doc/tmp/rubycritic/spec/controllers/tarefas_controller_spec_html.html create mode 100644 doc/tmp/rubycritic/spec/controllers/turmas_controller_spec_html.html create mode 100644 doc/tmp/rubycritic/spec/controllers/users_controller_spec_html.html create mode 100644 doc/tmp/rubycritic/spec/factories/atendimento_html.html create mode 100644 doc/tmp/rubycritic/spec/factories/atividade_html.html create mode 100644 doc/tmp/rubycritic/spec/factories/dados_bancarios_html.html create mode 100644 doc/tmp/rubycritic/spec/factories/disciplina_html.html create mode 100644 doc/tmp/rubycritic/spec/factories/monitoria_html.html create mode 100644 doc/tmp/rubycritic/spec/factories/motivo_html.html create mode 100644 doc/tmp/rubycritic/spec/factories/professor_html.html create mode 100644 doc/tmp/rubycritic/spec/factories/tarefa_html.html create mode 100644 doc/tmp/rubycritic/spec/factories/turma_html.html create mode 100644 doc/tmp/rubycritic/spec/factories/user_html.html create mode 100644 doc/tmp/rubycritic/spec/models/atendimento_spec_html.html create mode 100644 doc/tmp/rubycritic/spec/models/atividade_spec_html.html create mode 100644 doc/tmp/rubycritic/spec/models/dados_bancarios_spec_html.html create mode 100644 doc/tmp/rubycritic/spec/models/disciplina_spec_html.html create mode 100644 doc/tmp/rubycritic/spec/models/monitoria_spec_html.html create mode 100644 doc/tmp/rubycritic/spec/models/professor_spec_html.html create mode 100644 doc/tmp/rubycritic/spec/models/tarefa_spec_html.html create mode 100644 doc/tmp/rubycritic/spec/models/turma_spec_html.html create mode 100644 doc/tmp/rubycritic/spec/models/user_spec_html.html create mode 100644 doc/tmp/rubycritic/spec/rails_helper_html.html create mode 100644 doc/tmp/rubycritic/spec/spec_helper_html.html diff --git a/Gemfile b/Gemfile index c9ad9457..1b8bb41b 100644 --- a/Gemfile +++ b/Gemfile @@ -53,6 +53,9 @@ gem 'jquery-rails' # Uses nokogiri gem gem 'nokogiri' + + gem 'cycromatic' + group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] diff --git a/Gemfile.lock b/Gemfile.lock index be4b295d..cafb2ee8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -20,43 +20,43 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (5.2.5) - actionpack (= 5.2.5) + actioncable (5.2.6) + actionpack (= 5.2.6) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailer (5.2.5) - actionpack (= 5.2.5) - actionview (= 5.2.5) - activejob (= 5.2.5) + actionmailer (5.2.6) + actionpack (= 5.2.6) + actionview (= 5.2.6) + activejob (= 5.2.6) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.2.5) - actionview (= 5.2.5) - activesupport (= 5.2.5) + actionpack (5.2.6) + actionview (= 5.2.6) + activesupport (= 5.2.6) rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.2.5) - activesupport (= 5.2.5) + actionview (5.2.6) + activesupport (= 5.2.6) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.2.5) - activesupport (= 5.2.5) + activejob (5.2.6) + activesupport (= 5.2.6) globalid (>= 0.3.6) - activemodel (5.2.5) - activesupport (= 5.2.5) - activerecord (5.2.5) - activemodel (= 5.2.5) - activesupport (= 5.2.5) + activemodel (5.2.6) + activesupport (= 5.2.6) + activerecord (5.2.6) + activemodel (= 5.2.6) + activesupport (= 5.2.6) arel (>= 9.0) - activestorage (5.2.5) - actionpack (= 5.2.5) - activerecord (= 5.2.5) + activestorage (5.2.6) + actionpack (= 5.2.6) + activerecord (= 5.2.6) marcel (~> 1.0.0) - activesupport (5.2.5) + activesupport (5.2.6) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) @@ -66,8 +66,8 @@ GEM arel (9.0.0) arrayfields (4.9.2) ast (2.4.2) - autoprefixer-rails (10.2.4.0) - execjs + autoprefixer-rails (10.2.5.0) + execjs (< 2.8.0) bcrypt (3.1.16) bindex (0.8.1) bootsnap (1.7.5) @@ -148,21 +148,24 @@ GEM cucumber-core (~> 8.0, >= 8.0.1) cucumber-cucumber-expressions (~> 10.3, >= 10.3.0) cucumber-messages (~> 13.0, >= 13.0.1) + cycromatic (0.1.3) + parser (~> 2.3) + rainbow (~> 2.1) database_cleaner (2.0.1) database_cleaner-active_record (~> 2.0.0) - database_cleaner-active_record (2.0.0) + database_cleaner-active_record (2.0.1) activerecord (>= 5.a) database_cleaner-core (~> 2.0.0) database_cleaner-core (2.0.1) diff-lcs (1.4.4) - docile (1.3.5) + docile (1.4.0) erubi (1.10.0) erubis (2.7.0) execjs (2.7.0) - factory_bot (6.1.0) + factory_bot (6.2.0) activesupport (>= 5.0.0) - factory_bot_rails (6.1.0) - factory_bot (~> 6.1.0) + factory_bot_rails (6.2.0) + factory_bot (~> 6.2.0) railties (>= 5.0.0) fattr (2.4.0) ffi (1.15.0) @@ -179,7 +182,7 @@ GEM formatador (0.2.5) globalid (0.4.2) activesupport (>= 4.2.0) - guard (2.16.2) + guard (2.17.0) formatador (>= 0.2.4) listen (>= 2.7, < 4.0) lumberjack (>= 1.0.12, < 2.0) @@ -244,21 +247,23 @@ GEM mime-types-data (~> 3.2015) mime-types-data (3.2021.0225) mini_mime (1.1.0) + mini_portile2 (2.5.1) minitest (5.14.4) msgpack (1.4.2) multi_json (1.15.0) multi_test (0.1.2) nenv (0.3.0) nio4r (2.5.7) - nokogiri (1.11.3-x64-mingw32) - racc (>= 1.4) - nokogiri (1.11.3-x86_64-linux) + nokogiri (1.11.4) + mini_portile2 (~> 2.5.0) + racc (~> 1.4) + nokogiri (1.11.4-x64-mingw32) racc (~> 1.4) notiffany (0.1.3) nenv (~> 0.1) shellany (~> 0.0) parallel (1.20.1) - parser (3.0.1.1) + parser (2.7.2.0) ast (~> 2.4.1) path_expander (1.1.0) pg (1.2.3) @@ -272,7 +277,7 @@ GEM pry (0.14.1) coderay (~> 1.1) method_source (~> 1.0) - psych (3.3.1) + psych (3.3.2) public_suffix (4.0.6) puma (3.12.6) racc (1.5.2) @@ -280,18 +285,18 @@ GEM rack-test (1.1.0) rack (>= 1.0, < 3) railroady (1.5.3) - rails (5.2.5) - actioncable (= 5.2.5) - actionmailer (= 5.2.5) - actionpack (= 5.2.5) - actionview (= 5.2.5) - activejob (= 5.2.5) - activemodel (= 5.2.5) - activerecord (= 5.2.5) - activestorage (= 5.2.5) - activesupport (= 5.2.5) + rails (5.2.6) + actioncable (= 5.2.6) + actionmailer (= 5.2.6) + actionpack (= 5.2.6) + actionview (= 5.2.6) + activejob (= 5.2.6) + activemodel (= 5.2.6) + activerecord (= 5.2.6) + activestorage (= 5.2.6) + activesupport (= 5.2.6) bundler (>= 1.3.0) - railties (= 5.2.5) + railties (= 5.2.6) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) @@ -302,29 +307,30 @@ GEM nokogiri (>= 1.6) rails-html-sanitizer (1.3.0) loofah (~> 2.3) - rails_best_practices (1.20.0) + rails_best_practices (1.20.1) activesupport - code_analyzer (>= 0.5.1) + code_analyzer (>= 0.5.2) erubis i18n json require_all (~> 3.0) ruby-progressbar - railties (5.2.5) - actionpack (= 5.2.5) - activesupport (= 5.2.5) + railties (5.2.6) + actionpack (= 5.2.6) + activesupport (= 5.2.6) method_source rake (>= 0.8.7) thor (>= 0.19.0, < 2.0) - rainbow (3.0.0) + rainbow (2.2.2) + rake rake (13.0.3) - rb-fsevent (0.10.4) + rb-fsevent (0.11.0) rb-inotify (0.10.1) ffi (~> 1.0) redcard (1.1.0) - reek (6.0.4) + reek (6.0.2) kwalify (~> 0.7.0) - parser (~> 3.0.0) + parser (>= 2.5.0.0, < 2.8, != 2.5.1.1) psych (~> 3.1) rainbow (>= 2.0, < 4.0) regexp_parser (2.1.1) @@ -354,8 +360,8 @@ GEM rspec-support (3.10.2) ruby-progressbar (1.11.0) ruby_dep (1.5.0) - ruby_parser (3.15.1) - sexp_processor (~> 4.9) + ruby_parser (3.16.0) + sexp_processor (~> 4.15, >= 4.15.1) rubyzip (2.3.0) sass (3.7.4) sass-listen (~> 4.0.0) @@ -381,7 +387,7 @@ GEM selenium-webdriver (3.142.7) childprocess (>= 0.5, < 4.0) rubyzip (>= 1.2.2) - sexp_processor (4.15.2) + sexp_processor (4.15.3) shellany (0.0.1) simplecov (0.21.2) docile (~> 1.1) @@ -443,6 +449,7 @@ DEPENDENCIES coffee-rails (~> 4.2) cucumber-rails cucumber-rails-training-wheels + cycromatic database_cleaner factory_bot_rails guard-rspec diff --git a/app/controllers/disciplinas_controller.rb b/app/controllers/disciplinas_controller.rb index 985f2fa5..dc38d254 100644 --- a/app/controllers/disciplinas_controller.rb +++ b/app/controllers/disciplinas_controller.rb @@ -3,10 +3,24 @@ class DisciplinasController < ApplicationController before_action :is_admin, only: [:edit, :new, :create, :update, :destroy] before_action :logged_in + + ## + # Método que instancia um novo objeto de disciplina + # + # Método sem parametros + # + # Retorna uma nova instancia de disciplina def new @disciplina = Disciplina.new end + + ## + # Método que salva uma nova disciplina no banco de dados + # + # Método sem parametros + # + # Retorna para a view de dashboard, caso consiga salvar a disciplina. Caso contrário, retorna uma mensagem de erro. def create @disciplina = Disciplina.new disciplina_params @@ -18,8 +32,20 @@ def create end end - def edit; end + ## + # Método que edita uma disciplina. + # + def edit + + end + + ## + # Método para atualizar uma disciplina. + # + # Método recebe as informações que devem ser alteradas/mantidas na disciplina. + # + # Retorna para a view de dashboard de disciplinas se a atualização foi bem sucedida (parâmetros válidos). Caso contrário mostra uma mensagem de erro e renderiza a view de edição de disciplinas. def update if @disciplina.update disciplina_params redirect_to dashboard_disciplinas_path, notice: "Disciplina atualizada!" @@ -29,6 +55,14 @@ def update end end + ## + # Método que exclui uma disciplina do banco de dados. + # + # O Método procura e apaga a disciplina das turmas e monitorias das quais ela pertence, e depois apaga a disciplina. Funciona como um Cascade. + # + # Parâmetro: Código da disciplina . + # + # Redireciona para a view do dashboard de disciplinas após apagar tudo, caso a remoção foi bem sucedida, com uma mensagem de disciplina removida. def destroy Turma.find_each do |t| if t.fk_cod_disciplina == @disciplina.cod_disciplina @@ -45,24 +79,48 @@ def destroy end private + ## + # Método que especifica e filtra os parâmetros da disciplina. + # + # O método recebe parâmetros arbitrários e filtra todos os não permitidos + # + # Retorna quais são os parâmetros permitidos para uma disciplina. def disciplina_params params.require(:disciplina).permit(:nome, :fk_tipo_disciplina_id, :c_prat, :c_teor, :c_est, :c_ext, :monitoria) end + ## + # Método que localiza uma disciplina. + # + # Método com parâmetros: id. + # + # Retorna a disciplina com o id especificado. def find_disciplina @disciplina = Disciplina.find(params[:id]) end + ## + # Método que verifica se o usuário está logado. + # + # Método sem parâmetro. + # + # Redireciona para a view de login com a mensagem de aviso. def logged_in if !logged_in? - redirect_to new_session_path, notice: "Você precisa estar logado para acessar as Disciplinas" - end + redirect_to new_session_path, notice: "Você precisa estar logado para acessar as Disciplinas" + end end + ## + # Método que localiza uma disciplina. + # + # Parâmetro: id. + # + # Retorna a disciplina com o id especificado. def is_admin if !current_user.kind_of?(Admin) flash[:danger] = "Acesso negado." redirect_to dashboard_disciplinas_path end end -end +end \ No newline at end of file diff --git a/app/models/disciplina.rb b/app/models/disciplina.rb index 10b3ed35..2aaa58e4 100644 --- a/app/models/disciplina.rb +++ b/app/models/disciplina.rb @@ -1,16 +1,33 @@ class Disciplina < ApplicationRecord + + ## + # Método estático que retorna os tipos das diciplinas + # + # Retorna o tipo da disciplina + # def self.all_tipos return [['Obrigatória', 1], ['Optativa', 2]] end + ## + # Método estático para achar todas as disciplinas + # + # Retorna uma lista de todas as disciplinas, ordenadas por nome + # def self.all_disciplinas order(:nome).all end + ## + # Método estático para achar todas as disciplinas que permitem monitoria + # + # Retorna uma lista de todas as disciplinas que possuem o campo monitoria como true + # def self.com_monitoria return where(monitoria: true) + end - + validates_presence_of :nome validates_presence_of :fk_tipo_disciplina_id validates_presence_of :c_prat diff --git a/cyclomatic_disciplina.txt b/cyclomatic_disciplina.txt new file mode 100644 index 0000000000000000000000000000000000000000..e0f04ea92fb31bf4dc41c3def9f8a8940a4d9d4b GIT binary patch literal 1154 zcmcJP%?iRW5QOJi!B;a996;CP)(yFxs>P|SK)nd zvc<<^*_0?A7r&*;4utnq6>{<2vIwa09PB%}LSu`{zLPy>25QW%+2E`$yd6$A__o>x I-0!>a1}(eP#{d8T literal 0 HcmV?d00001 diff --git a/cyclomatic_result.txt b/cyclomatic_result.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f410d66de7a1c5081d72c8122fdc979d7d42def GIT binary patch literal 81966 zcmeHQ+j1Va4gPPFnY>4P(^v;9wr}zvosLGfl|+qgIg*{kFW(m5QZPXhO9IQ?Ty!v= zPLudwU`gT(@Z10X=jQa0{(OIWbNc0UbNWDkZcpz{kMv*C-@H5B(cj&iKGFZ*)8Ae% z|Mr@GbK5-ikJH2H_34|_Kk3)^L>0gJeWCZS)2q`N{mt3wyVJK%l(+N5d*D6ae0?iF zXVCaW?|V;giT8YXTJzh}ds^uS`Zuh!{S|Y%U!|X1JC5d1aQS8J^Pi zfMcDd=&{EP$I>z+D`bm6X1LZi;?iLwX85jIi|0#rW3v`B{72808OoKKsqQZWd+0P` zfY+qg$gtizGFG21d$_PJU7z^W5p8}$KE2HR*Z0%It$(tpIoKmG(DLy9L@Rut%neV0 z(@U4-@Nm*&X>j$#O5XLQnok+|f}_16;pO4mRB;>*HO=)M(movOPNPh0<^xhD! zl>L8r;(6(`0lw3Oz4@8`hxqA+BB;-_YGnSe$Q~cJyT8yXk%gwcMQscGAhk#BEh>q~ zL+h2Iss+ARhny*@DIb?rGG|m+v{Qb0dUlx3qT=;P?~&HN{s#7(%BxN7K71sJyFdLz zXYxpYAP4v-*sf;>${ltdyYZ2@A!=TKhvO_L`=UBuIis~hTZ-?47-sgt6r>cI^8{`Ap8$nK<|79AJY$U4eH=Xyn zT51x1#s0M3{y0nBJDL0*@Wsy#jBn8Od7wYHUwxG(6)6fiTVlLp&H>f~u>icK_68{m zvSW{@+p~7@d8t==|J#Ua~G}e1fZ-L$*I%Max-;l2t zhr}!Md7$P!`ZemmExU{rKAiq;TGdZ68@*7?6j?yk(E~l|Sm)asecSNz!73*raM=GCzW*#HO zl1puKe>g}gX6-;*f$~@bd*{T@hc(t-2lMkNbt*+rHfi_sLiU>G+ECN~@{~KkYo)#k zWE%bw8P<{eT57nb+v;C)`$Vl5scK-emMyiBtj=mjstKp*G1!t16a}M_-H!%Xa_v@T z8=q2op(i%k-NsFNIJ=MD#;cUk)Mc~vOt#k&18R4oPMM%@p@}(;F&hqw(GMN0agGtxMZuXmcXtrKKi8v zfY*3#s$coI)X|!!yYJ(a@+jmRwPbiY?LMCK5^+y`D@bGCE66O$BM&y}v#Utm;alp5 zj{Tcl39OaPQg}GXe9#{Mc{s3-_QYBq`q^7vIJ$%$4yEp2kmet85~U|jm81R7yS6Y_ z2kjXw1N^+)XXJzS+K_y5Wc}rDYkT&?l3Cm0UP))fbKVZ*Ij+7vV-2#`^m4a$w2G`f zo|Cb@d8s*`tk1rJQg6~^npJPC>!`KnVySEF%_Xn7mSImFIa3*(eXir?XMDBe{M?8a z$NlmNt`+aSkF%P|G4p6me!a9(F7?Ll`K|Ozok>xqEfcbHfCs?rL^$;46C6TTiv7&t6e~XWe4pp5o}e`*iJZd%tvF7|Vn47mfveD zC9X*@o!>}`5xL;LC8VEkr`0vc@+5Pf&2$itL5tUbCv{lMNVj~)ns%m%%H&7tRY0e3YpuMq*QWwWLu3yt1dN8ZZr*=B)mPwm?x}~0 znE)Mcp-)BDQZQYQ_er(s^8GXk^=mUw0+;jS?~+|on8v#iqfcg8B=f&P|q9*&Yn6-U_*Y%_4}j)adsS2Wu! zXP&my!$5!Q<+|Elv(>k2mOep~Za4+{+c)Ib;0w}zATxkIl{QX0hjeaQt~k=&vgRJ> zZ;b!Br=052UH2e7U1*)+=&bk9(z0?e;wU{s8{PIK*~drDi?sRaetg&y1^QdcpY1q+ zrJV`%w;E~JyPupbz!H?YqGu!f=|Ib|wq#n)vLF9hE7q@9+Gbwt^Z7H}%2=T7J+1BO z49`4yqg5r3;8pf&P~60hV(So_Xw<)7V3&5d#GJTRO!S)l%>L_Vn4a zpScdXR?**!(^}+6uCQazrJo>=Px9h@#7C=UzLzR)P22gz>Ht zI9P%HhW?igx52x=E$Z3YDF^ynpuYwBTcE#{UxDHJZi&IxdV70i-fO{1&gcPUT)zAs z@Wp}thR!ddAbStSdm4fM7U*w*{${~wla+6~K3XWx=E~YUyOu++?Vsnz^X)w@+x9Ea z-%>st=x=qd+^^%-HOF=aNRw4`S+%^p&#SF8+Upd4ZtW9wb>4GpucbEX_~qMs<+HvU zeC4wi1hzH4f&PYxyflTH?=xV3c>;EHqS7+A6RbTwv2u{zTf49HtReSpk6D52n%Hq; zJS!-BL4p2e!7bz-sodv4f0JK$Z70q>*1+Bc_48qkZSMxGSsXu)Ql~sP0DfM9{)YQd zZ7gE9$NoK^&0OSEcABaV^fy$P>^^$i4wlh*pug#}h}-ry(BEv|V%PT^Rv^&d>^|AI zUxEHs=V|yZl?7XF*3-$Gf}RM_K9lC*AoD@Hta&(abQ$Px{n}OOi39!3BV+Qnb=({1 zZ(0_|9fw>^vELcUz2K4k+Me~z2#+V4r1;z~!@8 zL+)V9znP^fE8ctW`g+}A&lR+pqeeZ@-_}ky(BFU|ALwrhzpkyF>o{#zD;DT)>xhG} zkH~HU{q1oQ{Z8}m>=`qLQlP(CD%yw$GEyD>t(=&u_f^|_+(2q)m%Nk%{SCLCK0eKo z{Y}=jc+ag?G|=C$d%*O4PqO%d`rZ8=k(>{;Plnj(bFa>R$IMP! z>S3V2rE}LYt$Y0%yJqQA73=lL9#@tNdyi-vpWKZ)Q=(t(4bwhuL1QcBG0@-Stm?MY zgFggLvHmosfju^B%bDt&>yB`szvXW&)QDCi42Oc`!z=pY;gkp&3i&+ zZ!gf_0{xA@tKyZU*;oTN-q*iY(T{Xl|Lyl4X1JBHfW6;7!!yS^f&Qj>0z`H*`^(w- zHPw>tDbG(|n8JLE{RZj`|IxF7{`URSyV34UV(&bdVXRB?>t4{}@{0#ODf4japKPGN z$xOm~l8E5zNHNgg+FQl`eGT-t=gW670{!i!^6jp@Y-5Xp*Y?^1{VmYn0{yMD>0I|H zG1%mMb^3any)y6h5GCh8e|w-fU(Ux7Tv9zw1Z)#dI zYX3fJ?^t(kUL3r``9_rXHu$pMu_r7mRs5ZGe0>jGk2`6c6}omjg@8x{7_Ue2oUJWe z&>Oc+OIRq+zP)zSMY9wf70&YuT*z-p!uwwwYbSL_w!ic=3Dw9}U-0wFo!4`R74q|u z{>e1xA5Ypfj?$j_tHslbKo`$hl$wokONh}|By)JC#8s~zh%;5Dzu`4UU6 zeP!GDl+tUj$86&!J)GS~Z{t-)=Yb2UPt$MP+rWji+@jU=8&NH$%mWwF?vs7{mGUS= z7`319e1Xx&bJj;#ksD>)WVfGI>a(kmcZf$`Rjvd+&X(hPILLg^E^8hR?4tu0vOfu3 zdg8!^^vIa}ZEep27gF=E96{$;(|+eqPOJ1~x{RAWS)ZLpsW*WOY2Ufr1Zz=aH4$hwX$kpa^U9evV6{*HZ$HA0rpf``^Em%o{( z&)xAosn*?>J!!Ak9ronXW^o$zlri$ON}E^7XY~AC{({f4?B}ul!X5HD+mTP(>AxW? z-Us>v1Q*;{&m2s?IW`AK)qMyI?^ZQB`3Ps{JMl@eni zGM(R^BA3@B&+n)sf*aG2i1j??e7O3&ca(i(-Q z&qvOS*!y1o^{~YWT*wwDseeLcZ!d5m0~a!IAxH5|84I+%r?n`jj}X__(;Vw)Rmmeb zmX_gSxjj|(zmDMA-pRDzWtrJu&T<16QhrTjHh=J<4avB~ckYNZQ1b*f&s(Z6YO={$ z5$lrd??Q|1((U2amrA|!tGzw)B=3Iax-P1~X>zBm+3v+@EeA-5NcFtPo?PpQ6ddgp z3Ga@gl2!JJQhgm!^yTTh(-=>{%Wg9=A=?!7yCZsELo<7s6aU&UDTsm%d z+nFBl!=(99dyC!y^3Zyvm}~@J8*YPle_K4nwNrk%Ag&yvvk$cD$K|9SIz1U5x{VK^ zx7~-f*A}>tfeRV9kbw)CI`**E`D=HWDNFNu?5o!7D9|5#nVKiYLq-_5kkHb1OBWD1 zs{MYL*L%wRJ8&VP5r}yM7ZUlAK6kF=8=MVFX~I4RF65S7tm`&`3mLeOdQW+abj{YG zEa;80_GF)yuuz_T`!*}?*SF^R@y(Z>-Q2ccm;iiF9_!c@XjPg%NA4iDv!L1@pcd!n zQF@xdg}kG>3#RcAIgffSbvFVvC>y?k|D0-H7Pye(s-}OJ^L^s>SybQba|!M9BWY^y zVBroK@BxpKsaczhH3lwZ9|z5|N8AHK#2>hjBYmkY;`61JVyjAfPK9T}Q1-fypNAGf*(|o7*Bw<8(mi0rDPNvC%J5nb z6#JzaHDowkGq7oc|2^u+2XblaRQq|gPtCnZN+DKMswPXDTycWfC1&AfrZe_Od zDWw;BVw2r%+@y!I=d;^*l`WHNR!3`|xgQ^=lt&@LsQrXz z2FJ&9)<;;88)e*Nx1Uz(v#XGIh(}&kuEgF0^>C1L{`UCK!-0Kt;6nE6n58EUTu6_M z$=}xYEN~%v9w*0|_NtwnP3_Bc88-(mWPi8vzSc7A`Myx5GV(6Dj+>teT*!QHezbq= z+3fe@_^!f;a;Z0V&u^t)`kKInED_FT@YCe8{rl1Kmt4=V#+LF~=2B17&*8w;9M*dO z@^`bV(7NUO(&rBLo>XNm8hX7a?e)6Do?O~2PNSYO#=wQdy@QX%ENk173|vU7B||+P zv!|F1PL@nZ0F=M;+8OyQc(m1RpvdL-VEVt(TYVvozWw^Qh>q$TQSwO-^{qR^K3;!k z-D12_zA#$9cb~5PZA&~yM!exY-AYH73al2{P2fTXE+k7BI}p|Z8DB`b(`MG*l3PYYqOaiqiY5(q&&%-(epkb$_re`bPu+zb(MP1?q2>c zxOplP##^BJX&q+}|oCvX-R39vAX| DPTClZ literal 0 HcmV?d00001 diff --git a/doc/3_1_7.html b/doc/3_1_7.html index 85d1e9d1..894b52fc 100644 --- a/doc/3_1_7.html +++ b/doc/3_1_7.html @@ -21,8 +21,6 @@ - -