Adding evaluation type constants + minor fixes

skala
Julio Montoya 13 years ago
parent bdbbf660a3
commit 3e55079f0b
  1. 3
      main/inc/lib/database.constants.inc.php
  2. 5
      tests/migrate/migration.class.php
  3. 8
      tests/migrate/migration.custom.class.php
  4. 2
      tests/migrate/migration.mssql.class.php

@ -50,6 +50,7 @@ define('TABLE_MAIN_COURSE_REQUEST', 'course_request');
// Gradebook
define('TABLE_MAIN_GRADEBOOK_CATEGORY', 'gradebook_category');
define('TABLE_MAIN_GRADEBOOK_EVALUATION', 'gradebook_evaluation');
define('TABLE_MAIN_GRADEBOOK_EVALUATION_TYPE', 'gradebook_evaluation_type');
define('TABLE_MAIN_GRADEBOOK_LINKEVAL_LOG', 'gradebook_linkeval_log');
define('TABLE_MAIN_GRADEBOOK_RESULT', 'gradebook_result');
define('TABLE_MAIN_GRADEBOOK_RESULT_LOG', 'gradebook_result_log');
@ -57,6 +58,8 @@ define('TABLE_MAIN_GRADEBOOK_LINK', 'gradebook_link');
define('TABLE_MAIN_GRADEBOOK_SCORE_DISPLAY','gradebook_score_display');
define('TABLE_MAIN_GRADEBOOK_CERTIFICATE', 'gradebook_certificate');
//Profiling
define('TABLE_MAIN_USER_FIELD', 'user_field');
define('TABLE_MAIN_USER_FIELD_OPTIONS', 'user_field_options');

@ -95,7 +95,6 @@ class Migration {
public function migrate($matches) {
error_log("\n".'------------ Migration->migrate function called ------------'."\n");
$extra_fields = array();
// Browsing through 1st-level arrays in db_matches.php
foreach ($matches as $table) {
error_log('Found table ' . $table['orig_table'] . ' in db_matches');
@ -142,7 +141,7 @@ class Migration {
}
//Stop here (only for tests)
if ($table['orig_table'] == 'ProgramaAcademico') {
if ($table['orig_table'] == 'gradebook_evaluation_type') {
exit;
}
}
@ -326,6 +325,8 @@ class Migration {
* @return void
*/
private function _create_extra_fields(&$table) {
$extra_fields = array();
error_log('Inserting (if exists) extra fields for : ' . $table['dest_table']." \n");
foreach ($table['extra_fields'] as $extra_field) {
error_log('Preparing for insertion of extra field '.$extra_field['field_display_text']."\n");

@ -448,6 +448,9 @@ class MigrationCustom {
static function add_evaluation_type($params) {
$table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_EVALUATION_TYPE);
if (!empty($params['name']) && !empty($params['external_id'])) {
if (isset($params['return_item_if_already_exists'])) {
unset($params['return_item_if_already_exists']);
}
Database::insert($table, $params);
}
}
@ -458,7 +461,7 @@ class MigrationCustom {
$sql = "SELECT * FROM $table WHERE external_id = $external_id";
$result = Database::query($sql);
if (Database::num_rows($result)) {
$result = Database::store_result($sql);
$result = Database::fetch_array($result, 'ASSOC');
return $result['id'];
}
return false;
@ -466,8 +469,8 @@ class MigrationCustom {
static function create_gradebook_links($data){
error_log('create_gradebook_links');
$session_id = isset($data['session_id']) ? $data['session_id'] : null;
$session_id = $data['session_d'];
if (!empty($session_id)) {
$course_list = SessionManager::get_course_list_by_session_id($session_id);
if (!empty($course_list)) {
@ -476,6 +479,7 @@ class MigrationCustom {
//Get gradebook
$gradebook = new Gradebook();
$gradebooks = $gradebook->get_all(array('where' => array('course_code = ? AND session_id = ?' => array($course_data['code'], $session_id))));
print_r($gradebooks);
} else {
error_log("Something is wrong with the course ");
}

@ -39,7 +39,7 @@ class MigrationMSSQL extends Migration {
}
if (in_array($table, array('ProgramaAcademico', 'Matricula'))) {
//$top = " TOP 1000 ";
$top = " TOP 1000 ";
}
//$top = null;

Loading…
Cancel
Save