|
|
@ -24,7 +24,7 @@ public class Data extends UserListModel { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public ArrayList<Quiz> getQuizesFromBase(Base base) { |
|
|
|
public ArrayList<Quiz> getQuizesFromBase(Base base) { |
|
|
|
ArrayList<Quiz> q = new ArrayList<>(); |
|
|
|
ArrayList<Quiz> q = new ArrayList<>(); |
|
|
|
String querry = "SELECT id, name, timelimit FROM mdl_quiz"; |
|
|
|
String querry = "SELECT id, name FROM mdl_quiz"; |
|
|
|
ResultSet rs = base.querry(querry); |
|
|
|
ResultSet rs = base.querry(querry); |
|
|
|
try { |
|
|
|
try { |
|
|
|
while (rs.next()){ |
|
|
|
while (rs.next()){ |
|
|
@ -86,38 +86,9 @@ public class Data extends UserListModel { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* @return полный перечень результатов из базы |
|
|
|
* @return полный перечень результатов из базы |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
/** |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @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); |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
while (rs.next()){ |
|
|
|
|
|
|
|
int id = rs.getInt("id"); |
|
|
|
|
|
|
|
int quizid = rs.getInt("quiz"); |
|
|
|
|
|
|
|
int userid = rs.getInt("userid"); |
|
|
|
|
|
|
|
double grade = rs.getDouble("grade"); |
|
|
|
|
|
|
|
Long time = rs.getLong("timemodified"); |
|
|
|
|
|
|
|
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> getResultsFromBase(Base base) { |
|
|
|
public ArrayList<Result> getResultsFromBase(Base base) { |
|
|
|
ArrayList<Result> r = new ArrayList<>(); |
|
|
|
ArrayList<Result> r = new ArrayList<>(); |
|
|
|
String querry = "SELECT id, quiz, userid, attempt, timestart, timefinish, timemodified, sumgrades FROM mdl_quiz_attempts"; |
|
|
|
String querry = "SELECT id, quiz, userid, attempt, timestart, timefinish, sumgrades FROM mdl_quiz_attempts"; |
|
|
|
ResultSet rs = base.querry(querry); |
|
|
|
ResultSet rs = base.querry(querry); |
|
|
|
try { |
|
|
|
try { |
|
|
|
while (rs.next()){ |
|
|
|
while (rs.next()){ |
|
|
|