mumuki-laboratory 9.15.0 → 9.18.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/mumuki_laboratory/application/csrf-token.js +5 -5
  3. data/app/assets/javascripts/mumuki_laboratory/application/discussions.js +1 -0
  4. data/app/assets/javascripts/mumuki_laboratory/application/exercise.js +17 -2
  5. data/app/controllers/ajax_controller.rb +1 -1
  6. data/app/controllers/application_controller.rb +3 -3
  7. data/app/controllers/exam_authorization_requests_controller.rb +22 -17
  8. data/app/controllers/exam_registrations_controller.rb +1 -1
  9. data/app/controllers/exercises_controller.rb +0 -1
  10. data/app/helpers/discussions_helper.rb +4 -1
  11. data/app/helpers/editor_helper.rb +1 -1
  12. data/app/helpers/exams_helper.rb +33 -0
  13. data/app/helpers/exercise_input_helper.rb +0 -4
  14. data/app/helpers/menu_bar_helper.rb +5 -4
  15. data/app/helpers/notifications_helper.rb +1 -1
  16. data/app/helpers/time_helper.rb +12 -0
  17. data/app/helpers/time_zone_helper.rb +5 -1
  18. data/app/helpers/user_discussions_helper.rb +7 -7
  19. data/app/views/book/show.html.erb +4 -2
  20. data/app/views/discussions/_actions.html.erb +1 -0
  21. data/app/views/discussions/_basic_actions.html.erb +20 -0
  22. data/app/views/discussions/_description_message.html.erb +1 -1
  23. data/app/views/discussions/_message.html.erb +6 -2
  24. data/app/views/discussions/new.html.erb +7 -1
  25. data/app/views/discussions/show.html.erb +1 -18
  26. data/app/views/exam_registrations/show.html.erb +1 -1
  27. data/app/views/exercises/_read_only.html.erb +54 -60
  28. data/app/views/exercises/show.html.erb +1 -0
  29. data/app/views/layouts/_discussions_list.html.erb +1 -1
  30. data/app/views/layouts/_messages.html.erb +1 -1
  31. data/app/views/users/_user_form.html.erb +1 -1
  32. data/app/views/users/messages.html.erb +1 -1
  33. data/app/views/users/notifications.html.erb +1 -1
  34. data/lib/mumuki/laboratory/controllers/validate_access_mode.rb +5 -0
  35. data/lib/mumuki/laboratory/locales/en.yml +8 -2
  36. data/lib/mumuki/laboratory/locales/es-CL.yml +8 -2
  37. data/lib/mumuki/laboratory/locales/es.yml +8 -2
  38. data/lib/mumuki/laboratory/locales/pt.yml +8 -2
  39. data/lib/mumuki/laboratory/version.rb +1 -1
  40. data/spec/controllers/exam_authorization_requests_controller_spec.rb +16 -2
  41. data/spec/controllers/exercises_controller_spec.rb +32 -0
  42. data/spec/dummy/db/schema.rb +2 -1
  43. data/spec/dummy/db/seeds.rb +16 -8
  44. data/spec/features/not_found_private_flow_spec.rb +1 -1
  45. metadata +123 -117
@@ -45,6 +45,7 @@
45
45
  <%= hidden_field_tag "mu-exercise-id", @exercise.id %>
46
46
  <%= hidden_field_tag "mu-exercise-layout", @exercise.layout %>
47
47
  <%= hidden_field_tag "mu-exercise-settings", @exercise.settings.to_json %>
48
+ <%= hidden_field_tag "mu-exercise-read-only", current_access_mode.read_only? %>
48
49
 
49
50
  <div class="d-none" id="processing-template">
50
51
  <div class="bs-callout bs-callout-info">
@@ -26,7 +26,7 @@
26
26
  </span>
27
27
  <span class="discussion-initiator">
28
28
  <strong><%= discussion_user_name discussion.initiator %></strong>
29
- <%= t(:asked_time_since, time: time_ago_in_words(discussion.created_at)) %>
29
+ <%= friendly_time(discussion.created_at, :asked_time_since) %>
30
30
  <span class="discussion-status-icon">
