Skip to content

Logic for calculating ProjectEstimationItems

maxceem edited this page Aug 23, 2019 · 6 revisions

The initial task is described in the next issue and implemented by the next PR.

Calculate estimation items using BuildingBlocks

When we create a project with estimations we are trying to find buildingBlocks for that estimations. If we found them and they have privateConfig with defined priceItems then we for such estimation we create estimation items.

Example:
  • We have an estimation during project creation:

    {
      id: 7,
      buildingBlockKey: 'BLOCK_KEY',
      price: 6000
    }

    And we found a buildingBlock for such estimation:

      id: 13,
      key: 'BLOCK_KEY',
      privateConfig: {
        priceItems: {
          community: 3456,
          topcoder_service: '20%',
          fee: 1234
        }
      }

    Than 3 estimation item records would be created:

    [
      { price: 3456, type: 'community', projectEstimationId: 7, markupUsedReference: 'buildingBlock', markupUsedReferenceId: 13 },
      { price: 1200, type: 'topcoder_service', projectEstimationId: 7, markupUsedReference: 'buildingBlock', markupUsedReferenceId: 13 },
      { price: 1234, type: 'fee', projectEstimationId: 7, markupUsedReference: 'buildingBlock', markupUsedReferenceId: 13 }
    ]
Notes:
  • calculation using buildingBlocks would happened only once during project creation. As project is just created, so we just create new one and we don't have to remove existent ones, as there are no existent estimation items for a new project.
  • we don't have any logic to recalculate price estimation on using buildingBlocks. Candiate events to do so in the future:
    • when we change the project scope. So far we don't update estimations records when we update project scope, thus we don't recalculate estimations items also
    • when we change buildingBlocks records. Not sure if project estimation items should be recalculated or no in such case. Though so far we don't have any API to mange buildingBlocks thus we don't have any events to recalculate estimation items. Note, putting such logic may trigger recalculation estimation items for multiple projects

Calculate estimation items using ProjectSettings

Clone this wiki locally