Any person subject to this code who is found to be under the influence of alcohol or a controlled substance as defined in section 192A.566 without a valid medical prescription while on duty or sleeping upon an assigned post, or who leaves that post before being regularly relieved, shall be punished as a court-martial may direct.