Skip to content

Commit

Permalink
Online Student Scheduling: Banner XE Interface
Browse files Browse the repository at this point in the history
- if PIN is required (and none is given), but there are some other error message — do not hide the other error messages
- when used by admin: use RE (Registered) instead of RW (Web Registered) action
  • Loading branch information
tomas-muller committed Sep 30, 2015
1 parent 38fa5bd commit ad30fd3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,23 +98,21 @@ public static class Registration {

public List<RegistrationAction> registrationActions;

public boolean canDrop() {
public boolean can(String status) {
if (registrationActions != null)
for (RegistrationAction action: registrationActions) {
if ("DW".equals(action.courseRegistrationStatus))
if (status.equals(action.courseRegistrationStatus))
return true;
}
return false;
}

public boolean canDrop() {
return can("DW");
}

public boolean canAdd() {
// return !"DD".equals(courseRegistrationStatus);
if (registrationActions != null)
for (RegistrationAction action: registrationActions) {
if ("RW".equals(action.courseRegistrationStatus))
return true;
}
return false;
public boolean canAdd(boolean admin) {
return can(admin ? "RE" : "RW");
}

public boolean isRegistered() {
Expand Down Expand Up @@ -215,14 +213,12 @@ public RegisterRequest keep(String crn) {
public RegisterRequest add(String crn, boolean changeStatus) {
if (changeStatus) {
if (actionsAndOptions == null) actionsAndOptions = new ArrayList<RegisterAction>();
actionsAndOptions.add(new RegisterAction("RW", crn));
actionsAndOptions.add(new RegisterAction("SB".equals(systemIn) ? "RE" : "RW", crn));
} else {
if (courseReferenceNumbers == null)
courseReferenceNumbers = new ArrayList<XEInterface.CourseReferenceNumber>();
if ("SB".equals(systemIn))
courseReferenceNumbers.add(new CourseReferenceNumber(crn, "RW"));
else
courseReferenceNumbers.add(new CourseReferenceNumber(crn));
// if ("SB".equals(systemIn)) courseReferenceNumbers.add(new CourseReferenceNumber(crn, "RW")); else
courseReferenceNumbers.add(new CourseReferenceNumber(crn));
}
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,19 +258,23 @@ public void checkEligibility(OnlineSectioningServer server, OnlineSectioningHelp
if (original == null || !original.validStudent) {
String bannerRecheck = getBannerRecheck();
String reason = null;
boolean noreason = true;
boolean recheck = true;
if (original != null && original.failureReasons != null) {
for (String m: original.failureReasons) {
if ("Your PIN is invalid.".equals(m))
check.setFlag(EligibilityFlag.PIN_REQUIRED, true);
if (bannerRecheck == null || !m.matches(bannerRecheck)) recheck = false;
noreason = false;
if ("Your PIN is invalid.".equals(m)) {
check.setFlag(EligibilityFlag.PIN_REQUIRED, true);
if (pin == null || pin.isEmpty()) continue;
}
if (reason == null)
reason = m;
else
reason += "<br>" + m;
}
}
if (reason == null) {
if (noreason) {
reason = "Failed to check student registration eligility.";
if (bannerRecheck == null || !reason.matches(bannerRecheck)) recheck = false;
}
Expand All @@ -279,9 +283,6 @@ public void checkEligibility(OnlineSectioningServer server, OnlineSectioningHelp
} else {
check.setFlag(EligibilityFlag.CAN_ENROLL, false);
}
if (check.hasFlag(EligibilityFlag.PIN_REQUIRED) && (pin == null || pin.isEmpty())) {
return;
}
check.setMessage(reason);
} else if (student.getStudentId() == null) {
check.setMessage("UniTime enrollment data are not synchronized with Banner enrollment data, please try again later.");
Expand Down Expand Up @@ -376,8 +377,9 @@ public List<EnrollmentFailure> enroll(OnlineSectioningServer server, OnlineSecti
resource.setChallengeResponse(ChallengeScheme.HTTP_BASIC, getBannerUser(), getBannerPassword());
Gson gson = getGson(helper);
XEInterface.RegisterResponse original = null;

if (isBannerAdmin() && helper.getUser().getType() == OnlineSectioningLog.Entity.EntityType.MANAGER) {
boolean admin = (isBannerAdmin() && helper.getUser().getType() == OnlineSectioningLog.Entity.EntityType.MANAGER);

if (admin) {
// ADMIN: POST empty request with systemIn filled in
XEInterface.RegisterRequest req = new XEInterface.RegisterRequest(term, getBannerId(student), pin, true);
helper.getAction().addOptionBuilder().setKey("term").setValue(req.term);
Expand Down Expand Up @@ -471,7 +473,7 @@ public List<EnrollmentFailure> enroll(OnlineSectioningServer server, OnlineSecti
nodrop.add(reg.courseReferenceNumber);
} else {
notregistered.add(reg.courseReferenceNumber);
if (!reg.canAdd())
if (!reg.canAdd(admin))
noadd.add(reg.courseReferenceNumber);
}
}
Expand Down

0 comments on commit ad30fd3

Please sign in to comment.