Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to show retired courses in enrolment list API through param flag - cbrelease-4.8.4 #79

Open
wants to merge 1 commit into
base: cbrelease-4.8.4
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ class CourseEnrolmentActor @Inject()(@Named("course-batch-notification-actor") c
var userCoursesDao: UserCoursesDao = new UserCoursesDaoImpl()
var batchUserDao : BatchUserDao = new BatchUserDaoImpl()
var groupDao: GroupDaoImpl = new GroupDaoImpl()
val isRetiredCoursesIncludedInEnrolList = if (StringUtils.isNotBlank(ProjectUtil.getConfigValue("enrolment_list_include_retired_courses")))
(ProjectUtil.getConfigValue("enrolment_list_include_retired_courses")).toBoolean else false
var isRetiredCoursesIncludedInEnrolList = false
val isCacheEnabled = if (StringUtils.isNotBlank(ProjectUtil.getConfigValue("user_enrolments_response_cache_enable")))
(ProjectUtil.getConfigValue("user_enrolments_response_cache_enable")).toBoolean else true
val ttl: Int = if (StringUtils.isNotBlank(ProjectUtil.getConfigValue("user_enrolments_response_cache_ttl")))
Expand Down Expand Up @@ -126,6 +125,13 @@ class CourseEnrolmentActor @Inject()(@Named("course-batch-notification-actor") c

def list(request: Request): Unit = {
val userId = request.get(JsonKey.USER_ID).asInstanceOf[String]
val urlQueryString = request.getContext.get(JsonKey.URL_QUERY_STRING).asInstanceOf[String]
val paramMap = urlQueryString
.split("&")
.map(_.split("="))
.collect { case Array(key, value) => key -> value }
.toMap
isRetiredCoursesIncludedInEnrolList = paramMap.getOrElse(JsonKey.RETIRED_COURE_ENABLED, JsonKey.FALSE).toBoolean
val courseIdList = request.get(JsonKey.COURSE_IDS).asInstanceOf[java.util.List[String]]
logger.info(request.getRequestContext,"CourseEnrolmentActor :: list :: UserId = " + userId)
try{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1083,6 +1083,8 @@ public final class JsonKey {
public static final String PRIMARY_CATEGORY_BLENDED_PROGRAM = "Blended Program";
public static final String COURSE_BATCH_ENROLL_END_DATE_LESS = "enrol_end_date_allow_lesser_value";
public static final String BATCH_ATTRIBUTES_KEY = "batch_attributes";

public static final String RETIRED_COURE_ENABLED = "retiredCoursesEnabled";
public static final String FALSE = "false";

private JsonKey() {}
}