From 5e5612001ca5d1aa2a2e51360be0deb71d2e62ad Mon Sep 17 00:00:00 2001 From: esoe Date: Fri, 9 Sep 2022 16:41:20 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=20=D0=BF=D0=B5=D1=80=D0=B5=D1=81=D1=87=D0=B5=D1=82?= =?UTF-8?q?=20=D0=B2=D1=80=D0=B5=D0=BC=D0=B5=D0=BD=D0=B8=20=D0=BD=D0=B0=20?= =?UTF-8?q?=D0=B2=D1=8B=D0=BF=D0=BE=D0=BB=D0=BD=D0=B5=D0=BD=D0=B8=D0=B5=20?= =?UTF-8?q?=D1=82=D0=B5=D1=81=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/ru/egspt/Data.java | 33 +++++++++++++++++- src/main/java/ru/egspt/ReportTableModel.java | 1 + target/classes/ru/egspt/Data.class | Bin 4758 -> 4936 bytes .../classes/ru/egspt/ReportTableModel.class | Bin 7957 -> 7957 bytes 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/main/java/ru/egspt/Data.java b/src/main/java/ru/egspt/Data.java index e5f11e7..03cc478 100644 --- a/src/main/java/ru/egspt/Data.java +++ b/src/main/java/ru/egspt/Data.java @@ -86,7 +86,12 @@ public class Data extends UserListModel { /** * @return полный перечень результатов из базы */ - public ArrayList getResultsFromBase(Base base) { + /** + * + * @param base + * @return + + public ArrayList getResultsFromBase(Base base) { ArrayList 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 { } return r; } + */ + + public ArrayList getResultsFromBase(Base base) { + ArrayList 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 getResultsByUsers(ArrayList results, ArrayList users){ ArrayList r = new ArrayList<>(); //перебор результатов diff --git a/src/main/java/ru/egspt/ReportTableModel.java b/src/main/java/ru/egspt/ReportTableModel.java index c1577c4..4ebd43d 100644 --- a/src/main/java/ru/egspt/ReportTableModel.java +++ b/src/main/java/ru/egspt/ReportTableModel.java @@ -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; } diff --git a/target/classes/ru/egspt/Data.class b/target/classes/ru/egspt/Data.class index 3b5f9bc5dca70f071b8ba15ac8c53ede6569fd34..1c446de652d8f19572cb0745de777e1a4e7e56bc 100644 GIT binary patch delta 827 zcmYL_-Afcv7{;H`UFTzGGZ)7ki5f2otj<1)kX1kdG6}OV7@Wp~E&tg32^{d`AYMNEoJP398 zZy#%tOMCh;h-SF3h3p$qNcTkwyF}}C!H3IGa0ME!VmGd#8a=4Rb%fB1v$z2ZH%Z+> zAI1tn$DTjvY~aycM1ymP(F{*BIhbc=L4|k0 zuej5QuV5*SFKnzJSn-fh`YC#VwjD$P9?@?;MgUK+AH%32eHc&CK<`Z$Wssd!4Vg3M4`6cTU!&`h`13%@L#wP{0HLgO^V=VIOjWOp7%MQcHi42fBwDs9>9Jy zSLGplI6OWY89j1Z%j$mZN;O;aYt^z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