Skip to content

Commit

Permalink
Subscribes (from repository) are now ordered by creation time instead…
Browse files Browse the repository at this point in the history
… of updated time
  • Loading branch information
BenjaVR committed Feb 18, 2019
1 parent 5fc593f commit c4e6cee
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/components/students/StudentsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ class StudentsTable extends React.Component<IStudentsTableProps, IStudentTableSt
const deleteStudentFn = () => selectedStudent !== undefined
? this.handleDeleteInternshipForStudent(selectedStudent)
: {};
const columns = this.getTableColumns();
const departmentsNameForStudent = selectedStudent !== undefined
? this.getDepartmentNameForStudent(selectedStudent)
: undefined;
const columns = this.getTableColumns();
return (
<React.Fragment>
<Table
Expand Down
2 changes: 1 addition & 1 deletion src/services/repositories/DepartmentsRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class DepartmentsRepository {

public static subscribeToDepartments(onListen: (departments: Department[]) => void): () => void {
return FirestoreRefs.getDepartmentCollectionRef()
.orderBy(nameof<IDepartment>("updatedTimestamp"), "desc")
.orderBy(nameof<IDepartment>("createdTimestamp"), "desc")
.onSnapshot((querySnapshot) => {
const departmentEntities = FirebaseModelMapper.mapDocsToObjects<IDepartment>(querySnapshot.docs);
const departments = departmentEntities.map((entity) => Department.fromEntity(entity));
Expand Down
2 changes: 1 addition & 1 deletion src/services/repositories/EducationsRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class EducationsRepository {

public static subscribeToEducations(onListen: (educations: Education[]) => void): () => void {
return FirestoreRefs.getEducationCollectionRef()
.orderBy(nameof<IEducation>("updatedTimestamp"), "desc")
.orderBy(nameof<IEducation>("createdTimestamp"), "desc")
.onSnapshot((querySnapshot) => {
const educationEntities = FirebaseModelMapper.mapDocsToObjects<IEducation>(querySnapshot.docs);
const educations = educationEntities.map((entity) => Education.fromEntity(entity));
Expand Down
2 changes: 1 addition & 1 deletion src/services/repositories/SchoolsRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class SchoolsRepository {

public static subscribeToSchools(onListen: (schools: School[]) => void): () => void {
return FirestoreRefs.getSchoolCollectionRef()
.orderBy(nameof<ISchool>("updatedTimestamp"), "desc")
.orderBy(nameof<ISchool>("createdTimestamp"), "desc")
.onSnapshot((querySnapshot) => {
const schoolEntities = FirebaseModelMapper.mapDocsToObjects<ISchool>(querySnapshot.docs);
const schools = schoolEntities.map((entity) => School.fromEntity(entity));
Expand Down
2 changes: 1 addition & 1 deletion src/services/repositories/StudentsRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class StudentsRepository {

public static subscribeToStudents(onListen: (students: Student[]) => void): () => void {
return FirestoreRefs.getStudentCollectionRef()
.orderBy(nameof<IStudent>("updatedTimestamp"), "desc")
.orderBy(nameof<IStudent>("createdTimestamp"), "desc")
.onSnapshot((querySnapshot) => {
const studentEntities = FirebaseModelMapper.mapDocsToObjects<IStudent>(querySnapshot.docs);
const students = studentEntities.map((entity) => Student.fromEntity(entity));
Expand Down

0 comments on commit c4e6cee

Please sign in to comment.