31
31
  <%= discussion_status_fa_icon(discussion) %>
32
32
  </span>
@@ -6,7 +6,7 @@
6
6
  <div class="message">
7
7
  <p> <%= message.content_html %></p>
8
8
  <div class="sender"><%= message.sender unless message.sender == current_user_uid %></div>
9
- <time><%= time_ago_in_words message.created_at %></time>
9
+ <%= friendly_time(message.created_at) %>
10
10
  </div>
11
11
  </li>
12
12
  <% end %>
@@ -31,7 +31,7 @@
31
31
  <span> <strong><%= t :email %>:</strong> <%= @user.email %> </span>
32
32
  </div>
33
33
  <div>
34
- <span> <strong><%= t :programming_since %>:</strong> <%= t(:time_since, time: time_ago_in_words(@user.created_at)) %> </span>
34
+ <span> <strong><%= t :programming_since %>:</strong> <%= friendly_time(@user.created_at, :time_since) %> </span>
35
35
  </div>
36
36
  </div>
37
37
  </div>
@@ -20,7 +20,7 @@
20
20
  <td><%= icon_for_read(message.read?) %></td>
21
21
  <td><%= link_to message.exercise.name, exercise_path(message.exercise.id) %></td>
22
22
  <td><%= mail_to message.sender %></td>
23
- <td><%= time_ago_in_words message.created_at %></td>
23
+ <td><%= friendly_time(message.created_at) %></td>
24
24
  </tr>
25
25
  <% end %>
26
26
  </table>
@@ -38,7 +38,7 @@
38
38
  <%= render partial: "notifications/#{notification.subject}", locals: { notification: notification } %>
39
39
  </td>
40
40
  <td class="col-md-3">
41
- <%= t(:time_since, time: time_ago_in_words(notification.created_at)) %>
41
+ <%= friendly_time(notification.created_at, :time_since) %>
42
42
  </td>
43
43
  </tr>
44
44
  <% end %>
@@ -7,9 +7,14 @@ module Mumuki::Laboratory::Controllers::ValidateAccessMode
7
7
 
8
8
  def validate_accessible!
9
9
  current_access_mode.validate_content_here! subject_container
10
+ super
10
11
  end
11
12
 
12
13
  def subject_container
13
14
  subject
14
15
  end
16
+
17
+ def accessible_subject
18
+ nil
19
+ end
15
20
  end
@@ -13,6 +13,7 @@ en:
13
13
  all: All
14
14
  appendix: Appendix
15
15
  appendix_teaser: Do you want to learn more? <a href="%{link}">Check this chapter's appendix</a>"
16
+ approved_by: Validated by %{validator} at %{date}
16
17
  approved_message: Validated by mentor
17
18
  approved_messages:
18
19
  other: validated
@@ -30,6 +31,7 @@ en:
30
31
  authoring: Authoring
31
32
  authoring_note_html: This guide's content was developed by %{authors} under the terms of <a href="https://creativecommons.org/licenses/by-sa/4.0/" target="_blank">Creative Commons License Share-Alike, 4.0</a>
32
33
  authoring_note_with_collaborators_html: This guide's content was developed by %{authors} and <a href="%{collaborators}" target="_blank">many others</a>, under the terms of <a href="https://creativecommons.org/licenses/by-sa/4.0/" target="_blank">Creative Commons License Share-Alike, 4.0</a>
34
+ available_time: Available time
33
35
  back_to_mumuki: Back to Mumuki!
34
36
  bibliotheca_ui: Bibliotheca
35
37
  birthdate: Birthdate
@@ -67,9 +69,11 @@ en:
67
69
  continue_practicing: Continue practicing!
68
70
  corollary: To think about
69
71
  correct_answer: The answer is correct!
72
+ course: Course
70
73
  create_submission: Submit
71
74
  created_at: Created at
72
75
  date: Date
76
+ date_and_time: Date and time
73
77
  deleted_by: Deleted by %{deleter}
