@ -86,6 +86,11 @@ public class Data extends UserListModel {
@@ -86,6 +86,11 @@ public class Data extends UserListModel {
/ * *
* @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" ;
@ -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 < > ( ) ;
//перебор результатов