Skip to content

Commit

Permalink
corrected errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jhs-panda committed Oct 27, 2024
1 parent 0ac3f1a commit a9a71e2
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 3 deletions.
8 changes: 5 additions & 3 deletions app/views/assessments/_edit_handin.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@
function toggleHandinAutolab(disable_button) {
var handinField = document.querySelector('.handin-filename-field');
handinField.disabled = disable_button.checked;
if (!handinField.disabled) {
if (!handinField.disabled && !handinField.value) {
handinField.value = 'handin.c';
}
}

document.addEventListener('DOMContentLoaded', function() {
var disableHandinsCheckbox = document.querySelector('.disable-handins-toggle');
toggleHandinAutolab(disableHandinsCheckbox);
disableHandinsCheckbox.addEventListener('change', function() {
toggleHandinAutolab(disableHandinsCheckbox);
});
});
</script>
<% end %>
Expand Down Expand Up @@ -49,8 +52,7 @@
class: "disable-handins-toggle",
onchange: "toggleHandinAutolab(this)" %>
<%= f.text_field :handin_filename,
value: "handin.c",
disabled: true,
value: f.object.handin_filename.presence || "handin.c",
help_text: "The suffix that is appended to student submission files. Autolab stores submission files in the handin directory as email/version_fname",
placeholder: "E.g. mm.c",
class: "handin-filename-field" %>
Expand Down
22 changes: 22 additions & 0 deletions lib/update_course.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
class Updater
def self.update(course)
# Simulate some processing
sleep(2) # Simulate a time-consuming task
"Successfully updated the course: #{course.name}"
end
end

# Simulated course class
class Course
attr_accessor :name

def initialize(name)
@name = name
end
end

# This is where the action gets executed with a simulated course
if __FILE__ == $0
course = Course.new("Introduction to Ruby")
puts Updater.update(course)
end
2 changes: 2 additions & 0 deletions test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
hello
world
2 changes: 2 additions & 0 deletions test2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
hello
world

0 comments on commit a9a71e2

Please sign in to comment.