74
78
  deleted_message_warning: If you repeateadly violate these or other rules, you may be prohibited from accessing the forum or you may suffer more severe consequences, such as being expulsed from the course.
75
79
  deletion_motive:
@@ -117,9 +121,9 @@ en:
117
121
  errored: Oops, your solution didn't work
118
122
  exam_authorization_pending_explanation_html: You have until <strong>%{end_time}</strong> (%{location} time) to register. After that date, your request will be processed and you will receive a confirmation. <br> Don't forget to check the notifications!
119
123
  exam_authorization_request_approved_html: Your request was approved, don't forget to log in at <strong>%{date}</strong> (%{location} time). Good luck!
120
- exam_authorization_request_created: Your registration to the exam has been saved!
124
+ exam_authorization_request_created: You registered for the exam on %{friendly_date}
121
125
  exam_authorization_request_rejected: Your request was rejected because you didn't meet the requirements.
122
- exam_authorization_request_saved: Your registration to the exam has been updated!
126
+ exam_authorization_request_saved: You've changed your registration to the exam to %{friendly_date}
123
127
  exam_authorization_request_updated: Your registration to %{description} has been updated
124
128
  exam_registration_choose_exam: Choose date and time to attend to the exam
125
129
  exam_registration_explanation_html: You have until <strong>%{date}</strong> (%{location} time) to register. After that date, your request will be processed and you will receive a confirmation. <br> Don't forget to check the notifications!
@@ -272,6 +276,7 @@ en:
272
276
  notifications_will_be_here: Notifications will be here
273
277
  notify_problem_with_exercise: Report a bug
274
278
  office: Office
279
+ only_forum_questions_on_forum: Remember that only exercise-related questions are answered on the forum. For any other kind of inquiries, please check the %{link}.
275
280
  only_landscape_support: Please, rotate your tablet or cellphone to continue practicing
276
281
  opened: Open
277
282
  opened_count: '%{count} opened'
@@ -360,6 +365,7 @@ en:
360
365
  terms_and_conditions_continue_disclaimer: By continuing you agree to %{terms_link}
361
366
  terms_and_conditions_must_be_accepted: You must accept the terms and conditions
362
367
  test_results: Test results
368
+ time_in_minutes: "%{time} minutes"
363
369
  time_since: "%{time} ago"
364
370
  time_left: You have
365
371
  title: Title
@@ -11,6 +11,7 @@ es-CL:
11
11
  and: y
12
12
  appendix: Apéndice
13
13
  appendix_teaser: ¿Quieres saber más? <a href="%{link}">Consulta el apéndice de este capítulo</a>
14
+ approved_by: Validado por %{validator} el %{date}
14
15
  approved_message: Validado por mentorías
15
16
  approved_messages:
16
17
  one: validado
@@ -29,6 +30,7 @@ es-CL:
29
30
  authoring: Autores
30
31
  authoring_note_html: Esta guía fue desarrollada por %{authors} bajo los términos de la <a href="https://creativecommons.org/licenses/by-sa/4.0/" target="_blank">Licencia Creative Commons Compartir-Igual, 4.0</a>.
31
32
  authoring_note_with_collaborators_html: Esta guía fue desarrollada por %{authors} y <a href="%{collaborators}" target="_blank">muchas personas más</a>, bajo los términos de la <a href="https://creativecommons.org/licenses/by-sa/4.0/" target="_blank">Licencia Creative Commons Compartir-Igual, 4.0</a>.
33
+ available_time: Tiempo disponible
32
34
  back_to_mumuki: ¡Vuelve a Mumuki!
33
35
  bibliotheca_ui: Biblioteca
34
36
  birthdate: Fecha de nacimiento
@@ -65,11 +67,13 @@ es-CL:
65
67
  continue_lesson: ¡Continúa esta lección!
66
68
  continue_practicing: ¡Sigue aprendiendo!
67
69
  correct_answer: ¡La respuesta es correcta!
70
+ course: Curso
68
71
  create_submission: Enviar
69
72
  created_at: Creado
70
73
  created_exercises: Ejercicios Creados
71
74
  created_guides: Lecciones Creadas
