void DiagnosticTreatNeg::Update( float dt ) { //bool wasDistributed = false; if ( expired ) { return; // don't give expired intervention. should be cleaned up elsewhere anyways, though. } // You have already been chosen to not default, count down the time until your intervention days_to_diagnosis -= dt; LOG_DEBUG_F( "Individual %d will not default and has a diagnosis but has %f more days until the intervention is distributed.\n", parent->GetSuid().data, float(days_to_diagnosis) ); // Give the intervention if the test has come back if( days_to_diagnosis <= 0 ) { LOG_DEBUG_F("Individual %d finished counting down days_to_diagnosis, my treatment outcome flag is %d \n", parent->GetSuid().data, m_gets_positive_test_intervention); if (m_gets_positive_test_intervention) { positiveTestDistribute(); } else { negativeTestDistribute(); } } }
void DiagnosticTreatNeg::onDiagnosisComplete( float dt ) { // Give the intervention if the test has come back LOG_DEBUG_F("Individual %d finished counting down days_to_diagnosis, my treatment outcome flag is %d \n", parent->GetSuid().data, m_gets_positive_test_intervention); if (m_gets_positive_test_intervention) { positiveTestDistribute(); } else { negativeTestDistribute(); } }
//if negative test result, either distribute the negative test intervention now, or note you got a negative test and count your days_to_diagnosis down void DiagnosticTreatNeg::onNegativeTestResult() { LOG_DEBUG("Negative test Result function\n"); m_gets_positive_test_intervention = false; LOG_DEBUG_F("Reset test result flag to %d \n", m_gets_positive_test_intervention); if( !SMART_DRAW( getTreatmentFractionNegative() ) ) { onPatientDefault(); expired = true; // this person doesn't get the negative intervention despite the negative test } else if ( days_to_diagnosis <= 0 ) { negativeTestDistribute(); // since there is no waiting time, distribute intervention right now } //else we have to wait for days_to_diagnosis to count down until person gets negative intervention }