#809 open
shawn (at vegantech)

team notes from former users for mmsd

Reported by shawn (at vegantech) | January 2nd, 2015 @ 12:54 AM | in August 1

District wanted additional data in export, which doesn't include team notes from users that left district. This is something I should look into (former users and how they are handled) but for now provided a one off zipfile with the content.

de = DistrictExport.new d

us = User.joins(:student_comments).where("username like '#{d.id}%'").select("users.id,district_user_id").uniq;nil de.generate_csv("users","id,district_user_id",us.to_sql)

sc = StudentComment.joins(:user).where("users.username like '#{d.id}%'")
de.generate_csv("student_comments", de.csv_cols(StudentComment),sc.to_sql)

assets = Asset.where(attachable_type: "StudentComment").where(attachable_id: sc.pluck(:id))
de.generate_csv('assets',Asset.column_names.join(","),assets.to_sql)

File.open("former_user_tnotes.list", "w") do |f|
f.puts assets.collect(&:document).compact.collect(&:path).compact.collect{|e| e.split("documents/").last}.join("\n")
end
f.puts

mv former_user_tnotes.list public/system/documents/

zip former_user_tnote_assets.zip -r -@ < former_user_tnotes.list

No comments found

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Student Intervention Monitoring System

Shared Ticket Bins

People watching this ticket

Pages