72
75
  date: Fecha
76
+ date_and_time: Fecha y hora
73
77
  deleted_by: Eliminado por %{deleter}
74
78
  deleted_message_warning: Si infringes reiteradamente estas u otras reglas del Espacio de Consultas, se te puede prohibir el acceso al mismo o podrás sufrir consecuencias más severas, como la expulsión del curso.
75
79
  deletion_motive:
@@ -120,9 +124,9 @@ es-CL:
120
124
  exam_authorization_pending_change_date_html: Tienes tiempo hasta el <strong>%{end_time}</strong> (hora de %{location}) para cambiar el turno haciendo click <strong><a href="%{edit_path}">aquí</a></strong>. Pasada esa fecha, tu solicitud será evaluada y recibirás una confirmación. <br> ¡No olvides revisar las notificaciones!
121
125
  exam_authorization_pending_done_html: Ya te inscribiste a este examen. Luego del <strong>%{end_time}</strong> (hora de %{location}) se evaluará tu solicitud y recibirás una confirmación. <br> ¡No olvides de revisar las notificaciones!
122
126
  exam_authorization_request_approved_html: Tu solicitud fue aprobada, no olvides conectarte el <strong>%{date}</strong> (hora de %{location}). ¡Buena suerte!
123
- exam_authorization_request_created: ¡Tu inscripción al examen se registró exitosamente!
127
+ exam_authorization_request_created: Te has inscripto al examen del día %{friendly_date}
124
128
  exam_authorization_request_rejected: Tu solicitud fue rechazada porque no cumpliste con los requisitos para rendir el examen.
125
- exam_authorization_request_saved: ¡Tu inscripción al examen se modificó exitosamente!
129
+ exam_authorization_request_saved: Has cambiado tu inscripción al examen al día %{friendly_date}
126
130
  exam_authorization_request_updated: Hay novedades sobre tu inscripción a %{description}
127
131
  exam_registration_choose_exam: Seleccioná día y horario en el que te gustaría rendir el examen
128
132
  exam_registration_explanation_html: Tienes tiempo hasta el <strong>%{date}</strong> (hora de %{location}) para inscribirte. Pasada esa fecha, tu solicitud será evaluada y recibirás una confirmación. <br> ¡No olvides revisar las notificaciones!
@@ -280,6 +284,7 @@ es-CL:
280
284
  notifications_will_be_here: Tus notificaciones aparecerán aquí
281
285
  notify_problem_with_exercise: Reporta un bug
282
286
  office: Secretaría
287
+ only_forum_questions_on_forum: Recuerda que en el espacio de consultas se responden únicamente dudas relacionadas a los ejercicios. Para cualquier otro tipo de consulta, revisa la %{link}.
283
288
  only_landscape_support: Por favor, rota tu tablet o celular para realizar ejercicios
284
289
  opened: Abierta
285
290
  opened_count:
@@ -374,6 +379,7 @@ es-CL:
374
379
  terms_and_conditions_continue_disclaimer: Al continuar aceptas los %{terms_link}
375
380
  terms_and_conditions_must_be_accepted: Tienes que aceptar los términos y condiciones
376
381
  test_results: Resultados de las pruebas
382
+ time_in_minutes: "%{time} minutos"
377
383
  time_since: "hace %{time}"
378
384
  time_left: Te quedan
379
385
  title: Título
@@ -14,6 +14,7 @@ es:
14
14
  and: y
15
15
  appendix: Apéndice
16
16
  appendix_teaser: ¿Querés saber más? <a href="%{link}">Consultá el apéndice de este capítulo</a>
17
+ approved_by: Validado por %{validator} el %{date}
17
18
  approved_message: Validado por mentorías
18
19
  approved_messages:
19
20
  one: validado
@@ -32,6 +33,7 @@ es:
32
33
  authoring: Autores
33
34
  authoring_note_html: Esta guía fue desarrollada por %{authors} bajo los términos de la <a href="https://creativecommons.org/licenses/by-sa/4.0/" target="_blank">Licencia Creative Commons Compartir-Igual, 4.0</a>.
