You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: course_user_datum.rb
    path of file: ./repos/Autolab/app/models
    
    the code of the file until where you have to start completion: require "association_cache"

c
    
  def global_grace_days_left!
    latest_asmt = course.assessments.ordered.last

    if latest_asmt.nil?
      # Just don't cache anything since no database query is necessary
      course.grace_days
    else
      # do the usual database query and calculate
      cur_aud = AssessmentUserDatum.get(latest_asmt.id, id)
      return course.grace_days if cur_aud.nil?

      (course.grace_days - cur_aud.global_cumulative_grace_days_used)
    end
  end

  include CUDAssociationCache
end