Class: Expediente

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/expediente.rb

Direct Known Subclasses

Nota, Proyecto

Constant Summary

LEGACY_CONSTRAINTS =

TODO Add Tags TODO Add recursive relation TODO Move everything that belong to proyect there.

[:numero, :letra, :pasada, :tipo]
Tipos =
{ 1 => "Ley", 2 => "Comunicación", 3 => "Declaración",
4 => "Resolución", 5 => "Decreto", 6 => "Mensaje" }
TiposColection =
Tipos.invert
Entrada =
{ 1 => "Mesa de entrada", 2 => "Secretaria"}
Periodo =
{ 1 => "Ordinario", 2 => "De prorroga", 3 => "Extraordinario"}

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Instance Attribute Details

- (Object) tags_tokens

Returns the value of attribute tags_tokens



13
14
15
# File 'app/models/expediente.rb', line 13

def tags_tokens
  @tags_tokens
end

Instance Method Details

- (Object) archivos_digitales



108
109
110
111
112
113
114
115
116
# File 'app/models/expediente.rb', line 108

def archivos_digitales
  base_path = Rails.root.join "public"
  contained_files = []
  Dir[File.join(base_path, "system", "pdf", "**", reglas_del_archivo)].each do |full_path|
    path = Pathname.new(full_path).relative_path_from(base_path)
    contained_files << path
  end
  contained_files
end

- (Object) clave



99
100
101
# File 'app/models/expediente.rb', line 99

def clave
  "#{numero} #{letra} #{tipo_format} (#{pasada})"
end

- (Object) comisiones_asignadas

las comisiones asignadas en el asunto entrado.



126
127
128
# File 'app/models/expediente.rb', line 126

def comisiones_asignadas
  asunto.comisiones if asunto
end

- (Object) entrada



91
92
93
# File 'app/models/expediente.rb', line 91

def entrada
  "#{fechaentr} #{hora} por: #{tipoentr}"
end

- (Object) estado=(estado)



79
80
81
82
83
84
85
# File 'app/models/expediente.rb', line 79

def estado=(estado)
  if estado.is_a? Fixnum
    write_attribute(:estado, estado)
  else
    super
  end
end

- (Object) final

Busca el final de tramite correspondiente y carga la descripcion o retorna nil si no hay fin de tramite.



63
64
65
66
# File 'app/models/expediente.rb', line 63

def final
  descripciones = finals.collect(&:descripcion).delete_if { |d| d.empty? }
  descripciones.last
end

- (Object) html_descrip



103
104
105
106
# File 'app/models/expediente.rb', line 103

def html_descrip
  pretty_descrip = (descrip  || "").mb_chars#.capitalize
  "<p>#{pretty_descrip}</p>".html_safe
end

- (Object) periodo



95
96
97
# File 'app/models/expediente.rb', line 95

def periodo
  "#{tipoperiod} Numero: #{numperiodo}"
end

- (Object) reglas_del_archivo



118
119
120
121
122
123
# File 'app/models/expediente.rb', line 118

def reglas_del_archivo
  #todos los archivos
  #"*"
  #los archivos que empiezan con el numero del expediente
  "??#{numero}*"
end

- (Object) tags_list



130
131
132
# File 'app/models/expediente.rb', line 130

def tags_list
  tags.pluck :name
end

- (Object) tema=(tema)

Al migrar asigno directamente el numero que deberia ser guardado como estado_id y que de otra forma se confunde. Asi hago que funcionen los dos en simultaneo.



71
72
73
74
75
76
77
# File 'app/models/expediente.rb', line 71

def tema=(tema)
  if tema.is_a? Fixnum
    write_attribute(:tema, tema)
  else
    super
  end
end

- (Object) tipo



23
24
25
# File 'app/models/expediente.rb', line 23

def tipo
  Tipos[read_attribute(:tipo)] || "No indicado"
end

- (Object) tipo_format



87
88
89
# File 'app/models/expediente.rb', line 87

def tipo_format
  "#{tipo} #{ley if tipo == "Ley" and ley and ley > 0}"
end

- (Object) tipoentr



29
30
31
# File 'app/models/expediente.rb', line 29

def tipoentr
  Entrada[read_attribute(:tipoentr)] || "No indicado"
end

- (Object) tipoperiod



34
35
36
# File 'app/models/expediente.rb', line 34

def tipoperiod
  Periodo[read_attribute(:tipoperiod)] || "No indicado"
end