Skip to content

Commit

Permalink
Merge pull request #91 from fga-gpp-mds/development
Browse files Browse the repository at this point in the history
Release Sprint 10
  • Loading branch information
roginaldosemog authored May 22, 2018
2 parents 6ba2f22 + 81ecded commit eed8ccb
Show file tree
Hide file tree
Showing 48 changed files with 1,116 additions and 58 deletions.
1 change: 1 addition & 0 deletions .coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
service_name: travis-ci
12 changes: 11 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
sudo: required

language: ruby
rvm:
- 2.3.1

before_script:
- psql -c 'create database "inclucare-api_test";' -U postgres

language: ruby
script:
- bundle exec rake

after_success:
- CI=true TRAVIS=true coveralls --verboose
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ gem 'devise_token_auth'

group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'coveralls', require: false
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
gem 'simplecov'
end

group :development do
Expand Down
34 changes: 34 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ GEM
case_transform (0.2)
activesupport
concurrent-ruby (1.0.5)
coveralls (0.7.1)
multi_json (~> 1.3)
rest-client
simplecov (>= 0.7)
term-ansicolor
thor
crass (1.0.4)
devise (4.4.3)
bcrypt (~> 3.0)
Expand All @@ -60,13 +66,19 @@ GEM
devise_token_auth (0.1.43)
devise (> 3.5.2, < 4.5)
rails (< 6)
docile (1.3.0)
domain_name (0.5.20180417)
unf (>= 0.0.5, < 1.0.0)
erubi (1.7.1)
ffi (1.9.23)
globalid (0.4.1)
activesupport (>= 4.2.0)
hashie (3.5.7)
http-cookie (1.0.3)
domain_name (~> 0.5)
i18n (1.0.0)
concurrent-ruby (~> 1.0)
json (2.1.0)
jsonapi-renderer (0.2.0)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
Expand All @@ -78,9 +90,14 @@ GEM
mail (2.7.0)
mini_mime (>= 0.1.1)
method_source (0.9.0)
mime-types (3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mini_mime (1.0.0)
mini_portile2 (2.3.0)
minitest (5.11.3)
multi_json (1.13.1)
netrc (0.11.0)
nio4r (2.3.0)
nokogiri (1.8.2)
mini_portile2 (~> 2.3.0)
Expand Down Expand Up @@ -124,7 +141,16 @@ GEM
responders (2.4.0)
actionpack (>= 4.2.0, < 5.3)
railties (>= 4.2.0, < 5.3)
rest-client (2.0.2)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
ruby_dep (1.5.0)
simplecov (0.16.1)
docile (~> 1.1)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
spring (2.0.2)
activesupport (>= 4.2)
spring-watcher-listen (2.0.1)
Expand All @@ -137,10 +163,16 @@ GEM
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
term-ansicolor (1.6.0)
tins (~> 1.0)
thor (0.20.0)
thread_safe (0.3.6)
tins (1.16.3)
tzinfo (1.2.5)
thread_safe (~> 0.1)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.5)
warden (1.2.7)
rack (>= 1.0)
websocket-driver (0.6.5)
Expand All @@ -153,13 +185,15 @@ PLATFORMS
DEPENDENCIES
active_model_serializers (~> 0.10.0)
byebug
coveralls
devise_token_auth
listen (>= 3.0.5, < 3.2)
omniauth
pg (>= 0.18, < 2.0)
puma (~> 3.7)
rack-cors
rails (~> 5.1.6)
simplecov
spring
spring-watcher-listen (~> 2.0.0)
tzinfo-data
Expand Down
33 changes: 21 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@

# IncluCare

<p align="center">
<img src="/docs/images/incluCareLogo.png" width="300" height="300"/>
</p>
<p align="center">
<p align="center"> </br>

<p align="center">
<a href="https://codeclimate.com/github/fga-gpp-mds/2018.1-IncluCare_API"><img src="https://codeclimate.com/github/fga-gpp-mds/2018.1-IncluCare_API/badges/gpa.svg"></a>
<a href="https://travis-ci.org/fga-gpp-mds/2018.1-IncluCare_API/"><img src="https://api.travis-ci.org/fga-gpp-mds/2018.1-IncluCare_API.svg?branch=master"></a>
<a href='https://coveralls.io/github/fga-gpp-mds/2018.1-IncluCare_API?branch=development'><img src='https://coveralls.io/repos/github/fga-gpp-mds/2018.1-IncluCare_API/badge.svg?branch=development' alt='Coverage Status' /></a>


</p>


## Sobre o Projeto