34
35
  authoring_note_with_collaborators_html: Esta guía fue desarrollada por %{authors} y <a href="%{collaborators}" target="_blank">muchas personas más</a>, bajo los términos de la <a href="https://creativecommons.org/licenses/by-sa/4.0/" target="_blank">Licencia Creative Commons Compartir-Igual, 4.0</a>.
36
+ available_time: Tiempo disponible
35
37
  back_to_mumuki: ¡Volvé a Mumuki!
36
38
  bibliotheca_ui: Biblioteca
37
39
  birthdate: Fecha de nacimiento
@@ -68,6 +70,7 @@ es:
68
70
  continue_lesson: ¡Continuá esta lección!
69
71
  continue_practicing: ¡Seguí aprendiendo!
70
72
  correct_answer: ¡La respuesta es correcta!
73
+ course: Curso
71
74
  create_submission: Enviar
72
75
  created_at: Creado
73
76
  created_at_asc: Antiguas
@@ -75,6 +78,7 @@ es:
75
78
  created_exercises: Ejercicios Creados
76
79
  created_guides: Lecciones Creadas
77
80
  date: Fecha
81
+ date_and_time: Fecha y hora
78
82
  deleted_by: Eliminado por %{deleter}
79
83
  deleted_message_warning: Si infringís reiteradamente estas u otras reglas del Espacio de Consultas, se te puede prohibir el acceso al mismo o podrás sufrir consecuencias más severas, como la expulsión del curso.
80
84
  deletion_motive:
@@ -127,9 +131,9 @@ es:
127
131
  exam_authorization_pending_change_date_html: Tenés tiempo hasta el <strong>%{end_time}</strong> (hora de %{location}) para cambiar el turno haciendo click <strong><a href="%{edit_path}">acá</a></strong>. Pasada esa fecha, tu solicitud será evaluada y recibirás una confirmación. <br> ¡No te olvides de revisar las notificaciones!
128
132
  exam_authorization_pending_done_html: Ya te inscribiste a este examen. Luego del <strong>%{end_time}</strong> (hora de %{location}) se evaluará tu solicitud y recibirás una confirmación. <br> ¡No te olvides de revisar las notificaciones!
129
133
  exam_authorization_request_approved_html: Tu solicitud fue aprobada, no olvides conectarte el <strong>%{date}</strong> (hora de %{location}). ¡Buena suerte!
130
- exam_authorization_request_created: ¡Tu inscripción al examen se registró exitosamente!
134
+ exam_authorization_request_created: Te inscribiste al examen del día %{friendly_date}
131
135
  exam_authorization_request_rejected: Tu solicitud fue rechazada porque no cumpliste con los requisitos para rendir el examen.
132
- exam_authorization_request_saved: ¡Tu inscripción al examen se modificó exitosamente!
136
+ exam_authorization_request_saved: Cambiaste tu inscripción al examen al día %{friendly_date}
133
137
  exam_authorization_request_updated: Hay novedades sobre tu inscripción a %{description}
134
138
  exam_registration_choose_exam: Seleccioná día y horario en el que te gustaría rendir el examen
135
139
  exam_registration_explanation_html: Tenés tiempo hasta el <strong>%{date}</strong> (hora de %{location}) para inscribirte. Pasada esa fecha, tu solicitud será evaluada y recibirás una confirmación. <br> ¡No te olvides de revisar las notificaciones!
@@ -289,6 +293,7 @@ es:
289
293
  notifications_will_be_here: Tus notificaciones aparecerán aquí
290
294
  notify_problem_with_exercise: Reportá un bug
291
295
  office: Secretaría
296
+ only_forum_questions_on_forum: Recordá que en el espacio de consultas se responden únicamente dudas relacionadas a los ejercicios. Para cualquier otro tipo de consulta, revisá la %{link}.
292
297
  only_landscape_support: Por favor, rotá tu tablet o celular para realizar ejercicios
293
298
  opened: Abierta
294
299
  opened_count:
@@ -388,6 +393,7 @@ es:
388
393
  terms_and_conditions_continue_disclaimer: Al continuar estás aceptando los %{terms_link}
