code: def _job_done_callback(self, submissionid, task, result, grade, problems, tests, custom, state, archive, stdout, stderr, newsub=True):
          
          submission = self.get_submission(submissionid, False)
          submission = self.get_input_from_submission(submission)
  
          data = {
              "status": ("done" if result[0] == "success" or result[0] == "failed" else "error"),
               # error only if error was made by INGInious
              "result": result[0],
              "grade": grade,
              "text": result[1],
              "tests": tests,
              "problems": problems,
              "archive": (self._gridfs.put(archive) if archive is not None else None),
              "custom": custom,
              "state": state,
              "stdout": stdout,
              "stderr": stderr
          }
  
          unset_obj = {
              "jobid": "",
              "ssh_host": "",
              "ssh_port": "",
              "ssh_password": ""
          }
  
          # Save submission to database
          submission = self._database.submissions.find_one_and_update(
              {"_id": submission["_id"]},
              {"$set": data, "$unset": unset_obj},
              return_document=ReturnDocument.AFTER
          )
  
          self._hook_manager.call_hook("submission_done", submission=submission, archive=archive, newsub=newsub)
  
          for username in submission["username"]:
              self._user_manager.update_user_stats(username, task, submission, result[0], grade, state, newsub)
  
          if "outcome_service_url" in submission and "outcome_result_id" in submission and "outcome_consumer_key" in submission:
              for username in submission["username"]:
                  self._lti_outcome_manager.add(username,
                                                submission["courseid"],
                                                submission["taskid"],
                                                submission["outcome_consumer_key"],
                                                submission["outcome_service_url"],
                                                submission["outcome_result_id"])
docs: Callback called by Client when a job is done. Updates the submission in the database with the data returned after the completion of the
          job