{
  "name": "dialog/productivity_report/map3.json",
  "definition": {
    "wlg_header": {
      "map": [
        ["wlg_header", "=", ["concat", [", ", "wlg_name"]]]
      ]
    },
    "reclamation": {
      "map": [
        ["reclamation_row_dimmed", "=", [
          ["rcl_state", "==", 0],
          "or",
          ["rcl_finished_date", "<", "param.start_date"],
          "or",
          ["rcl_finished_date", ">", "param.end_date"]
         ]]
      ]
    },
    "track_time": {
      "filter": {"name": "dialog/productivity_report/filter.json", "definition": "track_time_map"},
      "map": [
        ["track_time_asked", "=", [["wpa_track_time_status", ">=", 1], "and", ["wpa_track_time_status", "<=", 4]]],
        ["track_time_measured", "=", [["wpa_track_time_status", ">=", 2], "and", ["wpa_track_time_status", "<=", 3]]],
        ["track_time_change", "=", ["wpa_measured_track_time", "-", "previous_measured_track_time"]],
        ["track_time_change_percent", "=", [["track_time_change", "/", "previous_measured_track_time"],"*", 100]]
      ]
    },
    "speed": {
      "filter": {"name": "dialog/productivity_report/filter.json", "definition": "speed"},
      "map": [
        ["if", ["rec.query_name", "==", "no_fms"], [
          ["wpa_work_time__amount", "=", ["work_time_not_fms_machine", "+", "work_time_other"]],
          ["work_time_all", "=", ["all_work_time_not_fms_machine", "+", "all_work_time_other"]],
          ["before_time_period_sum", "=", ["before_time_period_sum_not_fms_machine", "+", "before_time_period_sum_other"]],
          ["after_time_period_sum", "=", ["after_time_period_sum_not_fms_machine", "+", "after_time_period_sum_other"]]
        ], "elseif", ["rec.query_name", "==", "only_fms"], [
          ["wpa_work_time__amount", "=", ["work_time_not_fms_machine", "+", "work_time_fms"]],
          ["work_time_all", "=", ["all_work_time_not_fms_machine", "+", "all_work_time_fms"]],
          ["before_time_period_sum", "=", ["before_time_period_sum_not_fms_machine", "+", "before_time_period_sum_fms"]],
          ["after_time_period_sum", "=", ["after_time_period_sum_not_fms_machine", "+", "after_time_period_sum_fms"]]
        ], "else", [
          ["wpa_work_time__amount", "=", ["work_time_not_fms_machine", "+", ["work_time_fms", "+", "work_time_other"]]],
          ["work_time_all", "=", ["all_work_time_not_fms_machine", "+", ["all_work_time_fms", "+", "all_work_time_other"]]],
          ["before_time_period_sum", "=", ["before_time_period_sum_not_fms_machine", "+", ["before_time_period_sum_fms", "+", "before_time_period_sum_other"]]],
          ["after_time_period_sum", "=", ["after_time_period_sum_not_fms_machine", "+", ["after_time_period_sum_fms", "+", "after_time_period_sum_other"]]]
        ]],
        ["std_time", "=", [["wpa_work_time__amount", "/", "work_time_all"], "*", "wpa_target_time"]],
        ["work_time__unit", "=", ["wpa_work_time__amount", "/", ["wos_produced", "+", "wos_failed"]]],
        ["estimated_speed_percent", "=", [["estimated_work_time__unit", "/", "work_time__unit"], "*", 100]],
        ["finished_work_time", "=", ["wpa_work_time__amount", "*", "wos_finished"]],
        ["finished_std_time", "=", ["std_time", "*", "wos_finished"]],
        ["finished_work_time__unit", "=", ["work_time__unit", "*", "wos_finished"]],
        ["finished_estimated_work_time__unit", "=", ["estimated_work_time__unit", "*", "wos_finished"]]
      ],
      "mapX": [
        ["work_time_all", "=", ["work_time_time_period", "+", ["work_time_before", "+", "work_time_after"]]]
      ]
    }
  }
}