389
394
  terms_and_conditions_must_be_accepted: Tenés que aceptar los términos y condiciones
390
395
  test_results: Resultados de las pruebas
396
+ time_in_minutes: "%{time} minutos"
391
397
  time_since: "hace %{time}"
392
398
  time_left: Te quedan
393
399
  title: Título
@@ -13,6 +13,7 @@ pt:
13
13
  and: e
14
14
  appendix: Apêndice
15
15
  appendix_teaser: Você quer saber mais? <a href="%{link}"> Consulte o apêndice deste capítulo </a>
16
+ approved_by: Validado pelo %{validator} em %{date}
16
17
  approved_message: Validado pelo mentor
17
18
  approved_messages:
18
19
  one: validado
@@ -31,6 +32,7 @@ pt:
31
32
  authoring: Autores
32
33
  authoring_note_html: 'Este guia foi desenvolvido por %{authors} nos termos do <a href = "https://creativecommons.org/licenses/by-sa/4.0/" target="_blank"> Creative Commons License Share-Equal, 4.0 </a>.'
33
34
  authoring_note_with_collaborators_html: 'Este guia foi desenvolvido por %{authors} e <a href="%{collaborators}" target="_blank">muitas outras pessoas </a>, nos termos do <a href = "https://creativecommons.org/licenses/by-sa/4.0/" target="_blank"> Creative Commons License Share-Equal, 4.0 </a>.'
35
+ available_time: Tempo disponível
34
36
  back_to_mumuki: Voltei para Mumuki!
35
37
  bibliotheca_ui: Biblioteca
36
38
  birthdate: Fecha de nacimiento
@@ -64,6 +66,7 @@ pt:
64
66
  continue_lesson: Continue esta lição!
65
67
  continue_practicing: Continue aprendendo!
66
68
  correct_answer: A resposta está correta!
69
+ course: Curso
67
70
  create_submission: Enviar
68
71
  created_at: Criado
69
72
  created_at_asc: Antigo
@@ -71,6 +74,7 @@ pt:
71
74
  created_exercises: Exercícios criados
72
75
  created_guides: Lições criadas
73
76
  date: Data
77
+ date_and_time: Data e hora
74
78
  deleted_by: Removido pelo
75
79
  deleted_message_warning: Se você violar repetidamente essas ou outras regras da Área de Consulta, seu acesso a ela pode ser proibido ou você pode sofrer consequências mais graves, como a expulsão do curso.
76
80
  deletion_motive:
@@ -120,9 +124,9 @@ pt:
120
124
  errored: Opa! Sua solução não pode ser executada
121
125
  exam_authorization_pending_explanation_html: Você tem tempo até <strong>%{date}</strong> (horário de %{location}) para se inscrever. Após essa data, sua inscrição será avaliada e você receberá uma confirmação. <br> Não se esqueça de verificar as notificações!
122
126
  exam_authorization_request_approved_html: Sua solicitação foi aprovada, não se esqueça de conectar em <strong>%{date}</strong> (horário de %{location}). Boa sorte!
123
- exam_authorization_request_created: Seu registro de exame foi salvo com sucesso!
127
+ exam_authorization_request_created: Você se inscreveu para o exame do dia %{friendly_date}
124
128
  exam_authorization_request_rejected: Sua solicitação foi rejeitada porque você não atendeu aos requisitos.
125
- exam_authorization_request_saved: Seu registro de exame foi modificado com sucesso!
129
+ exam_authorization_request_saved: Você alterou seu registro de exame para o dia %{friendly_date}
126
130
  exam_authorization_request_updated: Há notícias sobre seu registro para %{description}
127
131
  exam_registration_choose_exam: Selecione o dia e a hora em que gostaria de fazer o exame
128
132
  exam_registration_explanation_html: Você tem tempo até <strong>%{date}</strong> (horário de %{location}) para se inscrever. Após essa data, sua inscrição será avaliada e você receberá uma confirmação. <br> Não se esqueça de verificar as notificações!
