use of teammates.common.util.GaeVersionApi in project teammates by TEAMMATES.
the class AdminActivityLogPageAction method getVersionsForQuery.
/**
* Selects versions for query. If versions are not specified, it will return
* MAX_VERSIONS_TO_QUERY most recent versions used for query.
*/
private List<String> getVersionsForQuery(List<String> versions) {
boolean isVersionSpecifiedInRequest = versions != null && !versions.isEmpty();
if (isVersionSpecifiedInRequest) {
return versions;
}
GaeVersionApi versionApi = new GaeVersionApi();
return versionApi.getMostRecentVersions(MAX_VERSIONS_TO_QUERY);
}
use of teammates.common.util.GaeVersionApi in project teammates by TEAMMATES.
the class AdminActivityLogPageAction method generateStatusMessage.
private void generateStatusMessage(List<String> versionToQuery, AdminActivityLogPageData data, List<ActivityLogEntry> logs, String courseId) {
StringBuilder status = new StringBuilder(500);
status.append("Total Logs gone through in last search: " + totalLogsSearched + "<br>Total Relevant Logs found in last search: " + String.format("%s<br>", logs.size()));
long earliestSearchTime = data.getFromDate();
ActivityLogEntry earliestLogChecked = null;
if (!logs.isEmpty()) {
earliestLogChecked = logs.get(logs.size() - 1);
}
// if the search space is limited to a certain log
if (logs.size() >= RELEVANT_LOGS_PER_PAGE && earliestLogChecked != null) {
earliestSearchTime = earliestLogChecked.getLogTime();
}
ZoneId targetTimeZone = null;
if (data.isPersonSpecified()) {
String targetUserGoogleId = data.getPersonSpecified();
targetTimeZone = getLocalTimeZoneForRequest(targetUserGoogleId, "");
if (targetTimeZone == null && courseId != null && !courseId.isEmpty()) {
// if the user is unregistered, try finding the timezone by course id passed from Search page
targetTimeZone = getLocalTimeZoneForUnregisteredUserRequest(courseId);
}
} else {
targetTimeZone = Const.SystemParams.ADMIN_TIME_ZONE_ID;
}
String timeInAdminTimeZone = TimeHelper.formatActivityLogTime(Instant.ofEpochMilli(earliestSearchTime), Const.SystemParams.ADMIN_TIME_ZONE_ID);
String timeInUserTimeZone = TimeHelper.formatActivityLogTime(Instant.ofEpochMilli(earliestSearchTime), targetTimeZone);
status.append("The earliest log entry checked on <b>" + timeInAdminTimeZone + "</b> in Admin Time Zone (" + Const.SystemParams.ADMIN_TIME_ZONE_ID.getId() + ") and ");
if (targetTimeZone == null) {
status.append(timeInUserTimeZone).append(".<br>");
} else {
status.append("on <b>" + timeInUserTimeZone + "</b> in Local Time Zone (" + targetTimeZone + ").<br>");
}
status.append("Logs are from following version(s): ");
for (int i = 0; i < versionToQuery.size(); i++) {
String version = versionToQuery.get(i).replace('-', '.');
if (i < versionToQuery.size() - 1) {
status.append(version).append(", ");
} else {
status.append(version).append("<br>");
}
}
status.append("All available version(s): ");
GaeVersionApi versionApi = new GaeVersionApi();
List<Version> versionList = versionApi.getAvailableVersions();
for (int i = 0; i < versionList.size(); i++) {
String version = versionList.get(i).toString();
if (i < versionList.size() - 1) {
status.append(version).append(", ");
} else {
status.append(version).append("<br>");
}
}
// the "Search More" button to continue searching from the previous fromDate
status.append("<button class=\"btn-link\" id=\"button_older\" data-next-end-time-to-search=\"" + nextEndTimeToSearch + "\">Search More</button><input id=\"ifShowAll\" type=\"hidden\" value=\"" + data.getShouldShowAllLogs() + "\"/><input id=\"ifShowTestData\" type=\"hidden\" value=\"" + data.getShouldShowTestData() + "\"/>");
String statusString = status.toString();
data.setStatusForAjax(statusString);
statusToUser.add(new StatusMessage(statusString, StatusMessageColor.INFO));
}
use of teammates.common.util.GaeVersionApi in project teammates by TEAMMATES.
the class AdminEmailLogPageAction method getVersionsForQuery.
/**
* Selects versions for query. If versions are not specified, it will return
* MAX_VERSIONS_TO_QUERY most recent versions used for query.
*/
private List<String> getVersionsForQuery(List<String> versions) {
boolean isVersionSpecifiedInRequest = versions != null && !versions.isEmpty();
if (isVersionSpecifiedInRequest) {
return versions;
}
GaeVersionApi versionApi = new GaeVersionApi();
return versionApi.getMostRecentVersions(MAX_VERSIONS_TO_QUERY);
}
Aggregations