135dika / update_action_plan_tree.md

Last active 2 weeks ago

Like 0
update_action_plan_tree.md Raw

Payload lengkap — GET /action-plans/:projectId/tree

{
  "activities": [
    {
      "id": "act-9f1c2b7e-0001",
      "name": "Pekerjaan Struktur Atas",
      "weight": 0,
      "weightPercent": 0,
      "activityType": "CONSTRUCTION",
      "status": "IN_PROGRESS",
      "rollbackPaused": false,
      "approverId": "usr-1a2b3c",
      "approvalStatus": "APPROVED",
      "approvalReason": null,
      "bodRoundId": null,
      "bodResult": null,
      "bodReason": null,
      "bodDisplayStatus": null,
      "hasPrerequisites": false,
      "prerequisiteIds": [],
      "approvals": [
        {
          "approverName": "Budi Santoso",
          "response": "APPROVED",
          "respondedAt": "2026-08-02T03:15:00.000Z",
          "reason": null
        }
      ],
      "latestProgressStatus": "PENDING",
      "totalTasks": 2,
      "totalUsersAssigned": 4,
      "accumulatedProgress": 62.5,
      "pendingProgress": 6.25,
      "progressSeries": null,
      "workWeight": 52000000,
      "cost": null,
      "workVolume": 1250,
      "startDate": "2026-08-01T00:00:00.000Z",
      "endDate": "2026-10-15T00:00:00.000Z",
      "progressFold": {
        "approved": 58.42,
        "submitted": 66.01,
        "weight": 63,
        "leaves": 4,
        "weightlessLeaves": 1,
        "completedLeaves": 2
      },
      "createdBy": "usr-1a2b3c",
      "createdAt": "2026-07-20T02:10:00.000Z",
      "updatedAt": "2026-10-24T09:30:00.000Z",
      "latestProgressAt": "2026-10-22T07:45:00.000Z",
      "editRequest": null,
      "latestProgressBy": "usr-77ff01",
      "latestProgressUpdatedAt": "2026-10-22T07:45:00.000Z",
      "tasks": [
        {
          "id": "tsk-4c8d1a0f-0001",
          "name": "Kolom Lantai 1-3",
          "weight": 0,
          "weightPercent": 0,
          "status": "NEED_APPROVAL",
          "rollbackPaused": false,
          "approverId": "usr-1a2b3c",
          "approvalStatus": "PENDING",
          "approvalReason": "Menunggu verifikasi volume",
          "bodRoundId": null,
          "bodResult": null,
          "bodReason": null,
          "bodDisplayStatus": null,
          "hasPrerequisites": true,
          "prerequisiteIds": ["tsk-4c8d1a0f-0000"],
          "approvals": [],
          "latestProgressStatus": "PENDING",
          "totalSubtasks": 2,
          "totalUsersAssigned": 3,
          "accumulatedProgress": 87.5,
          "pendingProgress": 12.5,
          "progressSeries": null,
          "workWeight": 24000000,
          "cost": null,
          "workVolume": 620,
          "workVolumeUnit": "m3",
          "startDate": "2026-08-01T00:00:00.000Z",
          "endDate": "2026-09-10T00:00:00.000Z",
          "latestProgressAt": "2026-09-09T10:20:00.000Z",
          "editRequest": {
            "id": "edr-77aa01",
            "scopeType": "TASK",
            "scopeId": "tsk-4c8d1a0f-0001",
            "scopeName": "Kolom Lantai 1-3",
            "requestedData": { "endDate": "2026-09-20T00:00:00.000Z" },
            "oldData": { "endDate": "2026-09-10T00:00:00.000Z" },
            "reason": "Penambahan volume kolom praktis",
            "status": "PENDING",
            "requestedBy": "usr-77ff01",
            "requestedByName": "Siti Rahma",
            "requestedAt": "2026-09-11T04:00:00.000Z",
            "respondedBy": null,
            "respondedByName": null,
            "respondedAt": null,
            "createdAt": "2026-09-11T04:00:00.000Z"
          },
          "subtasks": [
            {
              "id": "stk-11aa22bb-0001",
              "weight": 20,
              "weightPercent": 31.75,
              "name": "Pembesian kolom lantai 1",
              "status": "COMPLETED",
              "rollbackPaused": false,
              "latestProgressStatus": "APPROVED",
              "approverId": "usr-1a2b3c",
              "approvalStatus": "APPROVED",
              "approvalReason": null,
              "bodRoundId": null,
              "bodResult": null,
              "bodReason": null,
              "bodDisplayStatus": null,
              "hasPrerequisites": false,
              "prerequisiteIds": [],
              "totalUsersAssigned": 2,
              "progress": 100,
              "progressSeries": {
                "periode": {
                  "day": [
                    { "date": "2026-08-01", "realization": 0, "plan": 5, "deviation": -5 },
                    { "date": "2026-08-02", "realization": 20, "plan": 10, "deviation": 10 }
                  ],
                  "week": [
                    {
                      "week": 1,
                      "startDate": "2026-08-01",
                      "endDate": "2026-08-07",
                      "date": "2026-08-07",
                      "realization": 40,
                      "plan": 35,
                      "deviation": 5
                    }
                  ],
                  "month": [{ "month": "Aug 2026", "date": "2026-08-20", "realization": 100, "plan": 100, "deviation": 0 }]
                },
                "cumulative": {
                  "day": [
                    { "date": "2026-08-01", "realization": 0, "plan": 5, "deviation": -5 },
                    { "date": "2026-08-02", "realization": 20, "plan": 10, "deviation": 10 }
                  ],
                  "week": [
                    {
                      "week": 1,
                      "startDate": "2026-08-01",
                      "endDate": "2026-08-07",
                      "date": "2026-08-07",
                      "realization": 40,
                      "plan": 35,
                      "deviation": 5
                    }
                  ],
                  "month": [{ "month": "Aug 2026", "date": "2026-08-20", "realization": 100, "plan": 100, "deviation": 0 }]
                }
              },
              "workVolume": 310,
              "workVolumeUnit": "m3",
              "workWeight": 14000000,
              "cost": 155000000,
              "startDate": "2026-08-01T00:00:00.000Z",
              "endDate": "2026-08-20T00:00:00.000Z",
              "latestProgressAt": "2026-08-19T08:10:00.000Z",
              "editRequest": null
            },
            {
              "id": "stk-11aa22bb-0002",
              "weight": 0,
              "weightPercent": 0,
              "name": "Bekisting kolom lantai 1",
              "status": "IN_PROGRESS",
              "rollbackPaused": false,
              "latestProgressStatus": "PENDING",
              "approverId": "usr-1a2b3c",
              "approvalStatus": "PENDING",
              "approvalReason": null,
              "bodRoundId": null,
              "bodResult": null,
              "bodReason": null,
              "bodDisplayStatus": null,
              "hasPrerequisites": false,
              "prerequisiteIds": [],
              "totalUsersAssigned": 1,
              "progress": 75,
              "progressSeries": null,
              "workVolume": 220,
              "workVolumeUnit": "m2",
              "workWeight": 10000000,
              "cost": 98000000,
              "startDate": null,
              "endDate": null,
              "latestProgressAt": "2026-09-08T02:00:00.000Z",
              "editRequest": null
            }
          ]
        },
        {
          "id": "tsk-4c8d1a0f-0002",
          "name": "Pengecoran plat lantai 3",
          "weight": 28,
          "weightPercent": 44.44,
          "status": "NOT_STARTED",
          "rollbackPaused": false,
          "approverId": null,
          "approvalStatus": null,
          "approvalReason": null,
          "bodRoundId": null,
          "bodResult": null,
          "bodReason": null,
          "bodDisplayStatus": null,
          "hasPrerequisites": true,
          "prerequisiteIds": ["tsk-4c8d1a0f-0001"],
          "approvals": [],
          "latestProgressStatus": null,
          "totalSubtasks": 0,
          "totalUsersAssigned": 1,
          "accumulatedProgress": 0,
          "pendingProgress": 0,
          "progressSeries": {
            "periode": {
              "day": [{ "date": "2026-09-01", "realization": 0, "plan": 2.5, "deviation": -2.5 }],
              "week": [
                {
                  "week": 1,
                  "startDate": "2026-09-01",
                  "endDate": "2026-09-07",
                  "date": "2026-09-07",
                  "realization": 0,
                  "plan": 17.5,
                  "deviation": -17.5
                }
              ],
              "month": [{ "month": "Sep 2026", "date": "2026-09-25", "realization": 0, "plan": 100, "deviation": -100 }]
            },
            "cumulative": {
              "day": [{ "date": "2026-09-01", "realization": 0, "plan": 2.5, "deviation": -2.5 }],
              "week": [
                {
                  "week": 1,
                  "startDate": "2026-09-01",
                  "endDate": "2026-09-07",
                  "date": "2026-09-07",
                  "realization": 0,
                  "plan": 17.5,
                  "deviation": -17.5
                }
              ],
              "month": [{ "month": "Sep 2026", "date": "2026-09-25", "realization": 0, "plan": 100, "deviation": -100 }]
            }
          },
          "workWeight": 28000000,
          "cost": 640000000,
          "workVolume": 380,
          "workVolumeUnit": "m3",
          "startDate": "2026-09-01T00:00:00.000Z",
          "endDate": "2026-09-25T00:00:00.000Z",
          "latestProgressAt": null,
          "editRequest": null
        }
      ]
    }
  ],
  "series": {
    "percentage_by": "duration_day",
    "day": {
      "cumulative": [
        { "date": "2026-08-01", "realization": 0, "plan": 0.62, "deviation": -0.62 },
        { "date": "2026-08-02", "realization": 1.59, "plan": 1.85, "deviation": -0.26 },
        { "date": "2026-08-20", "realization": 22.22, "plan": 19.05, "deviation": 3.17 },
        { "date": "2026-09-25", "realization": 41.27, "plan": 55.56, "deviation": -14.29 },
        { "date": "2026-10-15", "realization": 41.27, "plan": 100, "deviation": -58.73 }
      ],
      "periode": [
        { "date": "2026-08-01", "realization": 0, "plan": 0.62, "deviation": -0.62 },
        { "date": "2026-08-02", "realization": 1.59, "plan": 1.23, "deviation": 0.36 },
        { "date": "2026-08-20", "realization": 20.63, "plan": 17.2, "deviation": 3.43 },
        { "date": "2026-09-25", "realization": 19.05, "plan": 36.51, "deviation": -17.46 },
        { "date": "2026-10-15", "realization": 0, "plan": 44.44, "deviation": -44.44 }
      ]
    },
    "week": {
      "cumulative": [
        { "date": "2026-08-07", "realization": 4.76, "plan": 6.35, "deviation": -1.59 },
        { "date": "2026-08-14", "realization": 12.7, "plan": 12.7, "deviation": 0 },
        { "date": "2026-08-21", "realization": 22.22, "plan": 19.05, "deviation": 3.17 },
        { "date": "2026-09-28", "realization": 41.27, "plan": 58.73, "deviation": -17.46 },
        { "date": "2026-10-15", "realization": 41.27, "plan": 100, "deviation": -58.73 }
      ],
      "periode": [
        { "date": "2026-08-07", "realization": 4.76, "plan": 6.35, "deviation": -1.59 },
        { "date": "2026-08-14", "realization": 7.94, "plan": 6.35, "deviation": 1.59 },
        { "date": "2026-08-21", "realization": 9.52, "plan": 6.35, "deviation": 3.17 },
        { "date": "2026-09-28", "realization": 19.05, "plan": 39.68, "deviation": -20.63 },
        { "date": "2026-10-15", "realization": 0, "plan": 41.27, "deviation": -41.27 }
      ]
    },
    "month": {
      "cumulative": [
        { "date": "2026-08-31", "realization": 25.4, "plan": 25.4, "deviation": 0 },
        { "date": "2026-09-30", "realization": 41.27, "plan": 60.32, "deviation": -19.05 },
        { "date": "2026-10-15", "realization": 41.27, "plan": 100, "deviation": -58.73 }
      ],
      "periode": [
        { "date": "2026-08-31", "realization": 25.4, "plan": 25.4, "deviation": 0 },
        { "date": "2026-09-30", "realization": 15.87, "plan": 34.92, "deviation": -19.05 },
        { "date": "2026-10-15", "realization": 0, "plan": 39.68, "deviation": -39.68 }
      ]
    }
  }
}

Yang penting untuk FE

  1. accumulatedProgress dan pendingProgress = progress mentah, rata-rata polos semua leaf di bawahnya. Tidak ada bobot. pendingProgress = submitted − approved pada bacaan yang sama.
  2. progressFold = bacaan berbobot basis. Ini yang dipakai kurva dan rollup project. Jangan dipakai untuk angka baris.
  3. Konsekuensi: leaf tanpa tanggal (contoh stk-11aa22bb-0002) ikut accumulatedProgress (baris bisa 87.5) tapi tidak ikut progressFold dan series (kurva bisa lebih rendah). Itu memang disengaja sekarang.
  4. weight pada baris = bobot basis, bukan rupiah. Pada duration_day satuannya hari. workWeight tetap rupiah. weightPercent = porsi bobot basis.
  5. weight: 0 normal untuk parent (activity yang punya task selalu 0, task yang punya subtask selalu 0).
  6. Angka parent activity/task tidak sama dengan rata-rata weightPercent anaknya — dua bacaan berbeda, jangan dipakai untuk validasi silang.