updating logic

Following is the logic
Definitions of Case Properties
current_assignment: whatever type of user (cati, cati_tl, fida, fida_tl) that the case is currently assigned to
next_assignment: whatever type of user (fida, fida_tl) that we want to assign the case to
cati_status: could be skipped, timed_out, manually_assigned_to_field depending on what happened at the CATI-level
last_cati_user: the name of the CATI (based on group so this will still list the cati's username even if assigned to cati-tl) that case was last assigned to
last_cati_assignment: the type of cati that the user was last assigned to (cati or cati_tl)
closed_status: the status of the case and why it was closed
last_user: the name of the FIDA or CATI (based on the group, this will still list the FIDA's or CATI
last_assignment: who case was last assigned to (cati, cati_tl, fida, fida_tl)


Assignment Directly from Registration
Assign Cases to Call Center (Use Case 1)
If the case property next_assignment = '' and current_assignment = '' and today() - date_admission is <= 21 days, do the following:
- set current_assignment to "cati" 
- set owner_id to the CATI group specified in the fixture for the case's site. 

Assign Cases Directly To Field (Use Case 3a)
If case property current_assignment is blank and next_assignment is blank and today() - date_admission > 21 and today() - date_admission <= 42, do the following:
- set current_assignment to 'fida'
- set owner_id to the FIDA group specified in the fixture for the case's site
- set cati_status to 'skipped'

Assign Cases Directly to Lost to Follow Up
If case property current_assignment is blank and next_assignment is blank and today() - date_admission > 42 do the following:
- set cati_status to 'skipped'
- set closed_status to "timed_out_lost_to_follow_up"
- set last_assignment to blank
- close the case

Assignment from Call Center
Assign Cases to Field (manually by call center)
If case property next_assignment = 'fida' and today()-date_admission <= 42 days, do the following:
- set last_cati_user to whatever the cati username is for the group that case is currently assigned to
- set current assignment to "fida"
- set next_assignment to ''
- set owner_id to the FIDA group specified in the fixture for the case's site
- set 'cati_status' to 'manually_assigned_to_field'

Assign cases to field (automatically)
If case property current_assignment = 'cati' or 'cati_tl' and today()-date_admission is > 21 and today() - date_admission <= 42, do the following:
- set last_cati_assignment to whatever current_assignment is
- set last_cati_user to whatever the cati username is for the group that case is currently assigned to
- set cati_status to 'timed_out'
- set current_assignment to 'fida'
- set next_assignment to ''
- set owner_id to the FIDA group specified in the fixture for the case's site

Assign Cases to Lost to Follow Up
If case property current_assignment = 'cati' or 'cati_tl' and today()-date_admission is > 42, do the following:
- set last_cati_assignment to whatever current_assignment is
- set last_cati_user to whatever the cati username is for the group that case is currently assigned to
- set cati_status to 'timed_out'
- set last_assignment to current_assignment
- set last_user to whatever the cati username is for the group that case is currently assigned to
- set current_assignment to ''
- set next_assignment to ''
- set closed_status to "timed_out_lost_to_follow_up"
- close the case

Assignment from Field
Assign Cases to Lost to Follow Up
If case property current_assignment = 'fida' or 'fida_tl' and today()-date_admission is > 42, do the following:
- set last_assignment to current_assignment
- set last_user to whatever the username is for the group that case is currently assigned to
- set current_assignment to ''
- set next_assignment to ''
- set closed_status to "timed_out_lost_to_follow_up"
- close the case