<p>O Incluare é uma aplicação para auxiliar a equipe educacional no acompanhamento e triagem de estudantes com dificuldade de apredizagem.
O objetivo do IncluCare é auxiliar a equipe educacional resposável, de escolas púlbicas, pela triagem e acompanhamento de estudantes que apresentam algum tipo de dificuldade de aprendizagem, facilitando e tornando estes processos mais rápidos.</p>
<p>O Incluare é uma aplicação para auxiliar a equipe educacional no acompanhamento e triagem de estudantes com dificuldade de aprendizagem.
O objetivo do IncluCare é auxiliar a equipe educacional responsável, de escolas públicas, pela triagem e acompanhamento de estudantes que apresentam algum tipo de dificuldade de aprendizagem, facilitando e tornando estes processos mais rápidos.</p>

## Executando o projeto

Expand All @@ -24,27 +30,30 @@ Para executar este projeto em uma máquina local, é necessário estar de prefer

1. Deve-se clonar este repositório com o seguinte comando:

<pre><code> $ git clone https://github.com/fga-gpp-mds/2018.1-IncluCare.git </code></pre>
<pre><code> $ git clone https://github.com/fga-gpp-mds/2018.1-IncluCare_API.git </code></pre>

2. Entre no diretório do projeto:

<pre><code>$ cd 2018.1-IncluCare</code></pre>
<pre><code>$ cd 2018.1-IncluCare_API</code></pre>

3. Faça a instalação das dependências do projeto:
<pre><code>bundle install</code></pre>

3. Inicie a aplicação com o seguinte comando:
4. Inicie a aplicação com o seguinte comando:

<pre><code>$ rails s</code></pre>

4. Acesse a página através através de um browser:
5. Acesse a página através de um browser:
<pre><code>http://localhost:3000</code></pre>

## Executando testes

## Contribuindo com o preojeto
## Contribuindo com o projeto

