Skip to content

Commit

Permalink
Añadido la versioon de Moodle y adaptado para descargar registros
Browse files Browse the repository at this point in the history
  • Loading branch information
yjx0003 committed Apr 4, 2022
1 parent cf87b0e commit e40dcee
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 17 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ Tool for displaying grades and course records (logs) on different types of chart
This application is aimed at teachers who use Moodle services.

This version is the continuation of [Félix Nogal Santamaría](https://github.com/huco95) [UBUGrades](https://github.com/huco95/UBUGrades) application.

## Citar this
[Citar this](https://www.mdpi.com/2079-9292/11/6/954#cite)
## User's manual:
<!--* https://ubumonitor.gitbook.io/ubumonitor/-->
* https://ubumonitordocs.readthedocs.io/es/latest/
Expand Down
3 changes: 2 additions & 1 deletion README_es.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Esta aplicación está dirigida a docentes que usen los servicios de Moodle.
Esta versión es la continuación de [UBUGrades](https://github.com/huco95/UBUGrades) de [Félix Nogal Santamaría](https://github.com/huco95).
<p align="center"><img src="/latex/img/ejemplo_barras_apiladas.png" />

## Citar trabajo
[Citar este trabajo](https://www.mdpi.com/2079-9292/11/6/954#cite)
## Manual de usuario:
<!--* https://ubumonitor.gitbook.io/ubumonitor/-->
* https://ubumonitordocs.readthedocs.io/es/latest/
Expand Down Expand Up @@ -146,6 +148,5 @@ Las librerías externas de **Java** están incluidas en la carpeta [lib](lib), d
## Tutores
- Raúl Marticorena Sánchez
- Carlos Pardo Aguilar

## Licencia
Este proyecto está licenciado bajo la licencia MIT - ver el archivo [LICENSE](LICENSE) para más detalles.
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.0-alpha</version>
<version>2.10.0</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 @@ -9,7 +9,7 @@
public class AppInfo {


public static final String VERSION = "2.10.0-alpha";
public static final String VERSION = "2.10.0";

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

Expand Down
10 changes: 10 additions & 0 deletions src/main/java/es/ubu/lsi/ubumonitor/controllers/Controller.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public class Controller {
private boolean offlineMode;
private DataBase defaultDatabase;
private MainConfiguration mainConfiguration;
private String release;

/**
* Usuario actual.
Expand Down Expand Up @@ -431,4 +432,13 @@ public String getPreviousPassword() {

}

public void setRelease(String release) {
this.release = release;

}

public String getRelease() {
return release;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import org.controlsfx.control.textfield.TextFields;
import org.json.JSONException;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -441,9 +442,10 @@ protected Void call() {

try {
LOGGER.info("Recogiendo info del usuario");
String validUsername = UtilMethods
.getJSONObjectResponse(controller.getWebService(), new CoreWebserviceGetSiteInfo())
.getString(Constants.USERNAME);
JSONObject jsonObject = UtilMethods
.getJSONObjectResponse(controller.getWebService(), new CoreWebserviceGetSiteInfo());
String validUsername = jsonObject.getString(Constants.USERNAME);
controller.setRelease(jsonObject.getString("release"));
PopulateMoodleUser populateMoodleUser = new PopulateMoodleUser(controller.getWebService());
MoodleUser moodleUser = populateMoodleUser.populateMoodleUser(validUsername, controller.getUrlHost()
.toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ public void initialize(URL location, ResourceBundle resources) {
menuController.init(this);
selectionUserController.init(this, controller.getActualCourse(), controller.getMainConfiguration());
selectionMainController.init(this, controller.getActualCourse());
webViewTabsController.init(this, controller.getActualCourse(), controller.getMainConfiguration(), controller.getStage());
webViewTabsController.init(this, controller.getActualCourse(), controller.getMainConfiguration(),
controller.getStage());

initStatusBar();

Expand All @@ -106,8 +107,10 @@ private void initStatusBar() {
actualHost.setGraphic(linkImage);
actualHost.setOnAction(event -> UtilMethods.openURL(actualHost.getText()));
// Mostramos Curso actual
Label lblActualCourse = new Label(controller.getActualCourse().toString());

Label lblActualCourse = new Label(controller.getActualCourse()
.toString());
Label lblRelease = new Label(controller.getDataBase()
.getRelease());
ImageView online = new ImageView(
controller.isOfflineMode() ? "/img/circle_offline.png" : "/img/circle_online.png");
online.setFitHeight(20);
Expand All @@ -118,7 +121,8 @@ private void initStatusBar() {
left.setSpacing(5);
left.getChildren()
.addAll(online, new Separator(Orientation.VERTICAL), lblActualCourse,
new Separator(Orientation.VERTICAL), actualHost);
new Separator(Orientation.VERTICAL), lblRelease, new Separator(Orientation.VERTICAL),
actualHost);

statusBar.getLeftItems()
.add(left);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,7 @@ private Task<Void> getImportLogsWorker(File file) {
return new Task<Void>() {
@Override
protected Void call() throws Exception {
LogCreator.setDateTimeFormatter(controller.getDataBase().getRelease());
LogCreator.setDateTimeFormatter(ZoneId.systemDefault());
Logs logs = new Logs(ZoneId.systemDefault());
Course course = controller.getActualCourse();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ protected Void call() throws Exception {
Course actualCourse = dataBase.getActualCourse();
LOGGER.info("Cargando datos del curso: {}", actualCourse.getFullName());
// Establecemos los usuarios matriculados

dataBase.setRelease(controller.getRelease());
dataBase.getCourses()
.getMap()
.values()
Expand Down Expand Up @@ -841,7 +841,7 @@ protected Void call() throws Exception {

updateMessage(MessageFormat.format(I18n.get("label.downloadinglog"), tries, limitRelogin));
if (actualCourse.getUpdatedLog() == null) {

LogCreator.setDateTimeFormatter(controller.getRelease());
DownloadLogController downloadLogController = LogCreator.download();

Response response = downloadLogController.downloadLog(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ public class LogCreator {

private static final Controller CONTROLLER = Controller.getInstance();

private static DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("d/MM/yy, kk:mm");

private static DateTimeFormatter dateTimeFormatter3 = DateTimeFormatter.ofPattern("d/MM/yy, kk:mm");
private static DateTimeFormatter dateTimeFormatter4 = DateTimeFormatter.ofPattern("d/MM/yy, kk:mm:ss");
private static DateTimeFormatter actualDateTimeFormatter;
private static final Set<String> NOT_AVAIBLE_COMPONENTS = new TreeSet<>();
private static final Set<String> NOT_AVAIBLE_EVENTS = new TreeSet<>();

Expand Down Expand Up @@ -73,7 +74,15 @@ public class LogCreator {
* @param zoneId zona horaria
*/
public static void setDateTimeFormatter(ZoneId zoneId) {
dateTimeFormatter = dateTimeFormatter.withZone(zoneId);
actualDateTimeFormatter = actualDateTimeFormatter.withZone(zoneId);
}

public static void setDateTimeFormatter(String release) {
if (release.startsWith("4")) {
actualDateTimeFormatter = dateTimeFormatter4;
}else {
actualDateTimeFormatter = dateTimeFormatter3;
}
}

public static void createLogsMultipleDays(Logs logs) throws IOException {
Expand Down Expand Up @@ -215,7 +224,7 @@ public static LogLine createLog(Set<String> headers, CSVRecord csvRecord) {
//considering Time column always first
String time = csvRecord.get(0);

ZonedDateTime zdt = ZonedDateTime.parse(time, dateTimeFormatter);
ZonedDateTime zdt = ZonedDateTime.parse(time, actualDateTimeFormatter);
log.setTime(zdt);

if (headers.contains(LogCreator.ORIGIN)) {
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/es/ubu/lsi/ubumonitor/model/DataBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class DataBase implements Serializable {
private byte[] userPhoto;
private String fullName;
private ZoneId userZoneId;
private String release;

private SubDataBase<Role> roles;
private SubDataBase<Group> groups;
Expand Down Expand Up @@ -169,4 +170,18 @@ public void setUserZoneId(ZoneId userZoneId) {
this.userZoneId = userZoneId;
}

/**
* @return the release
*/
public String getRelease() {
return release;
}

/**
* @param release the release to set
*/
public void setRelease(String release) {
this.release = release;
}

}

0 comments on commit e40dcee

Please sign in to comment.