Skip to content

Commit 8377633

Browse files
committed
fixing destroy
1 parent bdbd34f commit 8377633

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

app/controllers/records_controller.rb

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,20 @@ def determine_assignment_type(file_name)
233233
"Grader_Matches.csv" => "Grader"
234234
}[file_name]
235235
end
236+
237+
def add_to_modified_assignments(file_name, model_record)
238+
path = Rails.root.join("app", "Charizard", "util", "public", "output", "Modified_assignments.csv")
239+
if model_record.present?
240+
attributes = model_record.attributes.except("id", "created_at", "updated_at")
241+
headers = attributes.keys
242+
243+
write_headers = !File.exist?(path) || File.zero?(path)
244+
245+
CSV.open(path, "a", write_headers: write_headers, headers: headers) do |csv|
246+
csv << attributes.values
247+
end
248+
end
249+
end
236250
end
237251

238252

@@ -322,21 +336,6 @@ def move_to_modified_assignments(file_name, record)
322336
end
323337
end
324338

325-
def add_to_modified_assignments(file_name, model_record)
326-
path = Rails.root.join("app", "Charizard", "util", "public", "output", "Modified_assignments.csv")
327-
if model_record.present?
328-
attributes = model_record.attributes.except("id", "created_at", "updated_at")
329-
headers = attributes.keys
330-
331-
write_headers = !File.exist?(path) || File.zero?(path)
332-
333-
CSV.open(path, "a", write_headers: write_headers, headers: headers) do |csv|
334-
csv << attributes.values
335-
end
336-
337-
end
338-
339-
# This removes the recoord form the previous cvs file
340339
def update_csv(file_name, uin)
341340
records = read_csv(file_name).reject { |r| r["UIN"] == uin }
342341
file_path = Rails.root.join("app", "Charizard", "util", "public", "output", file_name)
@@ -389,4 +388,4 @@ def determine_assignment_type1(record)
389388
end
390389
end
391390

392-
end
391+

0 commit comments

Comments
 (0)