lib/workflow_steps.rb
def calculate_progress

    @workflow_steps_data_map.each do |workflow_id,kind_to_data_map|
      percentage_completed = 3 # loaders starting from 3%

      workflow_kind = @workflow_data_map[workflow_id][:kind]
      r = fetch_economy_setup_config(workflow_kind)
      return r unless r.success?

      display_text = ''
      display_name = ''
      all_steps = {}
      @step_config.each do |step|
        step_group_display_text = @group_config[step['group']]['display_text']
        step_group_name = @group_config[step['group']]['name']

        all_steps[step['group']] ||= {
          display_text: step_group_display_text,
          name: step_group_name,
          status: @workflow_data_map[workflow_id].status
        }

        if kind_to_data_map[step['kind']]
          if kind_to_data_map[step['kind']].status == GlobalConstant::WorkflowStep.processed_status
            percentage_completed = percentage_completed + step['weight']
          end

          display_text = step_group_display_text
          display_name = step_group_name
        end
      end

      @response_data[workflow_id] = {
        current_step: {
          display_text: display_text,
          name: display_name,
          percent_completion: percentage_completed,
          status: @workflow_data_map[workflow_id].status
        },
        all_steps: all_steps.values
      }
    end

    success
  end
# calculate progress percentage depending on the status of workflow
#
# * Author: Anagha
# * Date: 15/01/2019
# * Reviewed By:
#
# @return [Result::Base]
#
calculate progress percentage depending on the status of workflow
Author: Anagha
Date: 15/01/2019
Reviewed By.
calculate progress percentage depending on the status of workflow Author : Anagha Date : 15 / 01 / 2019 Reviewed By .
def calculate_progress
    @workflow_steps_data_map.each do |workflow_id,kind_to_data_map|
      percentage_completed = 3 
      workflow_kind = @workflow_data_map[workflow_id][:kind]
      r = fetch_economy_setup_config(workflow_kind)
      return r unless r.success?
      display_text = ''
      display_name = ''
      all_steps = {}
      @step_config.each do |step|
        step_group_display_text = @group_config[step['group']]['display_text']
        step_group_name = @group_config[step['group']]['name']
        all_steps[step['group']] ||= {
          display_text: step_group_display_text,
          name: step_group_name,
          status: @workflow_data_map[workflow_id].status
        }
        if kind_to_data_map[step['kind']]
          if kind_to_data_map[step['kind']].status == GlobalConstant::WorkflowStep.processed_status
            percentage_completed = percentage_completed + step['weight']
          end
          display_text = step_group_display_text
          display_name = step_group_name
        end
      end
      @response_data[workflow_id] = {
        current_step: {
          display_text: display_text,
          name: display_name,
          percent_completion: percentage_completed,
          status: @workflow_data_map[workflow_id].status
        },
        all_steps: all_steps.values
      }
    end
    success
  end
def calculate_progress @workflow_steps_data_map . each do | workflow_id , kind_to_data_map | percentage_completed = 3 workflow_kind = @workflow_data_map [ workflow_id ] [ :kind ] r = fetch_economy_setup_config ( workflow_kind ) return r unless r . success? display_text = '' display_name = '' all_steps = { } @step_config . each do | step | step_group_display_text = @group_config [ step [ 'group' ] ] [ 'display_text' ] step_group_name = @group_config [ step [ 'group' ] ] [ 'name' ] all_steps [ step [ 'group' ] ] ||= { display_text : step_group_display_text , name : step_group_name , status : @workflow_data_map [ workflow_id ] . status } if kind_to_data_map [ step [ 'kind' ] ] if kind_to_data_map [ step [ 'kind' ] ] . status == GlobalConstant :: WorkflowStep . processed_status percentage_completed = percentage_completed + step [ 'weight' ] end display_text = step_group_display_text display_name = step_group_name end end @response_data [ workflow_id ] = { current_step : { display_text : display_text , name : display_name , percent_completion : percentage_completed , status : @workflow_data_map [ workflow_id ] . status } , all_steps : all_steps . values } end success end
calculate progress percentage depending on the status of workflow
 Author: Anagha
 Date: 15/01/2019
 Reviewed By:
calculate progress percentage depending on the status of workflow Author : Anagha Date : 15 / 01 / 2019 Reviewed By :
# loaders starting from 3%
None
Result::Base