fixed query to get order_id for adherence script