fixed documents and professors. changed seeds

This commit is contained in:
Thorben Rudeloff
2017-03-13 13:23:53 +01:00
parent d0a8452456
commit db659001ed
4 changed files with 69 additions and 135 deletions
+1 -1
View File
@@ -13,4 +13,4 @@ div.well
= f.static_control label: 'Uploaded file' = f.static_control label: 'Uploaded file'
= link_to @document.file.filename, @document.file_url = link_to @document.file.filename, @document.file_url
= f.hidden_field :file_cache, readonly: true = f.hidden_field :file_cache, readonly: true
= f.submit = f.submit
+1 -1
View File
@@ -1,4 +1,4 @@
- content_for :page_header - content_for :page_header
| Dokument - #{@document.semester.name} / #{@document.professor.name} / #{@document.lesson.name} / #{@document.doc_type.name} | Dokument - #{@document.semester.name} / #{@document.professor.last_name} / #{@document.lesson.name} / #{@document.doc_type.name}
= render 'form' = render 'form'
+1 -1
View File
@@ -1,4 +1,4 @@
- content_for :page_header - content_for :page_header
| Professor - #{@professor.name} | Professor - #{@professor.last_name}
= render 'form' = render 'form'
+66 -132
View File
@@ -1,60 +1,64 @@
User.create! :email => "admin@FSMNI.THM.de", :password => "imbaimba123", :password_confirmation => "imbaimba123" User.create! :email => "admin2@FSMNI.THM.de", :password => "imbaimba123", :password_confirmation => "imbaimba123"
usem = Semester.create!(name: "Unbekant") usem = Semester.create!(name: "Unbekant")
(5..15).each do |i| (0..20).each do |i|
Semester.create!(name: "#{"%02d" % i} SoSe") Semester.create!(name: "#{"%02d" % i}SoSe")
Semester.create!(name: "#{"%02d" % i}/#{"%02d" % (i+1)} WiSe") Semester.create!(name: "#{"%02d" % i}#{"%02d" % (i+1)}WiSe")
end end
punbekant = Professor.create!(first_name: 'Unbekant', last_name: 'Unbekant') punbekant = Professor.create!(first_name: 'Unbekant', last_name: 'Unbekant')
geisse = Professor.create!(first_name: 'Hellwig', last_name: 'Geisse') HellwigGeisse = Professor.create!(first_name: 'Hellwig', last_name: 'Geisse')
wuest = Professor.create!(first_name: 'Klaus', last_name: 'Wuest') KlausWuest = Professor.create!(first_name: 'Klaus', last_name: 'Wuest')
ulbrich = Professor.create!(first_name: 'Norman', last_name: 'Ulbrich') NormanUlbrich = Professor.create!(first_name: 'Norman', last_name: 'Ulbrich')
dominik = Professor.create!(first_name: 'Andreas', last_name: 'Dominik') AndreasDominik = Professor.create!(first_name: 'Andreas', last_name: 'Dominik')
fmueller = Professor.create!(first_name: 'Fabian', last_name: 'Müller') ArisChristidis = Professor.create!(first_name: 'Aris', last_name: 'Christidis')
christidis = Professor.create!(first_name: 'Aris', last_name: 'Christidis') AlexanderDworschak = Professor.create!(first_name: 'Alexander', last_name: 'Dworschak')
dworschak = Professor.create!(first_name: 'Alexander', last_name: 'Dworschak') BertholdFranzen = Professor.create!(first_name: 'Berthold', last_name: 'Franzen')
franzen = Professor.create!(first_name: 'Berthold', last_name: 'Franzen') LutzEichner = Professor.create!(first_name: 'Lutz', last_name: 'Eichner')
eichner = Professor.create!(first_name: 'Lutz', last_name: 'Eichner') BettinaJust = Professor.create!(first_name: 'Bettina', last_name: 'Just')
just = Professor.create!(first_name: 'Bettina', last_name: 'Just') MichaelJäger = Professor.create!(first_name: 'Michael', last_name: 'Jäger')
jäger = Professor.create!(first_name: 'Michael', last_name: 'Jäger') AchimKaufmann = Professor.create!(first_name: 'Achim', last_name: 'Kaufmann')
kaufmann = Professor.create!(first_name: 'Achim', last_name: 'Kaufmann') PeterKneisel = Professor.create!(first_name: 'Peter', last_name: 'Kneisel')
kneisel = Professor.create!(first_name: 'Peter', last_name: 'Kneisel') ThomasKarlLetschert = Professor.create!(first_name: 'Thomas Karl', last_name: 'Letschert')
letschert = Professor.create!(first_name: 'Thomas Karl', last_name: 'Letschert') PeterLöffler = Professor.create!(first_name: 'Peter', last_name: 'Löffler')
löffler = Professor.create!(first_name: 'Peter', last_name: 'Löffler') HansRudolfMetz = Professor.create!(first_name: 'Hans Rudolf', last_name: 'Metz')
metz = Professor.create!(first_name: 'Hans-Rudolf', last_name: 'Metz') BerndMüller = Professor.create!(first_name: 'Bernd', last_name: 'Müller')
bmüller = Professor.create!(first_name: 'Bernd', last_name: 'Müller') KlausQuibeldeyCirkel = Professor.create!(first_name: 'Klaus', last_name: 'Quibeldey Cirkel ')
kqc = Professor.create!(first_name: 'Klaus', last_name: 'Quibeldey-Cirkel ') BurkhardtRenz = Professor.create!(first_name: 'Burkhardt', last_name: 'Renz')
renz = Professor.create!(first_name: 'Burkhardt', last_name: 'Renz') WolfgangSchmitt = Professor.create!(first_name: 'Wolfgang', last_name: 'Schmitt')
schmitt = Professor.create!(first_name: 'Wolfgang', last_name: 'Schmitt') WolfgangMartin = Professor.create!(first_name: 'Wolfgang', last_name: 'Martin')
martin = Professor.create!(first_name: 'Wolfgang', last_name: 'Martin') WolfgangHenrich = Professor.create!(first_name: 'Wolfgang', last_name: 'Henrich')
oop_team = Professor.create!(first_name: 'Team', last_name: 'OOP') ChristianWenzelBenner = Professor.create!(first_name: 'Christian', last_name: 'Wenzel Benner')
henrich = Professor.create!(first_name: 'Wolfgang', last_name: 'Henrich') MichaelaPeschk = Professor.create!(first_name: 'Michaele', last_name: 'Peschk')
ReinerBurger = Professor.create!(first_name: 'Reiner', last_name: 'Burger')
FlorianvonZabiensky = Professor.create!(first_name: 'Florian', last_name: 'von Zabiensky')
MichaelMenzel = Professor.create!(first_name: 'Michael', last_name: 'Menzel')
dm = Lesson.create!(name: 'Diskrete Mathematik',short_name: 'DM') DiskreteMathematik = Lesson.create!(name: 'Diskrete Mathematik',short_name: 'DM')
gdi = Lesson.create!(name: 'Grundlagen der Informatik',short_name: 'GDI') GrundlagenderInformatik = Lesson.create!(name: 'Grundlagen der Informatik',short_name: 'GDI')
ntg = Lesson.create!(name: 'Naturwissenschaftliche und technische Grundlagen',short_name: 'NTG') NaturwissenschaftlicheundtechnischeGrundlagen = Lesson.create!(name: 'Naturwissenschaftliche und technische Grundlagen',short_name: 'NTG')
oop = Lesson.create!(name: 'Objektorientierte Programmierung',short_name: 'OOP') ObjektorientierteProgrammierung = Lesson.create!(name: 'Objektorientierte Programmierung',short_name: 'OOP')
rnua = Lesson.create!(name: 'Rechnernetze und ihre Anwendung',short_name: 'RnuA') RechnernetzeundihreAnwendung = Lesson.create!(name: 'Rechnernetze und ihre Anwendung',short_name: 'RnuA')
ad = Lesson.create!(name: 'Algorithmen und Datenstrukturen',short_name: 'AD') AlgorithmenundDatenstrukturen = Lesson.create!(name: 'Algorithmen und Datenstrukturen',short_name: 'AD')
bwl = Lesson.create!(name: 'DV-orientierte Betriebswirtschaftslehre',short_name: 'DV-BWL') bwl = Lesson.create!(name: 'DV-orientierte Betriebswirtschaftslehre',short_name: 'DV-BWL')
ibs = Lesson.create!(name: 'Internetbasierte Systeme',short_name: 'IBS') InternetbasierteSysteme = Lesson.create!(name: 'Internetbasierte Systeme',short_name: 'IBS')
la = Lesson.create!(name: 'Lineare Algebra',short_name: 'LA') LineareAlgebra = Lesson.create!(name: 'Lineare Algebra',short_name: 'LA')
pis = Lesson.create!(name: 'Programmierung interaktiver Systeme',short_name: 'PIS') ProgrammierunginteraktiverSysteme = Lesson.create!(name: 'Programmierung interaktiver Systeme',short_name: 'PIS')
recht = Lesson.create!(name: 'Recht für Informatiker',short_name: 'Recht') RechtfürInformatiker = Lesson.create!(name: 'Recht für Informatiker',short_name: 'Recht')
cb = Lesson.create!(name: 'Compilerbau',short_name: 'CB') Compilerbau = Lesson.create!(name: 'Compilerbau',short_name: 'CB')
dbs = Lesson.create!(name: 'Datenbanksysteme',short_name: 'DBS') Datenbanksysteme = Lesson.create!(name: 'Datenbanksysteme',short_name: 'DBS')
ksp = Lesson.create!(name: 'Konzepte systemnaher Programmierung',short_name: 'KSP') KonzeptesystemnaherProgrammierung = Lesson.create!(name: 'Konzepte systemnaher Programmierung',short_name: 'KSP')
swt = Lesson.create!(name: 'Softwaretechnik',short_name: 'SWT') Softwaretechnik = Lesson.create!(name: 'Softwaretechnik',short_name: 'SWT')
stochastik = Lesson.create!(name: 'Stochastik') Stochastik = Lesson.create!(name: 'Stochastik')
bs = Lesson.create!(name: 'Betriebssysteme',short_name: 'BS') Betriebssysteme = Lesson.create!(name: 'Betriebssysteme',short_name: 'BS')
mpt = Lesson.create!(name: 'Mikroprozessortechnik',short_name: 'MPT') Mikroprozessortechnik = Lesson.create!(name: 'Mikroprozessortechnik',short_name: 'MPT')
ospw = Lesson.create!(name: 'Open-Source-Programmierwerkzeuge',short_name: 'OSPW') OpenSourceProgrammierwerkzeuge = Lesson.create!(name: 'Open Source Programmierwerkzeuge',short_name: 'OSPW')
cg = Lesson.create!(name: 'Computer Grafiken',short_name: 'CG') AnalysisundnumerischeMethoden = Lesson.create!(name: 'Analysis und numerische Methoden', short_name: 'ANM')
npp = Lesson.create!(name: 'Nichtprozedurale Programmierung',short_name: 'NPP') Codequalität = Lesson.create!(name: 'Codequalität', short_name: 'CQ')
fp = Lesson.create!(name: 'Funktionale Programmierung',short_name: 'FP') Projektmanagment = Lesson.create!(name: 'Projektmanagment', short_name: 'PM')
nvp = Lesson.create!(name: 'Nebenläufige und verteilte Programme',short_name: 'NVP') SichereProgrammierung = Lesson.create!(name: 'Sichere Programmierung', short_name: 'SP')
c = Lesson.create!(name: 'C#',short_name: 'C#') Skriptsprachen = Lesson.create!(name: 'Skriptsprachen', short_name: 'SSP')
kuf = Lesson.create!(name: 'Komponenten & Frameworks', short_name: 'KuF') SystemsicherheitundDatenschutz = Lesson.create!(name: 'SystemsicherheitundDatenschutz', short_name: 'SSDS')
TechnischesEnglisch = Lesson.create!(name: 'Technisches Englisch', short_name: 'TE')
k = DocType.create!(name: 'Klausur') k = DocType.create!(name: 'Klausur')
kl = DocType.create!(name: 'Klausur + Lösung') kl = DocType.create!(name: 'Klausur + Lösung')
@@ -62,85 +66,15 @@ m = DocType.create!(name: 'Mitschrift')
ü = DocType.create!(name: 'Übung') ü = DocType.create!(name: 'Übung')
s = DocType.create!(name: 'Sonstiges') s = DocType.create!(name: 'Sonstiges')
path = '/home/murao/Documents/altklausuren/fin' path = '/home/kuchen/Klaus/document/'
Document.create!( Dir.foreach('/home/kuchen/Klaus/document') do |item|
semester: Semester.find_by(name: '07/08 WiSe'), next if item == '.' or item == '..'
professor: christidis, lesson: cg, doc_type: k, i=item.split('_')
file: File.open("#{path}/A. Christidis - CG - S0708 - Teile.PDF")) Document.create!(
Document.create!( lesson: i[0].constantize,
semester: Semester.find_by(name: '07/08 WiSe'), professor: i[1].constantize,
professor: punbekant, lesson: bwl, doc_type: k, semester: Semester.find_by(name: i[2]),
file: File.open("#{path}/? - DV-orientierte Betriebswirtschaft - WiSe0708.PDF")) doc_type: k,
Document.create!( file: File.open("#{path}#{item}"))
semester: Semester.find_by(name: '13 SoSe'), end
professor: geisse, lesson: bs, doc_type: k,
file: File.open("#{path}/H. Geisse - Betriebssysteme - SoSe13.PDF"))
Document.create!(
semester: Semester.find_by(name: '13/14 WiSe'),
professor: geisse, lesson: bs, doc_type: k,
file: File.open("#{path}/H. Geisse - Betriebssysteme - WiSe1314.PDF"))
Document.create!(
semester: Semester.find_by(name: '06/07 WiSe'),
professor: geisse, lesson: gdi, doc_type: k,
file: File.open("#{path}/H. Geisse - Grundlagen der Informatik - WiSe0607.PDF"))
Document.create!(
semester: Semester.find_by(name: '07 SoSe'),
professor: geisse, lesson: npp, doc_type: k,
file: File.open("#{path}/H . Geisse - Nichtprozedurale Programmierung - SoSe07.PDF"))
Document.create!(
semester: Semester.find_by(name: '07 SoSe'),
professor: metz, lesson: la, doc_type: k,
file: File.open("#{path}/H.-R. Metz - Lineare Algebra - SoSe07.PDF"))
Document.create!(
semester: Semester.find_by(name: '07/08 WiSe'),
professor: wuest, lesson: mpt, doc_type: k,
file: File.open("#{path}/K. Wuest - Mikroprozessortechnik - WiSe0708.PDF"))
Document.create!(
semester: Semester.find_by(name: '11/12 WiSe'),
professor: letschert, lesson: oop, doc_type: k,
file: File.open("#{path}/Letschert - OOP - WiSe1112.PDF"))
Document.create!(
semester: Semester.find_by(name: '12/13 WiSe'),
professor: ulbrich, lesson: fp, doc_type: k,
file: File.open("#{path}/N. Ulbrich - Funktionale Programmierung - WiSe1213.PDF"))
Document.create!(
semester: Semester.find_by(name: '09 SoSe'),
professor: ulbrich, lesson: ospw, doc_type: k,
file: File.open("#{path}/N. Ulbrich - Open-Source-Programmierwerkzeuge - SoSe09.PDF"))
Document.create!(
semester: Semester.find_by(name: '10 SoSe'),
professor: ulbrich, lesson: ospw, doc_type: k,
file: File.open("#{path}/N. Ulbrich - Open-Source-Programmierwerkzeuge - SoSe10.PDF"))
Document.create!(
semester: Semester.find_by(name: '12 SoSe'),
professor: ulbrich, lesson: ospw, doc_type: k,
file: File.open("#{path}/N. Ulbrich - Open-Source-Programmierwerkzeuge - SoSe12.PDF"))
Document.create!(
semester: usem,
professor: punbekant, lesson: oop, doc_type: s,
file: File.open("#{path}/OOP - allgemeine Fragen&diverses.PDF"))
Document.create!(
semester: Semester.find_by(name: '13 SoSe'),
professor: oop_team, lesson: oop, doc_type: k,
file: File.open("#{path}/OOP_Team - OOP - SoSe13.PDF"))
Document.create!(
semester: usem,
professor: punbekant, lesson: oop, doc_type: ü,
file: File.open("#{path}/OOP-Uebungen.PDF"))
Document.create!(
semester: Semester.find_by(name: '07/08 WiSe'),
professor: letschert, lesson: nvp, doc_type: k,
file: File.open("#{path}/T. Letschert - NVP - WiSe0708.PDF"))
Document.create!(
semester: Semester.find_by(name: '06/07 WiSe'),
professor: henrich, lesson: c, doc_type: k,
file: File.open("#{path}/W. Henrich - C# - WiSe0607.PDF"))
Document.create!(
semester: Semester.find_by(name: '07 SoSe'),
professor: henrich, lesson: kuf, doc_type: k,
file: File.open("#{path}/W. Henrich - KuF - SoSe07.PDF"))
Document.create!(
semester: Semester.find_by(name: '07/08 WiSe'),
professor: henrich, lesson: kuf, doc_type: k,
file: File.open("#{path}/W. Henrich - KuF - WiSe0708.PDF"))