Skip to content

twronski/hourslog

Repository files navigation

README

This README would normally document whatever steps are necessary to get the application up and running.

Things you may want to cover:

  • Ruby version

Description

Simple application to log work hours related to a project and type of activity
May be improved with validation process
May also include reports and statustics related to these logged hours

Generate Project with Docker - Linux

sudo docker run -it --rm --user "$(id -u):$(id -g)" -v "$PWD":/usr/src/app -w /usr/src/app ruby /bin/bash -c "gem install rails ; rails new testWindows --skip-bundle --database=postgresql"

Generate Project with Docker - Windows

docker run -it --rm -v ${pwd}:/usr/src/app -w /usr/src/app ruby /bin/bash -c "gem install rails ; rails new testWindows --skip-bundle --database=postgresql"

Setup Database

  • Setup database.yml (user: postgres and host: postgres)
  • create and migrate postgres database:
    • docker-compose run --rm app bundle exec rails db:create db:migrate

Setup Devise and Mailcatcher

Generate Devise User model

Generate Application Models

Reminder:

  • Use @xxx.destroy to delete all the dependent: destroy associamtions.

Roles

  • engineer
  • ct
  • pm
  • team_leader
  • ge_team_leader
  • admin
  • pmo

Visualize git topology in the terminal

git log --graph --decorate --oneline

Update remote branchs in local list

git fetch

Clone a remote branch and switch to it

`git checkout -b [branch name] origin/[branch name]

Alias zsh

alias docker-rails="docker-compose run --rm app bundle exec rails" alias docker-db-reset="docker-compose run --rm app bundle exec rails db:drop db:create db:migrate db:seed" alias docker-bundle="docker-compose run --rm app bundle install"

Useful Tips (new learning)

Date Time in Ruby

Date Time

Visual Studio Debug Rails

onebitcode - vs code degug rails - vs code oficial microsoft

Summary of git commands

Git Commands

Query last week working hours

  • HoursRecord.where(profile_id: 6, day: (Time.now.midnight - 6.day)..Time.now.midnight).sum("man_hour") -> Ultima semana

Query given day working hours

  • HoursRecord.where(profile_id: 6, day: "2019-08-07").sum("man_hour")
  • HoursRecord.where(status: ["rep_approved","rep_under_analysis"]).count

Yarn commands

yarn init yarn add @fortawesome/[email protected]

Atuaizar / Fazer rodar a aplicacao em outro PC

1 - docker-compose run --rm bundle install 2 - docker-compose run --rm bundle exec reails db:drop db:create db:migrate db:seed 3 - npm install or yarn install

yarn add @fortawesome/[email protected]

Some Migrations

  • docker-rails generate migration AddMainSkillProfile main_skill:references

Devise Invitable

Assets precompile

docker-compose run --rm app bundle exec rake assets:precompile

Credentials

docker-compose run --rm -e EDITOR=nano app bundle exec rails credentials:edit

Emet on Rails Visual Code

link

Create evaluations

u2.hours_records.select(:id, :project_id, :activity_id).distinct

Example of join table creation

rails g migration CreateJoinTableAuthorsBooks authors books

Some Models Generation

  • docker-rails generate scaffold Company name:string address:string profile:references
  • docker-rails generate scaffold ImprovementAction title:string description:text status:integer
  • docker-rails generate scaffold MainEquipment name:string
  • docker-rails generate migration addMainEquipmentToHoursRecord main_equipment:references
  • docker-rails generate scaffold DocTemplate title:string description:text
  • docker-rails generate scaffold AccessTemplate name:string description:text mandatory:boolean
  • docker-rails generate scaffold SuggestionBox name:string description:text status:integer
  • docker-rails generate scaffold Vote choice:integer votable:references{polymorphic}
  • docker-rails generate scaffold ProfileSubSkill profile:references sub_skill:references level:integer status:integer expiration_date:date
  • ``
  • ``
  • ``
  • ``
  • ``

Get evaluations for a profile_id (example with '3')

Evaluation.joins(:hours_records).where(:hours_records => {profile_id: 3})

  • Todo
    • Add next_action_deadline and review_count fields on hours_record model \
    • implement creation and update hooks for hours_record model \
    • Create application config itens \
      • Time_for CT review \
      • Time for 2nd review on \
      • Max_number_of_reviews
      • Max Days for providing report
      • Max weekly working hours
      • Max daily working hours
      • Max daily working extra hours
    • [] Create Validators
      • Date Validator
      • Hours Validator
      • Work Week Validator (need fix +- 6 days)
    • Download theme
    • Install theme (Udemy Jackson Pires)
    • Test HTML helpers
    • invitable devise
    • Complement Hour Log Model
    • Create approval view based on show (partial)
    • Test some validations
    • Growl Notifications
    • [] Implement Extra Hours Creation
      • [] Models
      • [] Views
      • [] Link with record creation
    • Add some models Evernote
      • Companies
      • Improvement Action
      • Evaluation
      • Documents
      • AccessTemplate
    • [] Enum otimizations
    • [] Eager load otimizations
    • [] Eager load
    • [] Seed with more real data
    • [] Implement roles access using pundit
    • [] Create Navigation
    • [] Will paginate
    • [] friendly_id
    • [] background_jobs
    • [] mailer
    • [] Helpers in html
    • Bootsrap styling * Buy Theme
    • [] Trabalhar mensagens de erros as notificações
    • [] Deployment

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published