def setUp(self): # too lazy to re create 'scheduler.json', so put in the # future semesters we need for i in range(13, 33): for sem in ['A', 'B']: semester = "%s%s" % (i, sem) s = DSSSemester(semester = semester) s.save()
def setUp(self): # too lazy to re create 'scheduler.json', so put in the # future semesters we need for i in range(13, 33): for sem in ['A', 'B']: semester = "%s%s" % (i, sem) s = DSSSemester(semester = semester) s.save() # I'm too lazy to fix the scheduler.json - missing commissioning c = Observing_Type.objects.get_or_create(type = 'commissioning') self.sponsor = DSSSponsor(name = "WVU", abbreviation = "WVU") self.sponsor.save() # get the one proposal and it's one session self.proposal = Proposal.objects.all()[0] s = self.proposal.session_set.all()[0] # give it some values so it will show up s.grade = SessionGrade.objects.get(grade = 'A') s.target.min_lst = 0.0 s.target.max_lst = hr2rad(12.5) s.target.save() time = 6.5 # hrs s.allotment.allocated_time = time # hrs s.allotment.allocated_repeats = 1 s.allotment.save() s.save() self.session = s
def genProposalInfo(conflictedPcode): conflict = [c for c in self.conflicts[pcode]['conflicts'] if c['searchedProp'].pcode == conflictedPcode][0] searched = conflict['searchedProp'] complete = '' thisSemester = 'V' if DssSemester.getCurrentSemester().semester == searched.semester.semester else 'S' if searched.dss_project is not None and searched.dss_project.complete: complete = 'C' lastObsDate = conflict['lastObsDate'].strftime('%m/%d/%Y') if conflict['lastObsDate']is not None else '' grades = ', '.join(set([s.grade.grade if s.grade is not None else '?' for s in searched.session_set.all()])) return [Paragraph(searched.pcode, self.styleSheet) , Paragraph(lastObsDate, self.styleSheet) , Paragraph(grades, self.styleSheet) , Paragraph(searched.title, self.styleSheet) , Paragraph(searched.pi.getLastFirstName(), self.styleSheet) , Paragraph(thisSemester, self.styleSheet) , Paragraph(complete, self.styleSheet) , Paragraph(searched.spectral_line or '', self.styleSheet) ]