Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Osobna zona #536

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ SITEMAP_PUBLIC_URL=

OR_SR_IDENTIFIERS_EMAIL_TEMPLATE_ID=
OR_SR_IDENTIFIERS_DONE_EMAIL_TEMPLATE_ID=

DATAHUB_DATABASE_URL=
16 changes: 0 additions & 16 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -153,22 +153,6 @@ GEM
ffi-compiler (1.0.1)
ffi (>= 1.0.0)
rake
fog-aws (3.14.0)
fog-core (~> 2.1)
fog-json (~> 1.1)
fog-xml (~> 0.1)
fog-core (2.3.0)
builder
excon (~> 0.71)
formatador (>= 0.2, < 2.0)
mime-types
fog-json (1.2.0)
fog-core
multi_json (~> 1.10)
fog-xml (0.1.4)
fog-core
nokogiri (>= 1.5.11, < 2.0.0)
formatador (1.1.0)
friendly_id (5.4.2)
activerecord (>= 4.0.0)
globalid (1.0.0)
Expand Down
6 changes: 6 additions & 0 deletions app/controllers/dashboards_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class DashboardsController < ApplicationController
before_action :require_user

def show
end
end
11 changes: 11 additions & 0 deletions app/models/datahub/datahub_record.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module Datahub
class DatahubRecord < ActiveRecord::Base
self.abstract_class = true

connects_to database: { writing: :datahub, reading: :datahub }

def readonly?
true
end
end
end
30 changes: 30 additions & 0 deletions app/models/datahub/socpoist/debtor.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
module Datahub
module Socpoist
class Debtor < DatahubRecord
self.table_name = "socpoist.debtors"

attribute :search_score, :float, default: nil

def self.search(name, threshold = 0.5)
table = self.arel_table
similarity_condition = lambda do
Arel::Nodes::NamedFunction.new("similarity",
[
Arel::Nodes::NamedFunction.new("unaccent", [
table[:name],
]),
Arel::Nodes::NamedFunction.new("unaccent", [
Arel::Nodes.build_quoted(name)
])
]
)
end

select(similarity_condition.call.as("search_score"), table[Arel.star])
.where(similarity_condition.call.gt(threshold))
.order(search_score: :desc)
.limit(10)
end
end
end
end
25 changes: 25 additions & 0 deletions app/views/dashboards/show.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<div class="govuk-cookie-banner " data-nosnippet role="region" aria-label="Cookies on [name of service]">
<div class="govuk-cookie-banner__message govuk-width-container">

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<h2 class="govuk-cookie-banner__heading govuk-heading-m">Cookies on [name of service]</h2>

<div class="govuk-cookie-banner__content">
<p class="govuk-body">We use some essential cookies to make this service work.</p>
<p class="govuk-body">We’d also like to use analytics cookies so we can understand how you use the service and make improvements.</p>
</div>
</div>
</div>

<div class="govuk-button-group">
<button value="accept" type="button" name="cookies" class="govuk-button" data-module="govuk-button">
Accept analytics cookies
</button>
<button value="reject" type="button" name="cookies" class="govuk-button" data-module="govuk-button">
Reject analytics cookies
</button>
<a class="govuk-link" href="#">View cookies</a>
</div>
</div>
</div>
24 changes: 18 additions & 6 deletions config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,25 @@ default: &default
pool: <%= ENV['RAILS_MAX_THREADS'] || 5 %>

development:
<<: *default
database: navody_slovensko_digital_development
primary:
<<: *default
database: navody_slovensko_digital_development
datahub:
<<: *default
url: <%= ENV['DATAHUB_DATABASE_URL'] %>

test:
<<: *default
database: navody_slovensko_digital_test
primary:
<<: *default
database: navody_slovensko_digital_test
datahub:
<<: *default
url: <%= ENV['DATAHUB_DATABASE_URL'] %>

production:
<<: *default
url: <%= ENV['DATABASE_URL'] %>
primary:
<<: *default
url: <%= ENV['DATABASE_URL'] %>
datahub:
<<: *default
url: <%= ENV['DATAHUB_DATABASE_URL'] %>
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
end
resources :apps, path: 'aplikacie' # faux route

resource :dashboards, path: 'osobna-zona', only: [:show]
resources :user_journeys, path: 'moje-zivotne-situacie' do
post :restart, on: :member, path: 'zacat-odznova'
end
Expand Down