Skip to content

Commit 9d432e0

Browse files
committed
Distribution Preferences: Single Table
- also consider the new option in the CSV/XLS/PDF export
1 parent 7d6fda1 commit 9d432e0

1 file changed

Lines changed: 18 additions & 9 deletions

File tree

JavaSource/org/unitime/timetable/export/courses/OfferingsCSV.java

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828
import org.springframework.beans.factory.annotation.Autowired;
2929
import org.springframework.stereotype.Service;
3030
import org.unitime.localization.impl.Localization;
31+
import org.unitime.localization.messages.CourseMessages;
3132
import org.unitime.localization.messages.ExaminationMessages;
33+
import org.unitime.timetable.defaults.ApplicationProperty;
3234
import org.unitime.timetable.export.CSVPrinter;
3335
import org.unitime.timetable.export.ExportHelper;
3436
import org.unitime.timetable.export.Exporter;
@@ -56,6 +58,7 @@
5658
@Service("org.unitime.timetable.export.Exporter:offerings.csv")
5759
public class OfferingsCSV implements Exporter {
5860
protected static ExaminationMessages EXAM = Localization.create(ExaminationMessages.class);
61+
protected static CourseMessages COURSE = Localization.create(CourseMessages.class);
5962

6063
protected @Autowired AssignmentService<ClassAssignmentProxy> classAssignmentService;
6164
protected @Autowired SolverService<ExamSolverProxy> examinationSolverService;
@@ -153,15 +156,21 @@ protected List<TableInterface> getDistributions(ExportHelper helper) {
153156
builder.setSimple(true);
154157

155158
Filter filter = new Filter(helper);
156-
for (String subjectAreaId: helper.getParameter("subjectArea").split(",")) {
157-
if (subjectAreaId.isEmpty()) continue;
158-
SubjectArea area = SubjectAreaDAO.getInstance().get(Long.valueOf(subjectAreaId));
159-
if (area == null) continue;
160-
TableInterface table = builder.getDistPrefsTableForFilter(filter, area.getUniqueId());
161-
table.setName(area.getLabel());
162-
table.setId(subjectAreaId);
163-
response.add(table);
164-
}
159+
if (ApplicationProperty.DistributionsSignleTable.isTrue()) {
160+
TableInterface table = builder.getDistPrefsTableForFilter(filter);
161+
table.setName(COURSE.sectionTitleDistributionPreferences());
162+
response.add(table);
163+
} else {
164+
for (String subjectAreaId: helper.getParameter("subjectArea").split(",")) {
165+
if (subjectAreaId.isEmpty()) continue;
166+
SubjectArea area = SubjectAreaDAO.getInstance().get(Long.valueOf(subjectAreaId));
167+
if (area == null) continue;
168+
TableInterface table = builder.getDistPrefsTableForFilter(filter, area.getUniqueId());
169+
table.setName(area.getLabel());
170+
table.setId(subjectAreaId);
171+
response.add(table);
172+
}
173+
}
165174

166175
return response;
167176
}

0 commit comments

Comments
 (0)