'Generate values to write after recomputation of a goal score'

def _get_write_values(self, new_value):

    if (new_value == self.current):
        return {}
    result = {'current': new_value}
    if (((self.definition_id.condition == 'higher') and (new_value >= self.target_goal)) or ((self.definition_id.condition == 'lower') and (new_value <= self.target_goal))):
        result['state'] = 'reached'
    elif (self.end_date and (fields.Date.today() > self.end_date)):
        result['state'] = 'failed'
        result['closed'] = True
    return {self: result}