Para contribuir com projeto, por favor, leia [código de conduta](https://github.com/fga-gpp-mds/2018.1-IncluCare/blob/master/CODE_OF_CONDUCT.md) e [contribuição](https://github.com/fga-gpp-mds/2018.1-IncluCare/blob/master/CONTRIBUTING.md).
Para contribuir com projeto, por favor, leia [código de conduta](https://github.com/fga-gpp-mds/2018.1-IncluCare_API/blob/master/CODE_OF_CONDUCT.md) e [contribuição](https://github.com/fga-gpp-mds/2018.1-IncluCare_API/blob/master/CONTRIBUTING.md).

## Documentação

A documentação desse projeto pode ser acessada por [aqui](https://github.com/fga-gpp-mds/2018.1-IncluCare/tree/docs/docs)

A documentação do projeto pode ser acessada por [aqui](https://github.com/fga-gpp-mds/2018.1-IncluCare_API/tree/docs/docs)

----------------------------
#### As issues relacionadas ao projeto podem ser acessadas [aqui](https://github.com/fga-gpp-mds/2018.1-IncluCare_API/issues)
9 changes: 9 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
class ApplicationController < ActionController::API
include DeviseTokenAuth::Concerns::SetUserByToken

before_action :configure_permitted_parameters, if: :devise_controller?

protected

def configure_permitted_parameters
devise_parameter_sanitizer.permit(:sign_up, keys: [:name])
devise_parameter_sanitizer.permit(:account_update, keys: [:name])
end
end
51 changes: 51 additions & 0 deletions app/controllers/daily_logs_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
class DailyLogsController < ApplicationController
before_action :set_daily_log, only: [:show, :update, :destroy]

# GET /daily_logs
def index
@daily_logs = DailyLog.all

render json: @daily_logs
end

# GET /daily_logs/1
def show
render json: @daily_log
end

# POST /daily_logs
def create
@daily_log = DailyLog.new(daily_log_params)

if @daily_log.save
render json: @daily_log, status: :created, location: @daily_log
else
render json: @daily_log.errors, status: :unprocessable_entity
end
end

# PATCH/PUT /daily_logs/1
def update
if @daily_log.update(daily_log_params)
render json: @daily_log
else
render json: @daily_log.errors, status: :unprocessable_entity
end
end

# DELETE /daily_logs/1
def destroy
@daily_log.destroy
end

private
# Use callbacks to share common setup or constraints between actions.
def set_daily_log
@daily_log = DailyLog.find(params[:id])
end

# Only allow a trusted parameter "white list" through.
def daily_log_params
params.require(:daily_log).permit(:date, :activity, :note, :student_id)
end
end
2 changes: 1 addition & 1 deletion app/controllers/students_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ def set_student

# Only allow a trusted parameter "white list" through.
def student_params
params.require(:student).permit(:name, :birth_date, :age, :nationality, :year, :student_class, :shift, :father_name, :mother_name, :address, :parent_telephone, :parent_email)
params.require(:student).permit(:name, :birth_date, :age, :nationality, :year, :student_class, :shift, :father_name, :mother_name, :address, :parent_telephone, :parent_email, :teacher_name)
end
end
9 changes: 9 additions & 0 deletions app/models/daily_log.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class DailyLog < ApplicationRecord
belongs_to :student

validates_presence_of :note, presence: true, message: 'can t be left blank'
validates_presence_of :activity, presence: true, message: 'can t be left blank'
validates_presence_of :date, presence: true, message: 'can t be left blank'
validates_presence_of :student_id, presence: true, message: 'can t be left blank'

end
25 changes: 25 additions & 0 deletions app/models/student.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,27 @@
class Student < ApplicationRecord
validates_presence_of :name, presence: true, message: 'can t be left blank'
validates_presence_of :birth_date, presence: true, message: 'can t be left blank'
validates_presence_of :age, presence: true, message: 'can t be left blank'
validates_presence_of :nationality, presence: true, message: 'can t be left blank'
validates_presence_of :year, presence: true, message: 'can t be left blank'
validates_presence_of :student_class, presence: true, message: 'can t be left blank'
validates_presence_of :shift, presence: true, message: 'can t be left blank'
validates_presence_of :father_name, presence: true, message: 'can t be left blank'
validates_presence_of :mother_name, presence: true, message: 'can t be left blank'
validates_presence_of :address, presence: true, message: 'can t be left blank'
validates_presence_of :parent_telephone, presence: true, length: { is: 11 }, message: 'can t be left blank'
validates_presence_of :parent_email, presence: true, email: true, message: 'can t be left blank'
validates_presence_of :teacher_name, presence: true, message: 'can t be left blank'

validates_length_of :name, minimum: 5, message: 'at least 5 characters'
validates_length_of :nationality, maximum: 14, message: 'deve possuir no maximo 15 caracteres'
validates_length_of :year, maximum: 2, message: 'deve possuir no maximo 3 digitos'
validates_length_of :student_class, minimum: 1, message: 'at least 1 characters'
validates_length_of :shift, minimum: 1, message: 'at least 1 characters'
validates_length_of :father_name, minimum: 5, message: 'at least 5 characters'
validates_length_of :mother_name,minimum: 5, message: 'at least 5 characters'
validates_length_of :address, minimum: 7, message: 'at least 7 characters'

validates_numericality_of :age, message: 'need to be number'
validates_numericality_of :parent_telephone, message: 'need to be number'
end
4 changes: 4 additions & 0 deletions app/serializers/daily_log_serializer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class DailyLogSerializer < ActiveModel::Serializer
attributes :id, :date, :activity, :note
has_one :student
end
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Rails.application.routes.draw do
resources :daily_logs
resources :team_members
resources :students
mount_devise_token_auth_for 'TeamMember', at: 'auth'
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20180511020236_add_teacher_name_to_student.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddTeacherNameToStudent < ActiveRecord::Migration[5.1]
def change
add_column :students, :teacher_name, :string
end
end
12 changes: 12 additions & 0 deletions db/migrate/20180516145233_create_daily_logs.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class CreateDailyLogs < ActiveRecord::Migration[5.1]
def change
create_table :daily_logs do |t|
t.date :date
t.text :activity
t.string :note
t.belongs_to :student, index: true

t.timestamps
end
end
end
13 changes: 12 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,21 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20180417212341) do
ActiveRecord::Schema.define(version: 20180516145233) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"

create_table "daily_logs", force: :cascade do |t|
t.date "date"
t.text "activity"
t.string "note"
t.bigint "student_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["student_id"], name: "index_daily_logs_on_student_id"
end

create_table "students", force: :cascade do |t|
t.string "name"
t.date "birth_date"
Expand All @@ -30,6 +40,7 @@
t.string "parent_email"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "teacher_name"
end

create_table "team_members", force: :cascade do |t|
Expand Down
12 changes: 9 additions & 3 deletions db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,21 @@
Student.create!(
name: "Aluno #{num}",
birth_date: "10/12/2010",
age: "8 anos",
age: "8",
nationality: "Brasileiro",
year: "2º ano",
year: "2",
student_class: "B",
shift: "VESPERTINO",
father_name: "Pai #{num}",
mother_name: "Mãe #{num}",
address: "Endereço #{num}",
parent_telephone: "99999999#{num}",
parent_email: "teste#{num}@email.com"
parent_email: "teste#{num}@email.com",
teacher_name: "Professor #{num}"
)
end
puts "Students seeded."

DailyLog.create!(date: "10/10/2010", activity: 'pescar', note: 'A', student_id: 1)
DailyLog.create!(date: "10/10/2010", activity: 'nadar', note: 'B', student_id: 2)
puts "DailyLogs seeded."
5 changes: 5 additions & 0 deletions debugDB.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
rake db:drop
rake db:create
rake db:create
rails s
Loading

0 comments on commit eed8ccb

Please sign in to comment.