@@ -280,6 +284,7 @@ pt:
280
284
  notifications_will_be_here: Suas notificações aparecerão aqui
281
285
  notify_problem_with_exercise: Relatar um erro
282
286
  office: Secretariado
287
+ only_forum_questions_on_forum: Lembre-se que apenas as dúvidas relacionadas aos exercícios são respondidas no espaço de consulta. Para qualquer outro tipo de consulta, reveja a %{link}.
283
288
  only_landscape_support: Por favor, gire seu tablet ou celular para realizar exercícios
284
289
  opened: Aberto
285
290
  opened_count: '%{count} aberto'
@@ -373,6 +378,7 @@ pt:
373
378
  terms_and_conditions_continue_disclaimer: Ao continuar, você concorda %{terms_link}
374
379
  terms_and_conditions_must_be_accepted: Você deve aceitar os Termos e Condições
375
380
  test_results: Resultados do teste
381
+ time_in_minutes: "%{time} minutos"
376
382
  time_since: "há %{time}"
377
383
  time_left: Te deixam
378
384
  title: Título
@@ -1,5 +1,5 @@
1
1
  module Mumuki
2
2
  module Laboratory
3
- VERSION = '9.15.0'
3
+ VERSION = '9.18.1'
4
4
  end
5
5
  end
@@ -3,7 +3,9 @@ require 'spec_helper'
3
3
  describe ExamAuthorizationRequestsController, type: :controller, organization_workspace: :test do
4
4
  let(:user) { create(:user) }
5
5
  let(:exam) { create(:exam) }
6
- let(:exam_registration) { create(:exam_registration, exams: [exam]) }
6
+ let(:exam_id) { exam.id }
7
+ let(:organization) { Organization.current }
8
+ let(:exam_registration) { create(:exam_registration, exams: [exam], organization: organization) }
7
9
 
8
10
  before { set_current_user! user }
9
11
 
@@ -12,12 +14,24 @@ describe ExamAuthorizationRequestsController, type: :controller, organization_wo
12
14
 
13
15
  def do_post
14
16
  post :create, params: {
15
- exam_authorization_request: { exam_id: exam.id, exam_registration_id: exam_registration.id }
17
+ exam_authorization_request: { exam_id: exam_id, exam_registration_id: exam_registration.id }
16
18
  }
17
19
  end
18
20
 
19
21
  before { do_post }
20
22
 
23
+ describe 'called once in wrong organization' do
24
+ let(:organization) { create(:organization, name: 'other') }
25
+ it { expect(response.status).to eq 404 }
26
+ it { expect(exam_registration.authorization_requests.size).to be 0 }
27
+ end
28
+
29
+ describe 'called once with wrong exam' do
30
+ let(:exam_id) { create(:exam).id }
31
+ it { expect(response.status).to eq 404 }
32
+ it { expect(exam_registration.authorization_requests.size).to be 0 }
33
+ end
34
+
21
35
  describe 'called once' do
22
36
  it { expect(response.status).to eq 302 }
23
37
  it { expect(exam_registration.authorization_requests.size).to be 1 }
@@ -0,0 +1,32 @@
1
+ require 'spec_helper'
2
+
3
+ describe ExercisesController, organization_workspace: :test do
4
+ let(:user) { create(:user) }
5
+
6
+ let(:problem) { create(:problem) }
7
+ let!(:exam) { create :exam, exercises: [problem], duration: 10, start_time: 1.hour.ago, end_time: 1.hour.since }
8
+
9
+ before { reindex_current_organization! }
10
+ before { set_current_user! user }
11
+
12
+
13
+ describe 'show' do
14
+ context 'when user is in the middle of an exam' do
15
+
16
+ let!(:exam_authorization) { create :exam_authorization, exam: exam, user: user, started: true, started_at: started_at }
17
+ before { get :show, params: { id: problem.id } }
18
+
19
+ context 'when user is not out of time yet' do
20
+ let(:started_at) { 5.minutes.ago }
21
+
22
+ it { expect(response.status).to eq 200 }
23
+ end
24
+
25
+ context 'when user is out of time' do
26
+ let(:started_at) { 20.minutes.ago }
27
+
28
+ it { expect(response.status).to eq 410 }
29
+ end
30
+ end
31
+ end
32
+ end
@@ -10,7 +10,7 @@
10
10
  #
