Skip to content

Commit

Permalink
Make person controller work without time again, start writing initial…
Browse files Browse the repository at this point in the history
…izer that will enable the ptime connection when wanted, fix docker compose
  • Loading branch information
RandomTannenbaum committed Jul 30, 2024
1 parent 9f018bc commit 5a81213
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 10 deletions.
12 changes: 4 additions & 8 deletions app/controllers/people_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,14 @@ def show
@person = Person.includes(projects: :project_technologies,
person_roles: [:role, :person_role_level]).find(@person.id)

Ptime::PeopleEmployees.new.update_person_data(@person)
super
end

def new
@person = Ptime::PeopleEmployees.new.create_or_find(params[:ptime_employee_id])
redirect_to(@person)

# %w[DE EN FR].each do |language|
# @person.language_skills.push(LanguageSkill.new({ language: language, level: 'A1' }))
# end
# super
%w[DE EN FR].each do |language|
@person.language_skills.push(LanguageSkill.new({ language: language, level: 'A1' }))
end
super
end

def create
Expand Down
2 changes: 1 addition & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

module Skills
def self.ptime_available?
ActiveModel::Type::Boolean.new.cast(ENV.fetch('PTIME_API_ACCESSIBLE', true))
%w[true True 1].include?(ENV.fetch('PTIME_API_ACCESSIBLE', false))
end

class Application < Rails::Application
Expand Down
1 change: 1 addition & 0 deletions config/initializers/ptime_connector.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PeopleController.include Ptime::PtimeConnection if Skills.ptime_available?
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ services:
/bin/bash -c "
curl -fsSL https://deb.nodesource.com/setup_18.x | bash - &&
apt-get install -y nodejs &&
npm install -g yarn && yarn add nodemon esbuild && bin/assets &&
npm install -g yarn && bin/assets &&
sleep infinity"
volumes:
- ./:/myapp
Expand Down
18 changes: 18 additions & 0 deletions lib/ptime/ptime_connection.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module Ptime
module PtimeConnection
def show
return export if format_odt?

@person = Person.includes(projects: :project_technologies,
person_roles: [:role, :person_role_level]).find(@person.id)

Ptime::PeopleEmployees.new.update_person_data(@person)
super
end

def new
@person = Ptime::PeopleEmployees.new.create_or_find(params[:ptime_employee_id])
redirect_to(@person)
end
end
end

0 comments on commit 5a81213

Please sign in to comment.