tx-io: Write branch_transaction.dest_id after successfully import.

skala
Marco Villegas 12 years ago
parent 2ac6406e12
commit 1236af201e
  1. 3
      src/ChamiloLMS/Transaction/ExerciseAttemptTransactionLog.php
  2. 4
      src/ChamiloLMS/Transaction/TransactionLog.php
  3. 3
      src/ChamiloLMS/Transaction/TransactionLogController.php

@ -126,5 +126,8 @@ class ExerciseAttemptTransactionLog extends TransactionLog
$nano = null; $nano = null;
$attempt_answer_id = saveExerciseAttempt($attempt_answer_info['marks'], $attempt_answer_info['answer'], $question_id, $imported_exe_id, $attempt_answer_info['position'], $exercise_id, $nano, $user_id, $course_id, $stat_info['session_id'], $stat_info['orig_lp_id'], $stat_info['orig_lp_item_id']); $attempt_answer_id = saveExerciseAttempt($attempt_answer_info['marks'], $attempt_answer_info['answer'], $question_id, $imported_exe_id, $attempt_answer_info['position'], $exercise_id, $nano, $user_id, $course_id, $stat_info['session_id'], $stat_info['orig_lp_id'], $stat_info['orig_lp_item_id']);
} }
// Finally return the associated id.
return $imported_exe_id;
} }
} }

@ -274,6 +274,10 @@ abstract class TransactionLog
* @trows TransactionImportException * @trows TransactionImportException
* If any step for re-creating the element fails, an exception should be * If any step for re-creating the element fails, an exception should be
* raised. * raised.
*
* @return string
* The item id corresponding to the imported information in the
* destination system.
*/ */
abstract public function import(); abstract public function import();

@ -163,9 +163,10 @@ class TransactionLogController
continue; continue;
} }
try { try {
$transaction->import(); $imported_item_id = $transaction->import();
$log_entry['message'] = 'Successfully imported.'; $log_entry['message'] = 'Successfully imported.';
$transaction->status_id = TransactionLog::STATUS_SUCCESSFUL; $transaction->status_id = TransactionLog::STATUS_SUCCESSFUL;
$transaction->dest_id = $imported_item_id;
$imported_ids['success'][] = $transaction->id; $imported_ids['success'][] = $transaction->id;
} catch (Exception $import_exception) { } catch (Exception $import_exception) {
$log_entry['message'] = $import_exception->getMessage(); $log_entry['message'] = $import_exception->getMessage();

Loading…
Cancel
Save