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 AutorizacaoHelper | |
extend self | |
def autorizado_para_modulo?(usuario, modulo) | |
return true if Rails.env.development? | |
usuario.acoes.where(modulo: modulo).any? | |
end | |
def autorizado_para_secao?(usuario, modulo, secao) | |
return true if Rails.env.development? |
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
#old code | |
def filtrar_padrao_por_data(horario, data) | |
programado_substituto = Agendamento::Horario.programados_por_horario_padrao(horario).where('? BETWEEN validade_inicial AND validade_final', data).first | |
if programado_substituto # se existe um substituto para ele | |
if data.between?(programado_substituto.validade_inicial, programado_substituto.validade_final) # e substitui nessa data | |
if programado_substituto.bloqueado? | |
false | |
else | |
programado_substituto # mostra o substituto |
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
class Unit < ApplicationRecord | |
store :data, accessors: %i[position phone email], coder: JSON | |
belongs_to :company, inverse_of: :units, optional: true | |
belongs_to :unit_parent, class_name: "Unit", foreign_key: "unit_id", optional: true | |
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
#Código atual: | |
if item.try(:percentual_via) | |
if item.try(:percentual_via).present? | |
codigo_via = Convenio::PercentualVia.codigo_da_via(item.percentual_via.tipo) | |
xml.viaAcesso codigo_via | |
else | |
xml.viaAcesso '1' | |
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
class OndontogramaNulo | |
attr_reader :codigo_dente, :regiao_boca, :face | |
def initialize | |
@codigo_dente = 0 | |
@regicao_boca = '' | |
@face = '' | |
end | |
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
x = {:group_name=>"Grupo I", | |
:subjects=>[ | |
{:subject=>"Previdenciário", :total_answered=>2, :total_correct=>2, :points=>10, | |
:average=>100.0, :average_course=>100.0, | |
:leading_knowledges=>[{:name=>"Conhecimento prepoderante 1", :average=>0.0}, | |
{:name=>"Conhecimento prepoderante 2", :average=>0.0}, | |
{:name=>"Conhecimento prepoderante 3", :average=>0.0}]}, | |
{:subject=>"Previdenciário", :total_answered=>2, :total_correct=>2, :points=>10, | |
:average=>100.0, :average_course=>100.0, | |
:leading_knowledges=>[{:name=>"Conhecimento prepoderante 1", :average=>0.0}, |
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
class ApplicationController < ActionController::Base | |
protect_from_forgery with: :null_session | |
before_action :set_locale | |
before_filter :authenticate_user! | |
self.responder = AppResponder | |
respond_to :html | |
helper_method :current_salon |
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
class CustomerSerializer < ActiveModel::Serializer | |
attributes :id, :name, :email | |
end | |
class SchedulingSerializer < ActiveModel::Serializer | |
attributes :id, :beauty_salon_id, :schedule_id, :customer_id, | |
:date_scheduling, :hour, :beauty_salon | |
has_many :services |
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
# controller metodo index: | |
def index | |
@consultorios = BuscadorConsultorio.new(params).filtrar | |
end | |
# novo objeto de busca | |
class BuscadorConsultorio | |
def new(opcoes_busca, buscado_padrao = Setor::Consultorio) |
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
class PacientesController < ApplicationController | |
before_action :protected_show, only: [:show] | |
def show | |
@paciente = Paciente.find(params[:id]) | |
end | |
private | |
def protected_show | |
unless clinica_logada.pacientes.where(id: params[:id]).any? |
NewerOlder