Class: QaServer::HistoryGraphingService

Inherits:
Object
  • Object
show all
Extended by:
GruffGraph
Defined in:
app/services/qa_server/history_graphing_service.rb

Constant Summary collapse

HISTORICAL_GRAPH_FILENAME =
'historical_side_stacked_bar.png'

Class Method Summary collapse

Class Method Details

.generate_graph(data) ⇒ Object

Generate the graph of historical data

Parameters:

  • data (Hash)

    data to use to generate the graph

See Also:

  • for source of data


26
27
28
29
30
# File 'app/services/qa_server/history_graphing_service.rb', line 26

def generate_graph(data)
  gruff_data = rework_historical_data_for_gruff(data)
  create_gruff_graph(gruff_data, historical_graph_full_path)
  QaServer.config.monitor_logger.warn("FAILED to write historical graph at #{history_graph_image_path}") unless history_graph_image_exists?
end

.history_graph_image_exists?Boolean

Returns true if image for graph exists; otherwise, false.

Returns:

  • (Boolean)

    true if image for graph exists; otherwise, false



19
20
21
# File 'app/services/qa_server/history_graphing_service.rb', line 19

def history_graph_image_exists?
  File.exist? historical_graph_full_path
end

.history_graph_image_pathObject

Path to use with <image> tags



14
15
16
# File 'app/services/qa_server/history_graphing_service.rb', line 14

def history_graph_image_path
  File.join(graph_image_path, HISTORICAL_GRAPH_FILENAME)
end