diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 00000000..2b179307 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v12.22.1 \ No newline at end of file diff --git a/Gemfile b/Gemfile index 176e1d36..85056b10 100644 --- a/Gemfile +++ b/Gemfile @@ -37,7 +37,7 @@ gem 'jbuilder', '~> 2.0' gem 'sdoc', '~> 0.4.0', group: :doc # Use ActiveModel has_secure_password -gem 'bcrypt', '~> 3.1.7' +gem 'bcrypt', '3.1.15' # Use Unicorn as the app server # gem 'unicorn' diff --git a/Gemfile.lock b/Gemfile.lock index 368f6aed..4908c2a3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -50,7 +50,7 @@ GEM backburner (1.3.0) beaneater (~> 1.0) dante (> 0.1.5) - bcrypt (3.1.11) + bcrypt (3.1.15) beaneater (1.0.0) binding_of_caller (0.7.2) debug_inspector (>= 0.0.1) @@ -237,7 +237,7 @@ PLATFORMS DEPENDENCIES angular-rails-templates backburner - bcrypt (~> 3.1.7) + bcrypt (= 3.1.15) bootstrap byebug codeclimate-test-reporter diff --git a/app/services/backend_service.rb b/app/services/backend_service.rb index 8c427da7..67ca8ea2 100644 --- a/app/services/backend_service.rb +++ b/app/services/backend_service.rb @@ -172,38 +172,18 @@ def check_if_data_exists(data) data end + # Map only the necessary fields for Contacts model, comments after are the Elisa column # def map_contacts_data(data) data.map do |attrs| { - ticket_id: attrs[:string][0], - arrived: with_utc_offset(attrs[:string][1]), - time_in_queue: attrs[:string][2], - forwarded_to_agent: with_utc_offset(attrs[:string][3]), - answered: with_utc_offset(attrs[:string][4]), - call_ended: with_utc_offset(attrs[:string][5]), - after_call_ended: with_utc_offset(attrs[:string][6]), - total_response_time: attrs[:string][7], - total_handle_time: attrs[:string][8], - service_name: attrs[:string][9], - direction: attrs[:string][10], - contact_type: attrs[:string][11], - contact_information: attrs[:string][12], - agent_name: attrs[:string][13], - customer_id: attrs[:string][14], - contact_reason: attrs[:string][15], - information: attrs[:string][16], - ivr_feedback: attrs[:string][17], - category_of_recording: attrs[:string][18], - recorded: attrs[:string][19], - inserted_to_db: with_utc_offset(attrs[:string][20]), - task_count: attrs[:string][21], - task_time: attrs[:string][22], - processing_total_sum: attrs[:string][23], - subject: attrs[:string][24], - outbound_campaign_name: attrs[:string][25], - outbound_campaign_id: attrs[:string][26], - additional_info: attrs[:string][27], - destination: attrs[:string][28] + ticket_id: attrs[:string][0], # 21100 + arrived: with_utc_offset(attrs[:string][1]), # 21101 + forwarded_to_agent: with_utc_offset(attrs[:string][5]), # 21103 + answered: with_utc_offset(attrs[:string][6]), # 21102 + call_ended: with_utc_offset(attrs[:string][7]), # 21104 + after_call_ended: with_utc_offset(attrs[:string][8]), # 21105 + direction: attrs[:string][15], # 21108 + contact_type: attrs[:string][16], #21109 } end end diff --git a/docs/additional_documentation.md b/docs/additional_documentation.md new file mode 100644 index 00000000..064346f3 --- /dev/null +++ b/docs/additional_documentation.md @@ -0,0 +1,74 @@ +# Documentation + +Additional documentation to support the `OCWEBGUI` documentation in helsinkifi wiki. + +## Ruby 2.3.0 requirements + +For newer Ubuntu versions, you might need libssl1.0-dev to compile Ruby 2.3.0 + +``` +sudo apt update && apt-cache policy libssl1.0-dev +sudo apt-get install libssl1.0-dev +``` + +## Rbenv installation + +Ruby-build needed and `rbenv rehash` is the key here. + +``` +rbenv install 2.3.0 +rbenv global 2.3.0 +rbenv rehash +``` + +**NB!** If error when installing that can't write shim, might help: +``` +cd ~/.rbenv/shims/ +mv .rbenv-shim .rbenv-shim-old. +rbenv rehash +rbenv install --list +rbenv global 2.3.0 +which ruby +``` + +## If using NVM + +``` +nvm use (12) +npm install +``` + +## Installation history command for production + +Best to run commands always with `bundle exec` prefix. + +``` +gem install bundler -v 1.12.5 +bundle install +sudo apt-get install beanstalkd +sudo systemctl start beanstalkd.socket +sudo apt install ruby-god +RAILS_ENV=production bundle exec rake db:create +RAILS_ENV=production bundle exec rake db:migrate +RAILS_ENV=production OC_WEBGUI_PASSWORD= bundle exec rake db:seed +RAILS_ENV=production bundle exec rake assets:precompile +``` + +`config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?` + +Remember to set to `true`, if running locally a production environment and can't find assets, http 404, even though they are in public/assets + +## Creating the admin user + +Admin user login is needed so that the user interface looks pretty, +to create the first admin user as local production env run: +``` +RAILS_ENV=production rails c +User.create(username: 'admin', password: 'admin', is_admin: true) +``` + +## Logging when god running + +tail -f log/production.log +tail -f log/clockwork.log +tail -f log/backburner.log diff --git a/docs/soap_return b/docs/soap_return new file mode 100644 index 00000000..4ea193db --- /dev/null +++ b/docs/soap_return @@ -0,0 +1,53 @@ +CURRENT RETURN ENDPOINT 26.10.2021 + + + + x21100 ticket_id 0 + x21101 arrived 1 + x21102 time_in_queue 2 + x40026 PreparationTimeBeforeCall 3 + x21136 TimeInQueueServiceTime 4 + x21103 forwarded_to_agent 5 + x21120 answered 6 + x21104 call_ended 7 + x21105 after_call_ended 8 + x21106 total_response_time 9 + x40027 CallLength 10 + x20113 total_handle_time 11 + x40028 WrapupTime 12 + x21137 LengthAndConsultationCalls 13 + x21107 service_name 14 + x21108 direction 15 + x21109 contact_type 16 + x21110 contact_information 17 + x21111 agent_name 18 + x21221 OtherAgents 19 + x21112 customer_id 20 + x21113 contact_reason 21 + x21114 information 22 + x21115 ivr_feedback 23 + x21116 category_of_recording 24 + x21117 recorded 25 + x21126 inserted_to_db 26 + x20115 task_count 27 + x20116 TaskHandlingTime 28 + x20117 TotalHandlingTime 29 + x20126 TotalResponseTime 30 + x21119 Subject 31 + x21998 OutboundCampaignName 32 + x21999 OutboundCampaignId 33 + x21997 AdditionalInformation 34 + x21118 Destination 35 + x21127 ReturnCode + x21128 OriginalServiceID + x21129 ServiceID + x21130 TransferHistory + x21131 LengthAndConsultationCalls + xAGENT_ID AgentID + x21135 AdditionalChannels + x21138 CallReason + x21139 CallType + + + + diff --git a/docs/soap_spec_mock_return b/docs/soap_spec_mock_return new file mode 100644 index 00000000..57911395 --- /dev/null +++ b/docs/soap_spec_mock_return @@ -0,0 +1,21 @@ +SPEC RETURN MOCK + + 21100 ticket_id 0 + 21101 arrived 1 + 21102 time_in_queue 2 + 21103 forwarded_to_agent 3 + 21120 answered 4 + 21104 call_ended 5 + 21105 after_call_ended 6 + 21106 total_response_time 7 + 20113 total_handle_time 8 + 21107 service_name 9 + 21108 direction 10 + 21109 contact_type 11 + 21110 contact_information 12 + 21111 agent_name 13 + 21112 customer_id 14 + 21113 contact_reason 15 + 21114 information 16 + 21115 ivr_feedback 17 + diff --git a/spec/fixtures/backend_service/get_agent_contacts_1.xml b/spec/fixtures/backend_service/get_agent_contacts_1.xml index 6500d2e5..91db090e 100644 --- a/spec/fixtures/backend_service/get_agent_contacts_1.xml +++ b/spec/fixtures/backend_service/get_agent_contacts_1.xml @@ -7,37 +7,49 @@ 21100 21101 21102 + 40026 + 21136 21103 21120 21104 21105 21106 + 40027 20113 + 40028 + 21137 21107 21108 21109 21110 21111 + 21221 21112 21113 21114 21115 - + 20160614091049336435 14.6.2016 9:11:43 1 + nil + nil 14.6.2016 9:11:44 14.6.2016 9:11:57 14.6.2016 9:13:59 14.6.2016 9:21:41 598 + nil 597 + nil + nil Neuvonta Fin I PBX 0405882759 Seppänen Pekka + nil -1 Onnistunut kontakti nil diff --git a/spec/services/backend_service_spec.rb b/spec/services/backend_service_spec.rb index 7c2df535..9db8b4a9 100644 --- a/spec/services/backend_service_spec.rb +++ b/spec/services/backend_service_spec.rb @@ -83,33 +83,12 @@ def with_utc_offset(timestamp) expected = [ {:ticket_id=>"20160614091049336435", :arrived=>with_utc_offset("14.6.2016 9:11:43"), -:time_in_queue=>"1", :forwarded_to_agent=>with_utc_offset("14.6.2016 9:11:44"), :answered=>with_utc_offset("14.6.2016 9:11:57"), :call_ended=>with_utc_offset("14.6.2016 9:13:59"), :after_call_ended=>with_utc_offset("14.6.2016 9:21:41"), -:total_response_time=>"598", -:total_handle_time=>"597", -:service_name=>"Neuvonta Fin", :direction=>"I", -:contact_type=>"PBX", -:contact_information=>"0405882759", -:agent_name=>"Seppänen Pekka", -:customer_id=>"-1", -:contact_reason=>"Onnistunut kontakti", -:information=>"nil", -:ivr_feedback=>"-1", -:category_of_recording=>nil, -:recorded=>nil, -:inserted_to_db=>nil, -:task_count=>nil, -:task_time=>nil, -:processing_total_sum=>nil, -:subject=>nil, -:outbound_campaign_name=>nil, -:outbound_campaign_id=>nil, -:additional_info=>nil, -:destination=>nil} +:contact_type=>"PBX"} ] savon.expects(:get_contacts).with(message: message).returns(fixture)