This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fetch_open_surveys(survey_ids) | |
return [] if survey_ids.empty? | |
params = { survey_featured: survey_ids } | |
response = ::RestClient.get("#{FORMS_URL}?#{params.to_query}", headers) | |
data = JSON.parse(response.body, symbolize_names: true) | |
data[:surveys] | |
rescue | |
[] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :db do | |
namespace :migrate do | |
task tenant: :environment do | |
tenant_name = ENV["TENANT"] | |
origin_org_slug = ENV["ORIGIN_ORG_SLUG"] | |
destination_org_slug = ENV["DESTINATION_ORG_SLUG"] | |
tenant = Tenant.find_by(name: tenant_name) | |
base_organization = Organization.find_by(slug: origin_org_slug) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Concerns::Publishable | |
extend ActiveSupport::Concern | |
included do | |
if Rails.env.production? | |
after_commit :pubsub_create, on: :create | |
after_update :pubsub_update | |
after_destroy :pubsub_destroy | |
end | |
def pubsub_create |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Creado por: Rankmi | |
# Fecha: <b>24 enero 2016</b> | |
# Servicio que crea/actualiza un usuario con los datos básicos. | |
module ManageCollaborators | |
class CreateCollaborator < RankmiBaseService | |
include ::Concerns::ServiceHelper | |
include ::Concerns::FamilyGoalsAdministrable | |
attr_accessor :enterprise_area, :area_slug, :user_data, :direct_manager, | |
:user, :process, :survey, :survey_id, :from_master, :massive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
module Sns | |
module Subscriptions | |
class Users | |
include Sidekiq::Worker | |
include Helpers | |
sidekiq_options queue: 'critical' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
module Administration | |
module PositionsManagement | |
class PositionPrint < Blueprinter::Base | |
view :successed do | |
identifier :id | |
fields :name, :code, :token, :parent_id, :description, :children_count |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
class EnterpriseModulesWorker < BaseWorker | |
shoryuken_options queue: queue('enterprise-modules'), | |
body_parser: :json, | |
auto_delete: false, | |
retry_intervals: [60, 120, 240] | |
attr_accessor :sqs_msg, :tenant, :event_message |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def validate(record) | |
if !record.email.match(Account::VALID_EMAIL_REGEX) | |
record.errors[:email] << malformed_field('email', "Email no válido: #{record.email} ") | |
elsif record.id.nil? # new user | |
if Account.find_by(email: record.email).present? | |
record.errors[:email] << malformed_field('email', "Email duplicado: #{record.email}") | |
# return false | |
end | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
attr_accessor :is_manager_evaluator, :user_area, :is_manager_evaluator, | |
:is_performance, :user_area_permissions, :is_admin | |
def initialize(user_id, process_id, survey_id = nil) | |
@user_id = user_id | |
@process_id = process_id | |
@survey_id = survey_id | |
end | |
def perform |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#begin @eolivar RKM-2780 07/03/2018 | |
def create_or_update_optionals user, optionals | |
unless !optionals.present? | |
optionals = optionals.select { |k, v| (v[:value].nil? && v[:id].present?) || (v[:value].present? && !v[:value].empty?) } | |
optionals.each do |key, value| | |
user_optional = UserOptional.where(id: value[:id]).first unless !value[:id].present? | |
if user_optional.present? && value[:value].nil? | |
user_optional.destroy |
NewerOlder