Browse Source

исправлен пересчет времени на выполнение тестов

master
esoe 2 years ago
parent
commit
5e5612001c
  1. 33
      src/main/java/ru/egspt/Data.java
  2. 1
      src/main/java/ru/egspt/ReportTableModel.java
  3. BIN
      target/classes/ru/egspt/Data.class
  4. BIN
      target/classes/ru/egspt/ReportTableModel.class

33
src/main/java/ru/egspt/Data.java

@ -86,7 +86,12 @@ public class Data extends UserListModel { @@ -86,7 +86,12 @@ public class Data extends UserListModel {
/**
* @return полный перечень результатов из базы
*/
public ArrayList<Result> getResultsFromBase(Base base) {
/**
*
* @param base
* @return
public ArrayList<Result> getResultsFromBase(Base base) {
ArrayList<Result> r = new ArrayList<>();
String querry = "SELECT id, quiz, userid, grade, timemodified FROM mdl_quiz_grades";
ResultSet rs = base.querry(querry);
@ -108,6 +113,32 @@ public class Data extends UserListModel { @@ -108,6 +113,32 @@ public class Data extends UserListModel {
}
return r;
}
*/
public ArrayList<Result> getResultsFromBase(Base base) {
ArrayList<Result> r = new ArrayList<>();
String querry = "SELECT id, quiz, userid, attempt, timestart, timefinish, timemodified, sumgrades FROM mdl_quiz_attempts";
ResultSet rs = base.querry(querry);
try {
while (rs.next()){
int id = rs.getInt("id");
int quizid = rs.getInt("quiz");
int userid = rs.getInt("userid");
double grade = rs.getDouble("sumgrades");
Long timestartAt = rs.getLong("timestart");
Long timefinishAt = rs.getLong("timefinish");
Long time = timefinishAt - timestartAt;
Result result = new Result(id, quizid, userid, grade, time);
r.add(result);
}
}
catch (Exception ex){
System.err.println ("Подключение к серверу баз данных не установлено ... ");
ex.printStackTrace();
System.out.println (ex);
}
return r;
}
public ArrayList<Result> getResultsByUsers(ArrayList<Result> results, ArrayList<User> users){
ArrayList<Result> r = new ArrayList<>();
//перебор результатов

1
src/main/java/ru/egspt/ReportTableModel.java

@ -165,6 +165,7 @@ public class ReportTableModel extends AbstractTableModel{ @@ -165,6 +165,7 @@ public class ReportTableModel extends AbstractTableModel{
d[userCurr][headerCurr] = report.getResults().get(resultCurr).getGrade();
//формируем ячейку time
Long time = report.getResults().get(resultCurr).getTime();
//
String t = LocalTime.MIN.plusSeconds(time).toString();
d[userCurr][headerCurr + 1] = t;
}

BIN
target/classes/ru/egspt/Data.class

Binary file not shown.

BIN
target/classes/ru/egspt/ReportTableModel.class

Binary file not shown.
Loading…
Cancel
Save