[Ils-source] r1533 - trunk/webapp/api/courseattempt/get

scribe at crosswire.org scribe at crosswire.org
Tue Apr 25 15:49:05 MST 2017


Author: scribe
Date: 2017-04-25 15:49:05 -0700 (Tue, 25 Apr 2017)
New Revision: 1533

Modified:
   trunk/webapp/api/courseattempt/get/index.jsp
Log:
Applying Adam's patch to add course attempt data lookup by user profle userdata key


Modified: trunk/webapp/api/courseattempt/get/index.jsp
===================================================================
--- trunk/webapp/api/courseattempt/get/index.jsp	2017-04-25 22:47:28 UTC (rev 1532)
+++ trunk/webapp/api/courseattempt/get/index.jsp	2017-04-25 22:49:05 UTC (rev 1533)
@@ -7,6 +7,7 @@
 <%@ page import="com.resolutions.ils.ILSSession" %>
 <%@ page import="com.resolutions.ils.data.Company" %>
 <%@ page import="com.resolutions.ils.data.CourseAttempt" %>
+<%@ page import="com.resolutions.ils.data.UserProfile" %>
 <%@ page import="java.util.Vector" %>
 <%@ page import="java.util.Date" %>
 <%@ page import="java.util.TimeZone" %>
@@ -63,7 +64,17 @@
 	int courseAttemptID = -1; try { courseAttemptID = Integer.parseInt( request.getParameter("courseAttemptID") ); } catch(Exception e) {}
 	int userProfileID = -1; try { userProfileID = Integer.parseInt(request.getParameter("userProfileID")); } catch(Exception e) {};
 	int courseID = -1;  try { courseID = Integer.parseInt(request.getParameter("courseID")); } catch(Exception e) {};
+	String userProfileUserData = request.getParameter("userProfileUserData");
 
+	if (userProfileID == -1 && userProfileUserData != null && !userProfileUserData.isEmpty()) {
+		UserProfile up = UserProfile.getUserProfileByUserData(ilsSession, userProfileUserData);
+		if (up == null) {
+			out.print("<error message=\"UserProfileUserData: " + userProfileUserData + " not found.\"/>");
+			return;
+		}
+		userProfileID = up.getUserProfileID();
+	}
+
 	++errCode;
 	String val = request.getParameter("startDateTime");
 	Date startDateTime = null;
@@ -124,6 +135,7 @@
 <tr><th>startDateTime</th><td>retrieve a set of course attempts by filters, the start of the date and time range for which to retrieve Course Attempt records by completion date, inclusive (yyyyMMddHHmm), e.g., 201201240000</td></tr>
 <tr><th>endDateTime</th><td>the end of the date and time range for which to retrieve Course Attempt records by completion date, exclusive (yyyyMMddHHmm), e.g., 201201250000</td></tr>
 <tr><td><b>userProfileID</b></td><td>restrict results to a single user</td></tr>
+<tr><td><b>userProfileUserData</b></td><td>restrict results to a single user by their user data</td></tr>
 <tr><td><b>courseID</b></td><td>restrict results to a single course</td></tr>
 <tr><th>detail</th><td>(complete), brief, headeronly</td></tr>
 <tr><th>ILSUSER</th><td>ILS Login Credentials. Used to validate this API request.</td></tr>




More information about the Ils-source mailing list