Skip to content

Commit

Permalink
Merge pull request #136 from yjx0003/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
rmartico committed Jul 18, 2024
2 parents 595ef0d + 8c5dcfd commit 2fa2af5
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 73 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>es.ubu.lsi</groupId>
<artifactId>ubumonitor</artifactId>
<version>2.10.4</version>
<version>2.10.5</version>



Expand Down
2 changes: 1 addition & 1 deletion src/main/java/es/ubu/lsi/ubumonitor/AppInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
public class AppInfo {


public static final String VERSION = "2.10.4";
public static final String VERSION = "2.10.5";

public static final String APPLICATION_VERSION = "v" + VERSION;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ public class PartitionalClusteringController {

@FXML
private ProgressIndicator progressExecute;

@FXML
private DatePicker datePickerStart;

@FXML
private DatePicker datePickerEnd;

Expand Down Expand Up @@ -221,17 +221,17 @@ private void initCollectors() {
gradesCollector = new GradesCollector(mainController);
activityCollector = new ActivityCollector(mainController);
List<LogCollector<?>> list = new ArrayList<>();
list.add(new LogCollector<>("component", mainController.getSelectionController().getListViewComponents(), DataSetComponent.getInstance(),
t -> t.name().toLowerCase()));
list.add(new LogCollector<>("event", mainController.getSelectionController().getListViewEvents(), DataSetComponentEvent.getInstance(),
t -> t.getComponent().name().toLowerCase()));
list.add(new LogCollector<>("section", mainController.getSelectionController().getListViewSection(), DataSetSection.getInstance(),
t -> t.isVisible() ? "visible" : "not_visible"));
list.add(new LogCollector<>("component", mainController.getSelectionController().getListViewComponents(),
DataSetComponent.getInstance(), t -> t.name().toLowerCase()));
list.add(new LogCollector<>("event", mainController.getSelectionController().getListViewEvents(),
DataSetComponentEvent.getInstance(), t -> t.getComponent().name().toLowerCase()));
list.add(new LogCollector<>("section", mainController.getSelectionController().getListViewSection(),
DataSetSection.getInstance(), t -> t.isVisible() ? "visible" : "not_visible"));
list.add(new LogCollector<>("coursemodule", mainController.getSelectionController().getListViewCourseModule(),
DatasSetCourseModule.getInstance(), t -> t.getModuleType().getModName()));
checkComboBoxLogs.getItems().setAll(list);
checkComboBoxLogs.getCheckModel().checkAll();

JavaFXUtils.initDatePickers(datePickerStart, datePickerEnd, checkBoxLogs);
}

Expand All @@ -244,8 +244,8 @@ protected Task<Void> createTask() {

@Override
protected Void call() throws Exception {
List<EnrolledUser> users = mainController.getSelectionUserController().getListParticipants().getSelectionModel()
.getSelectedItems();
List<EnrolledUser> users = mainController.getSelectionUserController().getListParticipants()
.getSelectionModel().getSelectedItems();
Algorithm algorithm = algorithmList.getSelectionModel().getSelectedItem();

List<DataCollector> collectors = getSelectedCollectors();
Expand All @@ -268,12 +268,17 @@ protected Void call() throws Exception {
buttonExecute.disableProperty().bind(service.runningProperty());
progressExecute.visibleProperty().bind(service.runningProperty());
service.setOnSucceeded(e -> {
silhouette.updateChart(clusters);
clusteringTableController.updateTable(clusters);
updateRename();
graph.updateChart(clusters);
graph3D.updateChart(clusters);
service.reset();
try { // #133 RMS FIXME temporal solution but the data validation should be improved...
silhouette.updateChart(clusters);
clusteringTableController.updateTable(clusters);
updateRename();
graph.updateChart(clusters);
graph3D.updateChart(clusters);
service.reset(); // set an stable state
} catch (Exception exception) { // when is not possible to draw some chart by the number of features...
service.reset(); // RMS should be really in a finally clause avoiding duplication...
LOGGER.error("Exception updating charts in clustering, review validation data: {}", exception);
}
});
service.setOnFailed(e -> {
Throwable exception = service.getException();
Expand Down Expand Up @@ -320,7 +325,8 @@ public void executeAnalysis() {
int start = (int) rangeSlider.getLowValue();
int end = (int) rangeSlider.getHighValue();

List<EnrolledUser> users = mainController.getSelectionUserController().getListParticipants().getSelectionModel().getSelectedItems();
List<EnrolledUser> users = mainController.getSelectionUserController().getListParticipants().getSelectionModel()
.getSelectedItems();
List<DataCollector> collectors = getSelectedCollectors();
AnalysisMethod analysisMethod = choiceBoxAnalyze.getValue().createAnalysis(algorithm);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,24 +69,28 @@ public String createColumns(List<CourseModule> courseModules) {
formatterParams.put("width", 16);
formatterParams.put("urlPrefix", "''");
formatterParams.put("urlSuffix", "''");

String stringFormatterParams = formatterParams.toString();

for (CourseModule courseModule : courseModules) {
jsObject = new JSObject();
jsObject.putWithQuote("hozAlign", "center");
jsObject.put("tooltip", "function(c){return c.getRow().getData().datetime"+courseModule.getCmid()+"}");

jsObject.putWithQuote("formatter", "image");
jsObject.put("topCalc",
"function(n,r,c){var f=0;return n.forEach(function(n){n&&f++;}),f+'/'+n.length+' ('+(f/n.length||0).toLocaleString(locale,{style:'percent',maximumFractionDigits:2})+')';}");
jsObject.put("formatterParams", stringFormatterParams);
jsObject.put("sorter",
"function(t,a,n,e,i,g,r){return t-a||(n.getData().instant"+ courseModule.getCmid()+"||0)-(e.getData().instant"+ courseModule.getCmid()+"||0)}");
jsObject.putWithQuote("title", courseModule.getModuleName());
jsObject.putWithQuote("field", "ID" + courseModule.getCmid());

array.add(jsObject.toString());
// commit #132 when the user unselect options a null value is included in the list...
if (courseModule != null) { // FIX BUG RMS
jsObject = new JSObject();
jsObject.putWithQuote("hozAlign", "center");
jsObject.put("tooltip",
"function(c){return c.getRow().getData().datetime" + courseModule.getCmid() + "}");

jsObject.putWithQuote("formatter", "image");
jsObject.put("topCalc",
"function(n,r,c){var f=0;return n.forEach(function(n){n&&f++;}),f+'/'+n.length+' ('+(f/n.length||0).toLocaleString(locale,{style:'percent',maximumFractionDigits:2})+')';}");
jsObject.put("formatterParams", stringFormatterParams);
jsObject.put("sorter", "function(t,a,n,e,i,g,r){return t-a||(n.getData().instant"
+ courseModule.getCmid() + "||0)-(e.getData().instant" + courseModule.getCmid() + "||0)}");
jsObject.putWithQuote("title", courseModule.getModuleName());
jsObject.putWithQuote("field", "ID" + courseModule.getCmid());

array.add(jsObject.toString());
}
}

return array.toString();
Expand Down Expand Up @@ -114,39 +118,36 @@ private String getProgressParam(int max) {
public String createData(List<EnrolledUser> enrolledUsers, List<CourseModule> courseModules) {
JSArray array = new JSArray();
JSObject jsObject;
Instant init = datePickerStart.getValue()
.atStartOfDay(ZoneId.systemDefault())
.toInstant();
Instant end = datePickerEnd.getValue()
.plusDays(1)
.atStartOfDay(ZoneId.systemDefault())
.toInstant();
Instant init = datePickerStart.getValue().atStartOfDay(ZoneId.systemDefault()).toInstant();
Instant end = datePickerEnd.getValue().plusDays(1).atStartOfDay(ZoneId.systemDefault()).toInstant();
for (EnrolledUser enrolledUser : enrolledUsers) {
jsObject = new JSObject();
jsObject.putWithQuote("name", enrolledUser.getFullName());
int progress = 0;

for (CourseModule courseModule : courseModules) {

ActivityCompletion activity = courseModule.getActivitiesCompletion()
.get(enrolledUser);


ActivityCompletion activity = courseModule.getActivitiesCompletion().get(enrolledUser);

String field = "ID" + courseModule.getCmid();
if (activity != null) {

String activityTracking = activity.getTracking() == null ? "0": String.valueOf(activity.getTracking().ordinal());

if (activity != null) {

String activityTracking = activity.getTracking() == null ? "0"
: String.valueOf(activity.getTracking().ordinal());
Instant timeCompleted = activity.getTimecompleted();
if (timeCompleted != null && init.isBefore(timeCompleted) && end.isAfter(timeCompleted)) {
progress++;
String activityState = activity.getState() == null ? "0": String.valueOf(activity.getState().ordinal());
String activityState = activity.getState() == null ? "0"
: String.valueOf(activity.getState().ordinal());
String overrideBy = activity.getOverrideby() == null ? "0" : "1";
jsObject.put(field,"activityCompletionIcons["+activityState + activityTracking + overrideBy+"]");
jsObject.putWithQuote("datetime"+courseModule.getCmid(), dateTimeWrapper.format(timeCompleted));
jsObject.put("instant"+courseModule.getCmid(), timeCompleted.getEpochSecond());
}else {
jsObject.put(field,"activityCompletionIcons[000]");
jsObject.put(field,
"activityCompletionIcons[" + activityState + activityTracking + overrideBy + "]");
jsObject.putWithQuote("datetime" + courseModule.getCmid(),
dateTimeWrapper.format(timeCompleted));
jsObject.put("instant" + courseModule.getCmid(), timeCompleted.getEpochSecond());
} else {
jsObject.put(field, "activityCompletionIcons[000]");
}

}
Expand All @@ -163,8 +164,7 @@ public String createData(List<EnrolledUser> enrolledUsers, List<CourseModule> co
public void update() {
List<EnrolledUser> enrolledUsers = getSelectedEnrolledUser();

List<CourseModule> courseModules = listViewActivity.getSelectionModel()
.getSelectedItems();
List<CourseModule> courseModules = listViewActivity.getSelectionModel().getSelectedItems();
String columns = createColumns(courseModules);
String tableData = createData(enrolledUsers, courseModules);
JSObject data = new JSObject();
Expand Down Expand Up @@ -192,16 +192,10 @@ public void fillOptions(JSObject jsObject) {

@Override
public void exportCSV(String path) throws IOException {
Instant init = datePickerStart.getValue()
.atStartOfDay(ZoneId.systemDefault())
.toInstant();
Instant end = datePickerEnd.getValue()
.plusDays(1)
.atStartOfDay(ZoneId.systemDefault())
.toInstant();
Instant init = datePickerStart.getValue().atStartOfDay(ZoneId.systemDefault()).toInstant();
Instant end = datePickerEnd.getValue().plusDays(1).atStartOfDay(ZoneId.systemDefault()).toInstant();
List<EnrolledUser> enrolledUsers = getSelectedEnrolledUser();
List<CourseModule> courseModules = listViewActivity.getSelectionModel()
.getSelectedItems();
List<CourseModule> courseModules = listViewActivity.getSelectionModel().getSelectedItems();
List<String> header = new ArrayList<>();
header.add("userid");
header.add("fullname");
Expand All @@ -221,16 +215,14 @@ public void exportCSV(String path) throws IOException {
int completed = 0;
for (CourseModule courseModule : courseModules) {

ActivityCompletion activity = courseModule.getActivitiesCompletion()
.get(enrolledUser);
ActivityCompletion activity = courseModule.getActivitiesCompletion().get(enrolledUser);
State state = activity.getState();
Instant timeCompleted = activity.getTimecompleted();

if ((state == ActivityCompletion.State.COMPLETE || state == ActivityCompletion.State.COMPLETE_PASS)
&& timeCompleted != null && init.isBefore(timeCompleted) && end.isAfter(timeCompleted)) {
++completed;
printer.print(activity.getState()
.ordinal());
printer.print(activity.getState().ordinal());
printer.print(dateTimeWrapper.format(timeCompleted));
} else {
printer.print(ActivityCompletion.State.INCOMPLETE.ordinal());
Expand Down

0 comments on commit 2fa2af5

Please sign in to comment.