pub fn merge_task(&mut self, task_transfer: &TaskTransfer) {
        let mut task = self
            .find_task_by_transfer_mut(&task_transfer)
            .expect_throw("could not find task to merge");

        // unassign it from the human
        task.assigned = None;
        // remove progress
        task.progress = 0.;

        // get task properties for calculations
        let kind = task.kind;
        let bugs = task.bugs;
        let difficulty = task.difficulty;
        let task_score = task.score * 1_000;

        // add score
        self.total_score = ((self.total_score as i32).saturating_add(task_score).max(0)) as u32;
        self.score_in_month += task_score;

        // add bugs
        self.bugs += bugs;

        // add complexity
        match kind {
            TaskKind::Bug => {
                self.complexity += difficulty / 5;
                // remove bug that was upstream
                self.bugs = self.bugs.saturating_sub(1);
            }
            TaskKind::Normal => {
                self.complexity += 1 + difficulty / 4;
            }
            TaskKind::Chore => {
                self.complexity = self.complexity.saturating_sub(2 + difficulty / 4);
            }
        }

        // update score linger rate
        self.update_score_linger_rate();
    }
/// Merge the given task upstream,
/// applying changes to state as necessary.
Merge the given task upstream,
applying changes to state as necessary.
Merge the given task upstream applying changes to state as necessary .
pub fn merge_task(&mut self, task_transfer: &TaskTransfer) {
        let mut task = self
            .find_task_by_transfer_mut(&task_transfer)
            .expect_throw("could not find task to merge");
        // unassign it from the human
        task.assigned = None;
        // remove progress
        task.progress = 0.;
        // get task properties for calculations
        let kind = task.kind;
        let bugs = task.bugs;
        let difficulty = task.difficulty;
        let task_score = task.score * 1_000;
        // add score
        self.total_score = ((self.total_score as i32).saturating_add(task_score).max(0)) as u32;
        self.score_in_month += task_score;
        // add bugs
        self.bugs += bugs;
        // add complexity
        match kind {
            TaskKind::Bug => {
                self.complexity += difficulty / 5;
                // remove bug that was upstream
                self.bugs = self.bugs.saturating_sub(1);
            }
            TaskKind::Normal => {
                self.complexity += 1 + difficulty / 4;
            }
            TaskKind::Chore => {
                self.complexity = self.complexity.saturating_sub(2 + difficulty / 4);
            }
        }
        // update score linger rate
        self.update_score_linger_rate();
    }
pub fn merge_task ( & mut self , task_transfer : & TaskTransfer ) { let mut task = self . find_task_by_transfer_mut ( & task_transfer ) . expect_throw ( " " ) ; // unassign it from the human task . assigned = None ; // remove progress task . progress = 0. ; // get task properties for calculations let kind = task . kind ; let bugs = task . bugs ; let difficulty = task . difficulty ; let task_score = task . score * 1_000 ; // add score self . total_score = ( ( self . total_score as i32 ) . saturating_add ( task_score ) . max ( 0 ) ) as u32 ; self . score_in_month += task_score ; // add bugs self . bugs += bugs ; // add complexity match kind { TaskKind :: Bug => { self . complexity += difficulty / 5 ; // remove bug that was upstream self . bugs = self . bugs . saturating_sub ( 1 ) ; } TaskKind :: Normal => { self . complexity += 1 + difficulty / 4 ; } TaskKind :: Chore => { self . complexity = self . complexity . saturating_sub ( 2 + difficulty / 4 ) ; } } // update score linger rate self . update_score_linger_rate ( ) ; }
Merge the given task upstream,
applying changes to state as necessary.
Merge the given task upstream applying changes to state as necessary .
&mut self
task_transfer
&TaskTransfer
&mut self
task_transfer
&TaskTransfer