Class: ErrorClientBase

Inherits:
ModelBase show all
Includes:
Mongoid::Document, MongoidIdAlias
Defined in:
lib/mrpin/core/statistic/error_client_base.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from MongoidIdAlias

#id

Methods inherited from ModelBase

admin_group, #clone_model, configure_admin_edit, #create_info, #create_info_with_check, filters_for_admin_list, init_scopes

Methods included from AMFSerializable

#encode_amf

Constructor Details

#initialize(options = nil) ⇒ ErrorClientBase

default constructor



121
122
123
124
# File 'lib/mrpin/core/statistic/error_client_base.rb', line 121

def initialize(options = nil)
  super(options)

end

Class Method Details

.configure_admin_list(section, field_name) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/mrpin/core/statistic/error_client_base.rb', line 11

def self.configure_admin_list(section, field_name)

  case field_name
    when :_id, :md5, :logs_to_save_left, :logs_files, :stack_trace
      section.configure field_name do
        visible false
      end

    when :throws_count, :players_count
      section.configure field_name do
        column_width 60
      end

    else
      super(section, field_name)
  end

end

.configure_admin_show(section, field_name) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/mrpin/core/statistic/error_client_base.rb', line 41

def self.configure_admin_show(section, field_name)

  case field_name
    when :logs_files
      section.configure field_name do

        pretty_value do

          logs_files = bindings[:object].logs_files

          result = []

          log_index = 1

          logs_files.each do |url_log|

            result << bindings[:view].link_to("log_file_#{log_index}", url_log.html_safe)

            log_index += 1
          end

          result.join('<br>').html_safe
        end
      end
    when :stack_trace
      section.configure field_name do
        pretty_value do
          value.join('<br>').html_safe
        end
      end

    else
      superclass.configure_admin_show(section, field_name)
  end

end

.sort_by_for_admin_list(section) ⇒ Object



31
32
33
34
35
36
37
38
# File 'lib/mrpin/core/statistic/error_client_base.rb', line 31

def self.sort_by_for_admin_list(section)

  section.sort_by :last_error_at
  section.configure :last_error_at do
    sort_reverse true
  end

end