diff --git a/app/views/external_users/statistics.html.slim b/app/views/external_users/statistics.html.slim index 6c49b967..42a88a8d 100644 --- a/app/views/external_users/statistics.html.slim +++ b/app/views/external_users/statistics.html.slim @@ -1,2 +1,18 @@ -h1 = @user -H2 = 'Hallo' \ No newline at end of file +h1 = t('.title') + +- exercises = Exercise.where(:id => @user.submissions.group(:exercise_id).select(:exercise_id).distinct()) + +.table-responsive + table.table + thead + tr + - ['.exercise', '.score', '.runs', '.worktime'].each do |title| + th.header = t(title) + tbody + - exercises.each do |exercise| + - submissions = @user.submissions.where(:exercise_id => exercise.id, :cause => ['submit', 'run']) + tr + td = link_to exercise.title, exercise + td = submissions.maximum(:score) or 0 + td = submissions.count + td = exercise.average_working_time_for(@user.id) or 0 diff --git a/config/locales/de.yml b/config/locales/de.yml index d96e6927..40b745ad 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -259,6 +259,13 @@ de: time: Zeit cause: Grund score: Punktzahl + external_users: + statistics: + title: Statistiken für Externe Benutzer + exercise: Übung + score: Bewertung + runs: Versuche + worktime: Arbeitszeit files: roles: main_file: Hauptdatei diff --git a/config/locales/en.yml b/config/locales/en.yml index dc63e3dd..501fe745 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -259,6 +259,13 @@ en: time: Time cause: Cause score: Score + external_users: + statistics: + title: External User Statistics + exercise: Exercise + score: Score + runs: Runs + worktime: Working Time files: roles: main_file: Main File