@staticmethod
    def monitoring_onaccept(form):
        """
            Update the illness status of the case from last monitoring entry
        """

        formvars = form.vars
        try:
            record_id = formvars.id
        except AttributeError:
            return

        db = current.db
        s3db = current.s3db

        ctable = s3db.disease_case
        mtable = s3db.disease_case_monitoring

        # Get the case ID
        case_id = None
        if formvars not in "case_id":
            query = (mtable.id == record_id)
            row = db(query).select(mtable.case_id, limitby=(0, 1)).first()
            if row:
                case_id = row.case_id
        else:
            case_id = formvars.case_id
        if not case_id:
            return

        query = (mtable.case_id == case_id) & \
                (mtable.illness_status != None)

        row = db(query).select(mtable.illness_status,
                               orderby = "disease_case_monitoring.date desc",
                               limitby = (0, 1)).first()
        if row:
            db(ctable.id == case_id).update(illness_status = row.illness_status)
            # Propagate case status to contacts
            disease_propagate_case_status(case_id)
        return

# =============================================================================
dataset/ETHPy150Open sahana/eden/modules/s3db/disease.py/CaseTrackingModel.monitoring_onaccept/swapped operands of `not in`