Skip to content

Commit

Permalink
Add error log
Browse files Browse the repository at this point in the history
  • Loading branch information
jmontoyaa committed Sep 7, 2016
1 parent b1fe431 commit b3fb82e
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions main/inc/lib/sessionmanager.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -2402,7 +2402,7 @@ public static function relation_session_course_exist($session_id, $courseId)

/**
* Get the session information by name
* @param string session name
* @param string $session_name
* @return mixed false if the session does not exist, array if the session exist
* */
public static function get_session_by_name($session_name)
Expand Down Expand Up @@ -4284,7 +4284,6 @@ public static function importCSV(
$my_session_result = self::get_session_by_name($enreg['SessionName']);
}


if ($my_session_result === false) {

// Creating a session.
Expand Down Expand Up @@ -4338,10 +4337,6 @@ public static function importCSV(
}
}
} else {
if ($debug) {
$logger->addError("Sessions - Session to be updated: $session_name");
}

// Updating the session.
$params = array(
'id_coach' => $coach_id,
Expand Down Expand Up @@ -4369,8 +4364,12 @@ public static function importCSV(
}
$session_id = $sessionId;
} else {
$row = Database::query("SELECT id FROM $tbl_session WHERE name = '$session_name'");
list($session_id) = Database::fetch_array($row);
$my_session_result = SessionManager::get_session_by_name($session_name);
$session_id = $my_session_result['id'];
}

if ($debug) {
$logger->addError("Sessions - Session #$session_id to be updated: '$session_name'");
}

if ($session_id) {
Expand Down

1 comment on commit b3fb82e

@ywarnier
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, but there are cases where the session can be non-unique (at ICPNA for example), so I wouldn't use the session name to identify a session, in general.

Please sign in to comment.