11
11
  # It's strongly recommended that you check this file into your version control system.
12
12
 
13
- ActiveRecord::Schema.define(version: 20210803175124) do
13
+ ActiveRecord::Schema.define(version: 20210929223144) do
14
14
 
15
15
  # These are extensions that must be enabled in order to support this database
16
16
  enable_extension "plpgsql"
@@ -194,6 +194,7 @@ ActiveRecord::Schema.define(version: 20210803175124) do
194
194
  t.datetime "created_at", null: false
195
195
  t.datetime "updated_at", null: false
196
196
  t.boolean "processed", default: false
197
+ t.integer "authorization_requests_limit"
197
198
  t.index ["organization_id"], name: "index_exam_registrations_on_organization_id"
198
199
  end
199
200
 
@@ -9,22 +9,30 @@ Organization.find_or_create_by!(name: 'base') do |org|
9
9
  org.public = true
10
10
  org.login_methods = Mumukit::Login::Settings.login_methods
11
11
  org.locale = 'es'
12
+ org.time_zone = 'Buenos Aires'
12
13
  end
13
14
 
14
15
  Organization.find_or_create_by!(name: 'private') do |org|
15
- org.book = Book.find_by!(slug: 'mumukiproject/mumuki-libro-aprende-a-programar-recorrido-extendido')
16
+ org.book = Book.find_by!(slug: 'mumuki/mumuki-libro-programacion')
16
17
  org.public = false
18
+ org.time_zone = 'Buenos Aires'
17
19
  end
18
20
 
19
- Organization.find_or_create_by!(name: 'primaria') do |org|
20
- org.book = Book.find_by!(slug: 'mumukiproject/mumuki-libro-primaria')
21
- org.login_methods = Mumukit::Login::Settings.login_methods
22
- org.public = true
23
- end
21
+ Organization.find_or_create_by!(name: 'primaria') do |org|
22
+ org.book = Book.find_by!(slug: 'mumukiproject/mumuki-libro-primaria')
23
+ org.login_methods = Mumukit::Login::Settings.login_methods
24
+ org.public = true
25
+ org.time_zone = 'Buenos Aires'
26
+ end
24
27
 
25
- Organization.find_or_create_by!(name: 'central')
28
+ Organization.find_or_create_by!(name: 'central') do |org|
29
+ org.book = Book.find_by!(slug: 'mumuki/mumuki-libro-programacion')
30
+ org.login_methods = Mumukit::Login::Settings.login_methods
31
+ org.public = true
32
+ org.time_zone = 'Buenos Aires'
33
+ end
26
34
 
27
- User.find_or_create_by!(uid: 'dev.student@mumuki.org') { |org| org.permissions = {student: 'central/*'} }
35
+ User.find_or_create_by!(uid: 'dev.student@mumuki.org') { |org| org.permissions = {student: 'private/*'} }
28
36
  User.find_or_create_by!(uid: 'dev.teacher@mumuki.org') { |org| org.permissions = {teacher: 'private/*'} }
29
37
  User.find_or_create_by!(uid: 'dev.admin@mumuki.org') { |org| org.permissions = {admin: '*/*'} }
30
38
  User.find_or_create_by!(uid: 'dev.owner@mumuki.org') { |org| org.permissions = {owner: '*/*'} }
@@ -30,7 +30,7 @@ feature 'not found private on app', organization_workspace: :base do
30
30
  expect(page.text).to json_eq errors: [
31
31
  'The operation on organization base' +
32
32
  ' was forbidden to user foo+1@bar.com' +
33
- ' with permissions !student:central/*;teacher:;headmaster:;janitor:;admin:;owner:;ex_student:']
33
+ ' with permissions !student:central/*;teacher:;headmaster:;janitor:;admin:;owner:']
34
34
  end
35
35
 
36
36
  scenario 'api with authentication', :json_eq_error do