Skip to content

Commit

Permalink
Fix debugger on submission detail and evalution pages
Browse files Browse the repository at this point in the history
  • Loading branch information
jorg-vr committed Feb 9, 2024
1 parent c1ba5a1 commit c6743fd
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 16 deletions.
1 change: 1 addition & 0 deletions app/assets/javascripts/coding_scratchpad.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export async function initPapyros(programmingLanguage: ProgrammingLanguage): Pro
locale: i18n.locale(),
inputMode: InputMode.Interactive,
channelOptions: {
root: "/",
serviceWorkerName: "inputServiceWorker.js"
}
});
Expand Down
8 changes: 4 additions & 4 deletions app/views/activities/_coding_scratchpad.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ data-bs-target="#scratchpad-offcanvas" aria-controls="scratchpad-offcanvas" id="
<div class="offcanvas offcanvas-end" tabindex="-1" id="scratchpad-offcanvas" data-bs-keyboard="false">
<div class="scratchpad-header">
<h4>
<%= activity_icon(@activity, 24) %>
&nbsp; <%= t('.title', programming_language: @activity.programming_language.name.titleize) %>
<%= activity_icon(activity, 24) %>
&nbsp; <%= t('.title', programming_language: activity.programming_language.name.titleize) %>
</h4>
<div class="flex-spacer"></div>
<button class="btn-close btn-close-white" id="scratchpad-offcanvas-close-btn"
Expand Down Expand Up @@ -45,7 +45,7 @@ data-bs-target="#scratchpad-offcanvas" aria-controls="scratchpad-offcanvas" id="
</div>
<div class="tab-content" id="scratchpad-tab-content">
<div id="scratchpad-description" role="tabpanel" class="tab-pane fade show active">
<%= description_iframe @activity %>
<%= description_iframe activity %>
</div>
<div id="scratchpad-trace-wrapper" role="tabpanel" class="tab-pane fade"></div>
</div>
Expand All @@ -56,7 +56,7 @@ data-bs-target="#scratchpad-offcanvas" aria-controls="scratchpad-offcanvas" id="
<script type="text/javascript">
dodona.ready.then(function () {
dodona.initCodingScratchpad(
"<%= escape_javascript @activity.programming_language&.name %>"
"<%= escape_javascript activity.programming_language&.name %>"
);
});
</script>
3 changes: 3 additions & 0 deletions app/views/feedbacks/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@
</div>
</div>
<% if @feedback.submission.present? %>
<% if @feedback.submission.exercise.programming_language&.name == 'python' %>
<%= render partial: 'activities/coding_scratchpad', locals: { activity: @feedback.submission.exercise } %>
<% end %>
<script>
dodona.ready.then(function () {
window.dodona.setEvaluationId(<%= @feedback.evaluation.id %>);
Expand Down
3 changes: 3 additions & 0 deletions app/views/submissions/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
</div>
</div>
</div>
<% if @submission.exercise.programming_language&.name == 'python' %>
<%= render partial: 'activities/coding_scratchpad', locals: { activity: @submission.exercise } %>
<% end %>
<% if @submission.queued? || @submission.running? %>
<script>setTimeout(function () {
location.reload(1);
Expand Down
11 changes: 4 additions & 7 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,10 @@

resources :courses do
resources :series, only: %i[new index] do
resources :activities, only: %i[show edit update], concerns: %i[mediable readable submitable infoable] do
get 'inputServiceWorker.js', to: 'activities#input_service_worker', as: 'input_service_worker'
end
resources :activities, only: %i[show edit update], concerns: %i[mediable readable submitable infoable]
resources :activities, only: %i[show edit update], concerns: %i[mediable readable submitable infoable], path: '/exercises', as: 'exercises'
end
resources :activities, only: %i[show edit update], concerns: %i[mediable readable submitable infoable] do
get 'inputServiceWorker.js', to: 'activities#input_service_worker', as: 'input_service_worker'
end
resources :activities, only: %i[show edit update], concerns: %i[mediable readable submitable infoable]
resources :activities, only: %i[show edit update], concerns: %i[mediable readable submitable infoable], path: '/exercises', as: 'exercises'
resources :submissions, only: [:index]
resources :activity_read_states, only: [:index]
Expand Down Expand Up @@ -126,7 +122,6 @@

resources :activities, only: %i[index show edit update], concerns: %i[readable mediable submitable infoable] do
member do
get 'inputServiceWorker.js', to: 'activities#input_service_worker', as: 'input_service_worker'
scope 'description/:token/' do
constraints host: Rails.configuration.sandbox_host do
root to: 'activities#description', as: 'description'
Expand Down Expand Up @@ -270,6 +265,8 @@
get 'timeseries', to: 'statistics#timeseries'
get 'cumulative_timeseries', to: 'statistics#cumulative_timeseries'
end

get 'inputServiceWorker.js', to: 'activities#input_service_worker', as: 'input_service_worker'
end

# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@codemirror/language-data": "^6.4.0",
"@codemirror/state": "^6.3.3",
"@codemirror/view": "^6.23.1",
"@dodona/papyros": "2.2.0-beta.8",
"@dodona/papyros": "2.2.0-beta.9",
"@dodona/pyodide-trace-library": "^2.0.7",
"@lezer/common": "^1.2.1",
"@lezer/highlight": "^1.2.0",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1327,10 +1327,10 @@
resolved "https://registry.yarnpkg.com/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz#1d572bfbbe14b7704e0ba0f39b74815b84870d70"
integrity sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==

"@dodona/[email protected].8":
version "2.2.0-beta.8"
resolved "https://registry.yarnpkg.com/@dodona/papyros/-/papyros-2.2.0-beta.8.tgz#cea08e1b90c52ae9dd14cf7c9476742ffa6a6357"
integrity sha512-uQZocd/rj+gny8BUP62repJl4/ol/tsUFfymACZZ4nveobdsa+DZzlFQFprscF8NvkpPPeOzPX/yKGx5jVlN3A==
"@dodona/[email protected].9":
version "2.2.0-beta.9"
resolved "https://registry.yarnpkg.com/@dodona/papyros/-/papyros-2.2.0-beta.9.tgz#01dab05c1cea635de3ca0328c50b4674429791c4"
integrity sha512-cv3mzRg/O5UABoftcLpO0+XHfdBf8lmbIop9c6EsbrAG8PJgtZaY6f8wIgYnnLtO/++V0s/Tl2dR61tCHtCh2A==
dependencies:
"@codemirror/autocomplete" "^6.11.1"
"@codemirror/commands" "^6.3.1"
Expand Down

0 comments on commit c6743fd

Please sign in to comment.