import logging


def _get_task_counts(rows):
    """Calculcate number of true/false tasks and maximum achievable score."""
    count_true = count_false = 0
    max_score = None
    for row in rows:
        if not row.id.property:
            logging.info("Missing property for task %s.", row.id)
            continue
        expected_result = row.id.expected_result
        if not expected_result:
            continue
        if expected_result.result is True:
            count_true += 1
        elif expected_result.result is False:
            count_false += 1
        row_max_score = row.id.property.max_score(expected_result)
        if row_max_score is not None:
            max_score = row_max_score + (max_score or 0)

    return max_score, count_true, count_false