Details
-
Type: Task
-
Status: Open
-
Priority: Major
-
Resolution: Unresolved
-
Affects Version/s: 4.7
-
Fix Version/s: None
-
Component/s: None
-
Labels:
-
Versioning Impact:Patch (backwards-compatible bug fixes)
-
Documentation Required?:None
-
Epic Link:
-
Funding Source:Needs Funding
-
Verified?:No
Description
The requirement is we need a way to keep a record of the duration of each case. A case duration is any time frame between a case appears to be in a status with open class and same case appears to be in a status with close class.
Therefore a case's duration should be:
1. If a case is currently open:
CASE_OPEN to TODAY
2. If a case is currently closed:
(CASE_OPEN to CASE_1ST_CLOSE) + (CASE_1ST_REOPEN to CASE_2ND_CLOSE) + ... + (CASE_NTH_REOPEN to CASE_N+1TH_CLOSE)
3. If a case is currently reopened:
(CASE_OPEN to CASE_1ST_CLOSE) + (CASE_1ST_REOPEN to CASE_2ND_CLOSE) + ... + (CASE_NTH_REOPEN to TODAY)
A/C:
The following components need to be created in order to fulfil the requirement:
1. There should be a integer "Case duration" field in the case table to store the duration information. It uses day as unit. e.g. if a case has value 5 in "Case duration" field, in the UI, it should say "Case duration: 5 days"; 7 - "Case duration: 1 week"; 30 "Case duration: 1 month" and so on.
2. We need to mark the dates for a case when it is :
- firstly opened - we already have case_start_date and "Open Case" activity
- changed from a status with open class to a status with closed class - create a "Case Closed" activity, "Case Closed" is a new activity type
- changed from a status with close class to a status with open class - create a "Case Reopened" activity, "Case Reopened" is a new activity type
3. A schedule job "Calculate Case Duration" needs to be created to actively update the "Case duration" field for cases:
- that are in a status with open class
- that are in a status with close class and the case modified date is later than the last job run
The duration calculation should follow the following formula above.
4. (Optional) currently change a case status, it doesn't allow user to choose which date the status is changed. We should allow that.