 # Local (client-only) document of importing files
 class ImportingFile extends Document
   # name: user's file name
+  # status: current status or error message
   # readProgress: progress of reading from file, in %
   # uploadProgress: progress of uploading file, in %
   # preprocessingProgress: progress of file preprocessing, in %
-  # status: current status or error message
   # finished: true when importing has finished
   # errored: true when there was an error
   # canceled: true when user cancels import


  reader = new FileReader()
  reader.onload = ->
    importingFiles[document._id].content = @result
    testPDF importingFiles[document._id], ->
      computeChecksum importingFiles[document._id], (error, result) ->
        if error
          ImportingFile.documents.update document._id,
            $set:


# Process next element from import queue
Deps.autorun ->
  # Autorun will not re-run until the same document does not have finished
  # or errored fields set, but after they are set, next file will be returned
  document = ImportingFile.documents.findOne
    finished: false
    errored: false
