Merge branch 'edge_v4' into 'develop_v4'

Restructured epalclasses

See merge request !242
parents 06f93885 73892c9c
import { SECTORCOURSES_RECEIVED, SECTORCOURSES_SECTOR_SELECTED_SAVE, SECTORCOURSES_SELECTED_SAVE, SECTORCOURSES_INIT } from "../constants"; import { SECTORCOURSES_RECEIVED, SECTORCOURSES_SELECTED_SAVE, SECTORCOURSES_INIT } from "../constants";
import { Injectable } from "@angular/core"; import { Injectable } from "@angular/core";
import { NgRedux } from "@angular-redux/store"; import { NgRedux } from "@angular-redux/store";
import { IAppState } from "../store"; import { IAppState } from "../store";
...@@ -33,18 +33,6 @@ export class SectorCoursesActions { ...@@ -33,18 +33,6 @@ export class SectorCoursesActions {
}); });
}; };
selectSector = (prevChoice, newChoice) => {
return this._ngRedux.dispatch({
type: SECTORCOURSES_SECTOR_SELECTED_SAVE,
payload: {
prevChoice: prevChoice,
newChoice: newChoice
// sectorCoursesSelected,
// sectorSelected
}
});
}
saveSectorCoursesSelected = (oldSIndex, oldCIndex, checked, i, j) => { saveSectorCoursesSelected = (oldSIndex, oldCIndex, checked, i, j) => {
return this._ngRedux.dispatch({ return this._ngRedux.dispatch({
type: SECTORCOURSES_SELECTED_SAVE, type: SECTORCOURSES_SELECTED_SAVE,
...@@ -54,8 +42,6 @@ export class SectorCoursesActions { ...@@ -54,8 +42,6 @@ export class SectorCoursesActions {
checked: checked, checked: checked,
sIndex: i, sIndex: i,
cIndex: j cIndex: j
// sectorCoursesSelected,
// sectorSelected
} }
}); });
}; };
......
...@@ -11,7 +11,7 @@ import { EpalClassesActions } from "../../actions/epalclass.actions"; ...@@ -11,7 +11,7 @@ import { EpalClassesActions } from "../../actions/epalclass.actions";
import { ISectorFieldRecords } from "../../store/sectorfields/sectorfields.types"; import { ISectorFieldRecords } from "../../store/sectorfields/sectorfields.types";
import { ISectorRecords } from "../../store/sectorcourses/sectorcourses.types"; import { ISectorRecords } from "../../store/sectorcourses/sectorcourses.types";
import { IRegionRecord, IRegionRecords, IRegionSchoolRecord } from "../../store/regionschools/regionschools.types"; import { IRegionRecord, IRegionRecords, IRegionSchoolRecord } from "../../store/regionschools/regionschools.types";
import { IEpalClasses } from "../../store/epalclasses/epalclasses.types"; import { IEpalClassRecords } from "../../store/epalclasses/epalclasses.types";
import {AppSettings} from "../../app.settings"; import {AppSettings} from "../../app.settings";
import { REGION_SCHOOLS_INITIAL_STATE } from "../../store/regionschools/regionschools.initial-state"; import { REGION_SCHOOLS_INITIAL_STATE } from "../../store/regionschools/regionschools.initial-state";
import { EPALCLASSES_INITIAL_STATE } from "../../store/epalclasses/epalclasses.initial-state"; import { EPALCLASSES_INITIAL_STATE } from "../../store/epalclasses/epalclasses.initial-state";
...@@ -27,16 +27,16 @@ import { SECTOR_FIELDS_INITIAL_STATE } from "../../store/sectorfields/sectorfiel ...@@ -27,16 +27,16 @@ import { SECTOR_FIELDS_INITIAL_STATE } from "../../store/sectorfields/sectorfiel
<li class="list-group-item active"> <li class="list-group-item active">
Τάξη φοίτησης στο νέο σχολικό έτος Τάξη φοίτησης στο νέο σχολικό έτος
</li> </li>
<li class="list-group-item" *ngIf="epalclass$.name === '1'"> <li class="list-group-item" *ngIf="epalclass$.get('name') === '1'">
Α’ Λυκείου Α’ Λυκείου
</li> </li>
<li class="list-group-item" *ngIf="epalclass$.name === '2'"> <li class="list-group-item" *ngIf="epalclass$.get('name') === '2'">
Β’ Λυκείου Β’ Λυκείου
</li> </li>
<li class="list-group-item" *ngIf="epalclass$.name === '3'"> <li class="list-group-item" *ngIf="epalclass$.get('name') === '3'">
Γ’ Λυκείου Γ’ Λυκείου
</li> </li>
<li class="list-group-item" *ngIf="epalclass$.name === '4'"> <li class="list-group-item" *ngIf="epalclass$.get('name') === '4'">
Δ’ Λυκείου Δ’ Λυκείου
</li> </li>
...@@ -83,7 +83,7 @@ import { SECTOR_FIELDS_INITIAL_STATE } from "../../store/sectorfields/sectorfiel ...@@ -83,7 +83,7 @@ import { SECTOR_FIELDS_INITIAL_STATE } from "../../store/sectorfields/sectorfiel
private regions$: BehaviorSubject<IRegionRecords>; private regions$: BehaviorSubject<IRegionRecords>;
private selectedSchools$: BehaviorSubject<Array<IRegionSchoolRecord>> = new BehaviorSubject(Array()); private selectedSchools$: BehaviorSubject<Array<IRegionSchoolRecord>> = new BehaviorSubject(Array());
private sectorFields$: BehaviorSubject<ISectorFieldRecords>; private sectorFields$: BehaviorSubject<ISectorFieldRecords>;
private epalclasses$: BehaviorSubject<IEpalClasses>; private epalclasses$: BehaviorSubject<IEpalClassRecords>;
private epalclassesSub: Subscription; private epalclassesSub: Subscription;
private sectorsSub: Subscription; private sectorsSub: Subscription;
private regionsSub: Subscription; private regionsSub: Subscription;
...@@ -153,15 +153,15 @@ import { SECTOR_FIELDS_INITIAL_STATE } from "../../store/sectorfields/sectorfiel ...@@ -153,15 +153,15 @@ import { SECTOR_FIELDS_INITIAL_STATE } from "../../store/sectorfields/sectorfiel
this.epalclassesSub = this._ngRedux.select("epalclasses") this.epalclassesSub = this._ngRedux.select("epalclasses")
.subscribe(epalclasses => { .subscribe(epalclasses => {
let ecs = <IEpalClasses>epalclasses; let ecs = <IEpalClassRecords>epalclasses;
ecs.reduce(({}, epalclass) => { ecs.reduce(({}, epalclass) => {
if (epalclass.name === "Α' Λυκείου") if (epalclass.get("name") === "Α' Λυκείου")
this.classSelected = 1; this.classSelected = 1;
else if (epalclass.name === "Β' Λυκείου") else if (epalclass.get("name") === "Β' Λυκείου")
this.classSelected = 2; this.classSelected = 2;
else if (epalclass.name === "Γ' Λυκείου") else if (epalclass.get("name") === "Γ' Λυκείου")
this.classSelected = 3; this.classSelected = 3;
else if (epalclass.name === "Δ' Λυκείου") else if (epalclass.get("name") === "Δ' Λυκείου")
this.classSelected = 4; this.classSelected = 4;
return epalclass; return epalclass;
}, {}); }, {});
...@@ -181,19 +181,15 @@ import { SECTOR_FIELDS_INITIAL_STATE } from "../../store/sectorfields/sectorfiel ...@@ -181,19 +181,15 @@ import { SECTOR_FIELDS_INITIAL_STATE } from "../../store/sectorfields/sectorfiel
ngOnDestroy() { ngOnDestroy() {
if (this.regionsSub) { if (this.regionsSub) {
this.regionsSub.unsubscribe(); this.regionsSub.unsubscribe();
// this.regions$.unsubscribe();
} }
if (this.sectorsSub) { if (this.sectorsSub) {
this.sectorsSub.unsubscribe(); this.sectorsSub.unsubscribe();
// this.sectors$.unsubscribe();
} }
if (this.sectorFieldsSub) { if (this.sectorFieldsSub) {
this.sectorFieldsSub.unsubscribe(); this.sectorFieldsSub.unsubscribe();
// this.sectorFields$.unsubscribe();
} }
if (this.epalclassesSub) { if (this.epalclassesSub) {
this.epalclassesSub.unsubscribe(); this.epalclassesSub.unsubscribe();
// this.epalclasses$.unsubscribe();
} }
} }
......
...@@ -9,7 +9,7 @@ import { IStudentDataFieldRecords } from "../../store/studentdatafields/studentd ...@@ -9,7 +9,7 @@ import { IStudentDataFieldRecords } from "../../store/studentdatafields/studentd
import { IRegionRecord, IRegionRecords, IRegionSchoolRecord } from "../../store/regionschools/regionschools.types"; import { IRegionRecord, IRegionRecords, IRegionSchoolRecord } from "../../store/regionschools/regionschools.types";
import { ISectorRecords } from "../../store/sectorcourses/sectorcourses.types"; import { ISectorRecords } from "../../store/sectorcourses/sectorcourses.types";
import { ISectorFieldRecords } from "../../store/sectorfields/sectorfields.types"; import { ISectorFieldRecords } from "../../store/sectorfields/sectorfields.types";
import { IEpalClasses } from "../../store/epalclasses/epalclasses.types"; import { IEpalClassRecords } from "../../store/epalclasses/epalclasses.types";
import { STUDENT_DATA_FIELDS_INITIAL_STATE } from "../../store/studentdatafields/studentdatafields.initial-state"; import { STUDENT_DATA_FIELDS_INITIAL_STATE } from "../../store/studentdatafields/studentdatafields.initial-state";
import { REGION_SCHOOLS_INITIAL_STATE } from "../../store/regionschools/regionschools.initial-state"; import { REGION_SCHOOLS_INITIAL_STATE } from "../../store/regionschools/regionschools.initial-state";
import { EPALCLASSES_INITIAL_STATE } from "../../store/epalclasses/epalclasses.initial-state"; import { EPALCLASSES_INITIAL_STATE } from "../../store/epalclasses/epalclasses.initial-state";
...@@ -124,7 +124,7 @@ import { HelperDataService } from "../../services/helper-data-service"; ...@@ -124,7 +124,7 @@ import { HelperDataService } from "../../services/helper-data-service";
private classSelected; private classSelected;
private totalPoints = <number>0; private totalPoints = <number>0;
private studentDataFields$: BehaviorSubject<IStudentDataFieldRecords>; private studentDataFields$: BehaviorSubject<IStudentDataFieldRecords>;
private epalclasses$: BehaviorSubject<IEpalClasses>; private epalclasses$: BehaviorSubject<IEpalClassRecords>;
private loginInfo$: BehaviorSubject<ILoginInfo>; private loginInfo$: BehaviorSubject<ILoginInfo>;
private studentDataFieldsSub: Subscription; private studentDataFieldsSub: Subscription;
private regionsSub: Subscription; private regionsSub: Subscription;
...@@ -191,15 +191,14 @@ import { HelperDataService } from "../../services/helper-data-service"; ...@@ -191,15 +191,14 @@ import { HelperDataService } from "../../services/helper-data-service";
this.loginInfo$.next(linfo); this.loginInfo$.next(linfo);
}, error => { console.log("error selecting loginInfo"); }); }, error => { console.log("error selecting loginInfo"); });
this.epalclassesSub = this._ngRedux.select("epalclasses").subscribe(epalclasses => { this.epalclassesSub = this._ngRedux.select("epalclasses")
let ecs = <IEpalClasses>epalclasses; .map(epalClasses => <IEpalClassRecords>epalClasses)
.subscribe(ecs => {
console.log("SELECTOR4"); console.log("SELECTOR4");
if (ecs.size > 0) { ecs.reduce(({ }, epalclass) => {
ecs.reduce(({ }, epalclass) => { this.classSelected = epalclass.get("name");
this.classSelected = epalclass.name; return epalclass;
return epalclass; }, {});
}, {});
}
this.epalclasses$.next(ecs); this.epalclasses$.next(ecs);
}, error => { console.log("error selecting epalclasses"); }); }, error => { console.log("error selecting epalclasses"); });
......
...@@ -4,7 +4,7 @@ import { BehaviorSubject, Subscription } from "rxjs/Rx"; ...@@ -4,7 +4,7 @@ import { BehaviorSubject, Subscription } from "rxjs/Rx";
import { Injectable } from "@angular/core"; import { Injectable } from "@angular/core";
import { EpalClassesActions } from "../../actions/epalclass.actions"; import { EpalClassesActions } from "../../actions/epalclass.actions";
import { NgRedux, select } from "@angular-redux/store"; import { NgRedux, select } from "@angular-redux/store";
import { IEpalClasses } from "../../store/epalclasses/epalclasses.types"; import { IEpalClassRecords } from "../../store/epalclasses/epalclasses.types";
import { SectorFieldsActions } from "../../actions/sectorfields.actions"; import { SectorFieldsActions } from "../../actions/sectorfields.actions";
import { RegionSchoolsActions } from "../../actions/regionschools.actions"; import { RegionSchoolsActions } from "../../actions/regionschools.actions";
import { SectorCoursesActions } from "../../actions/sectorcourses.actions"; import { SectorCoursesActions } from "../../actions/sectorcourses.actions";
...@@ -77,7 +77,7 @@ import {AppSettings} from "../../app.settings"; ...@@ -77,7 +77,7 @@ import {AppSettings} from "../../app.settings";
}) })
@Injectable() export default class EpalClassesSelect implements OnInit, OnDestroy { @Injectable() export default class EpalClassesSelect implements OnInit, OnDestroy {
private epalclasses$: BehaviorSubject<IEpalClasses>; private epalclasses$: BehaviorSubject<IEpalClassRecords>;
private epalclassesSub: Subscription; private epalclassesSub: Subscription;
private formGroup: FormGroup; private formGroup: FormGroup;
...@@ -106,11 +106,11 @@ import {AppSettings} from "../../app.settings"; ...@@ -106,11 +106,11 @@ import {AppSettings} from "../../app.settings";
ngOnInit() { ngOnInit() {
(<any>$("#epalClassNotice")).appendTo("body"); (<any>$("#epalClassNotice")).appendTo("body");
this.epalclassesSub = this._ngRedux.select("epalclasses") this.epalclassesSub = this._ngRedux.select("epalclasses")
.subscribe(epalclasses => { .map(epalClasses => <IEpalClassRecords>epalClasses)
let ecs = <IEpalClasses>epalclasses; .subscribe(ecs => {
if (ecs.size > 0) { if (ecs.size > 0) {
ecs.reduce(({}, epalclass) => { ecs.reduce(({}, epalclass) => {
this.formGroup.setValue(epalclass); this.formGroup.controls["name"].setValue(epalclass.get("name"));
return epalclass; return epalclass;
}, {}); }, {});
} else { } else {
......
...@@ -9,7 +9,7 @@ import { REGION_SCHOOLS_INITIAL_STATE } from "../../store/regionschools/regionsc ...@@ -9,7 +9,7 @@ import { REGION_SCHOOLS_INITIAL_STATE } from "../../store/regionschools/regionsc
import { ISectorRecords } from "../../store/sectorcourses/sectorcourses.types"; import { ISectorRecords } from "../../store/sectorcourses/sectorcourses.types";
import { IAppState } from "../../store/store"; import { IAppState } from "../../store/store";
import { RemoveSpaces } from "../../pipes/removespaces"; import { RemoveSpaces } from "../../pipes/removespaces";
import { IEpalClasses } from "../../store/epalclasses/epalclasses.types"; import { IEpalClassRecords } from "../../store/epalclasses/epalclasses.types";
import { ISectorFieldRecords } from "../../store/sectorfields/sectorfields.types"; import { ISectorFieldRecords } from "../../store/sectorfields/sectorfields.types";
...@@ -190,16 +190,15 @@ import {AppSettings} from "../../app.settings"; ...@@ -190,16 +190,15 @@ import {AppSettings} from "../../app.settings";
selectEpalClasses() { selectEpalClasses() {
this.epalclassesSub = this._ngRedux.select("epalclasses") this.epalclassesSub = this._ngRedux.select("epalclasses")
.subscribe(epalclasses => { .map(epalClasses => <IEpalClassRecords>epalClasses)
console.log(epalclasses); .subscribe(ecs => {
let ecs = <IEpalClasses>epalclasses;
if (ecs.size > 0) { if (ecs.size > 0) {
ecs.reduce(({}, epalclass, i) => { ecs.reduce(({}, epalclass, i) => {
this.setClassActive(epalclass.name); this.setClassActive(epalclass.get("name"));
if (epalclass.name === "4") { if (epalclass.get("name") === "4") {
this.classNight.next(true); this.classNight.next(true);
} }
this.getAppropriateSchools(epalclass.name); this.getAppropriateSchools(epalclass.get("name"));
return epalclass; return epalclass;
}, {}); }, {});
} }
......
...@@ -98,7 +98,6 @@ import {AppSettings} from "../../app.settings"; ...@@ -98,7 +98,6 @@ import {AppSettings} from "../../app.settings";
private courseSelectedPrev = <number>-1; private courseSelectedPrev = <number>-1;
private idx = <number>-1; private idx = <number>-1;
private idxPrev = <number>-1; private idxPrev = <number>-1;
private sectorsList: Array<boolean> = new Array();
private modalTitle: BehaviorSubject<string>; private modalTitle: BehaviorSubject<string>;
private modalText: BehaviorSubject<string>; private modalText: BehaviorSubject<string>;
private modalHeader: BehaviorSubject<string>; private modalHeader: BehaviorSubject<string>;
...@@ -134,24 +133,18 @@ import {AppSettings} from "../../app.settings"; ...@@ -134,24 +133,18 @@ import {AppSettings} from "../../app.settings";
pushControls = true; pushControls = true;
scs.reduce((prevSector, sector) => { scs.reduce((prevSector, sector) => {
this.sectorsList[ids] = sector.get("sector_selected");
// In case we want to preserve last checked option when we revisit the form
if (sector.get("sector_selected") === true) if (sector.get("sector_selected") === true)
this.sectorActive = ids; this.sectorActive = ids;
sector.get("courses").reduce((prevCourse, course) => { sector.get("courses").reduce((prevCourse, course) => {
if (pushControls) if (pushControls)
this.scsControls.push(new FormControl(course.get("selected"), [])); this.scsControls.push(new FormControl(course.get("selected"), []));
// this.retrieveCheck();
if (course.get("selected") === true) { if (course.get("selected") === true) {
// In case we want to preserve last checked option when we revisit the form
this.sectorBelongingPrev = this.sectorBelonging; this.sectorBelongingPrev = this.sectorBelonging;
this.sectorBelonging = ids; this.sectorBelonging = ids;
this.courseSelectedPrev = this.courseSelected; this.courseSelectedPrev = this.courseSelected;
this.courseSelected = idc; this.courseSelected = idc;
this.idxPrev = this.idx; this.idxPrev = this.idx;
this.idx = course.get("globalIndex"); this.idx = course.get("globalIndex");
} }
idc++; idc++;
return course; return course;
...@@ -184,7 +177,6 @@ import {AppSettings} from "../../app.settings"; ...@@ -184,7 +177,6 @@ import {AppSettings} from "../../app.settings";
} }
setActiveSector(ind) { setActiveSector(ind) {
// this._sca.selectSector(this.sectorActive, ind);
this.sectorActive = ind; this.sectorActive = ind;
} }
...@@ -208,15 +200,14 @@ import {AppSettings} from "../../app.settings"; ...@@ -208,15 +200,14 @@ import {AppSettings} from "../../app.settings";
this.idxPrev = this.idx; this.idxPrev = this.idx;
this.idx = globalIndex; this.idx = globalIndex;
/* for (let i = 0; i < this.formGroup.value.formArray.length; i++)
this.formGroup.value.formArray[i] = false; */
if (this.idxPrev >= 0) if (this.idxPrev >= 0)
this.formGroup.value.formArray[this.idxPrev] = false; this.formGroup.value.formArray[this.idxPrev] = false;
if (this.idx >= 0) if (this.idx >= 0)
this.formGroup.value.formArray[globalIndex] = cb.checked; this.formGroup.value.formArray[globalIndex] = cb.checked;
this._sca.saveSectorCoursesSelected(this.sectorBelongingPrev, this.courseSelectedPrev, cb.checked, i, j); this._sca.saveSectorCoursesSelected(this.sectorBelongingPrev, this.courseSelectedPrev, cb.checked, i, j);
if (cb.checked === false) { if (cb.checked === false) {
this.idxPrev = -1; this.idxPrev = -1;
this.idx = -1; this.idx = -1;
...@@ -224,11 +215,6 @@ import {AppSettings} from "../../app.settings"; ...@@ -224,11 +215,6 @@ import {AppSettings} from "../../app.settings";
this._rsa.initRegionSchools(); this._rsa.initRegionSchools();
/* for (let i = 0; i < this.sectorsList.length; i++)
this.sectorsList[i] = false;
this.sectorsList[this.sectorActive] = true; */
// this.saveSelected();
} }
} }
...@@ -16,7 +16,6 @@ export const REGIONSCHOOLS_INIT = "REGIONSCHOOLS_INIT"; ...@@ -16,7 +16,6 @@ export const REGIONSCHOOLS_INIT = "REGIONSCHOOLS_INIT";
export const SECTORCOURSES_RECEIVED = "SECTORCOURSES_RECEIVED"; export const SECTORCOURSES_RECEIVED = "SECTORCOURSES_RECEIVED";
export const SECTORCOURSES_SELECTED_SAVE = "SECTORCOURSES_SELECTED_SAVE"; export const SECTORCOURSES_SELECTED_SAVE = "SECTORCOURSES_SELECTED_SAVE";
export const SECTORCOURSES_SECTOR_SELECTED_SAVE = "SECTORCOURSES_SECTOR_SELECTED_SAVE";
export const SECTORCOURSES_INIT = "SECTORCOURSES_INIT"; export const SECTORCOURSES_INIT = "SECTORCOURSES_INIT";
export const STUDENTDATAFIELDS_SAVE = "STUDENTDATAFIELDS_SAVE"; export const STUDENTDATAFIELDS_SAVE = "STUDENTDATAFIELDS_SAVE";
......
import { List } from "immutable"; import { List } from "immutable";
import { IEpalClass} from "./epalclasses.types"; import { IEpalClassRecord} from "./epalclasses.types";
export const EPALCLASSES_INITIAL_STATE = List<IEpalClass>(); export const EPALCLASSES_INITIAL_STATE = List<IEpalClassRecord>();
import { IEpalClasses, IEpalClass } from "./epalclasses.types"; import { IEpalClassRecords, IEpalClass, IEpalClassRecord } from "./epalclasses.types";
import { EPALCLASSES_INITIAL_STATE } from "./epalclasses.initial-state"; import { EPALCLASSES_INITIAL_STATE } from "./epalclasses.initial-state";
import { Seq } from "immutable"; import { List } from "immutable";
import {recordify} from "typed-immutable-record";
import { EPALCLASSES_SAVE, EPALCLASSES_INIT } from "../../constants"; import { EPALCLASSES_SAVE, EPALCLASSES_INIT } from "../../constants";
export function epalclassesReducer(state: IEpalClasses = EPALCLASSES_INITIAL_STATE, action): IEpalClasses { export function epalclassesReducer(state: IEpalClassRecords = EPALCLASSES_INITIAL_STATE, action): IEpalClassRecords {
switch (action.type) { switch (action.type) {
case EPALCLASSES_SAVE: case EPALCLASSES_SAVE:
let selectedEpalClasses = Array<IEpalClass>(); let newEpalClasses = Array<IEpalClassRecord>();
selectedEpalClasses.push(<IEpalClass>{ name: action.payload.epalClasses.name }); newEpalClasses.push(recordify<IEpalClass, IEpalClassRecord>({ name: action.payload.epalClasses.name }));
return Seq(selectedEpalClasses).map(n => n).toList(); return List(newEpalClasses);
case EPALCLASSES_INIT: case EPALCLASSES_INIT:
return EPALCLASSES_INITIAL_STATE; return EPALCLASSES_INITIAL_STATE;
default: return state; default: return state;
......
import { IEpalClasses, IEpalClass } from "./epalclasses.types"; import { IEpalClassRecords } from "./epalclasses.types";
export function deimmutifyEpalClasses(state: IEpalClasses): IEpalClass[] { export function deimmutifyEpalClasses(state: IEpalClassRecords): IEpalClassRecords {
let fetchedEpalClasses = new Array(); return state;
state.forEach(epalclass => {
fetchedEpalClasses.push(<IEpalClass>{ name: epalclass.name });
});
return fetchedEpalClasses;
}; };
import { List } from "immutable"; import { List } from "immutable";
import {TypedRecord} from "typed-immutable-record";
export interface IEpalClass { export interface IEpalClass {
// id: number;
name: string; name: string;
} }
export type IEpalClasses = List<IEpalClass>;
export interface IEpalClassRecord extends TypedRecord<IEpalClassRecord>, IEpalClass { };
export type IEpalClassRecords = List<IEpalClassRecord>;
import { IEpalClass, IEpalClasses } from "./epalclasses.types"; import { IEpalClass, IEpalClassRecords, IEpalClassRecord } from "./epalclasses.types";
import { epalclassesReducer } from "./epalclasses.reducer"; import { epalclassesReducer } from "./epalclasses.reducer";
import { deimmutifyEpalClasses } from "./epalclasses.transformers"; import { deimmutifyEpalClasses } from "./epalclasses.transformers";
export { export {
IEpalClass, IEpalClass,
IEpalClasses, IEpalClassRecords,
IEpalClassRecord,
epalclassesReducer, epalclassesReducer,
deimmutifyEpalClasses, deimmutifyEpalClasses,
}; };
...@@ -5,7 +5,7 @@ import { ISectorFieldRecord, ISectorFieldRecords } from "./sectorfields/sectorfi ...@@ -5,7 +5,7 @@ import { ISectorFieldRecord, ISectorFieldRecords } from "./sectorfields/sectorfi
import { IRRegion, IRRegionSchool, IRegionRecord, IRegionRecords, IRegionSchoolRecord, IRegionSchoolRecords } from "./regionschools/regionschools.types"; import { IRRegion, IRRegionSchool, IRegionRecord, IRegionRecords, IRegionSchoolRecord, IRegionSchoolRecords } from "./regionschools/regionschools.types";
import { ISectorRecords, ISectorRecord, ISector, ISectorCourseRecords, ISectorCourseRecord, ISectorCourse } from "./sectorcourses/sectorcourses.types"; import { ISectorRecords, ISectorRecord, ISector, ISectorCourseRecords, ISectorCourseRecord, ISectorCourse } from "./sectorcourses/sectorcourses.types";
import { IStudentDataFieldRecord, IStudentDataFieldRecords } from "./studentdatafields/studentdatafields.types"; import { IStudentDataFieldRecord, IStudentDataFieldRecords } from "./studentdatafields/studentdatafields.types";
import { IEpalClass, IEpalClasses } from "./epalclasses/epalclasses.types"; import { IEpalClass, IEpalClassRecord, IEpalClassRecords } from "./epalclasses/epalclasses.types";
import { ILoginInfoToken, ILoginInfo } from "./logininfo/logininfo.types"; import { ILoginInfoToken, ILoginInfo } from "./logininfo/logininfo.types";
export { export {
...@@ -28,7 +28,8 @@ ISectorCourse, ...@@ -28,7 +28,8 @@ ISectorCourse,
IStudentDataFieldRecord, IStudentDataFieldRecord,
IStudentDataFieldRecords, IStudentDataFieldRecords,
IEpalClass, IEpalClass,
IEpalClasses, IEpalClassRecord,
IEpalClassRecords,
ILoginInfo, ILoginInfo,
}; };
......
...@@ -5,7 +5,6 @@ import {recordify} from "typed-immutable-record"; ...@@ -5,7 +5,6 @@ import {recordify} from "typed-immutable-record";
import { import {
SECTORCOURSES_RECEIVED, SECTORCOURSES_RECEIVED,
SECTORCOURSES_SECTOR_SELECTED_SAVE,
SECTORCOURSES_SELECTED_SAVE, SECTORCOURSES_SELECTED_SAVE,
SECTORCOURSES_INIT SECTORCOURSES_INIT
} from "../../constants"; } from "../../constants";
...@@ -29,14 +28,6 @@ export function sectorCoursesReducer(state: ISectorRecords = SECTOR_COURSES_INIT ...@@ -29,14 +28,6 @@ export function sectorCoursesReducer(state: ISectorRecords = SECTOR_COURSES_INIT
}); });
return List(newSectors); return List(newSectors);
case SECTORCOURSES_SECTOR_SELECTED_SAVE:
return state.withMutations(function(list) {
if (action.payload.prevChoice >= 0)
list.setIn([action.payload.prevChoice, "sector_selected"], false);
if (action.payload.newChoice >= 0)
list.setIn([action.payload.newChoice, "sector_selected"], true);
});
case SECTORCOURSES_SELECTED_SAVE: case SECTORCOURSES_SELECTED_SAVE:
return state.withMutations(function(list) { return state.withMutations(function(list) {
list.setIn([action.payload.oldSIndex, "sector_selected"], false); list.setIn([action.payload.oldSIndex, "sector_selected"], false);
...@@ -45,19 +36,6 @@ export function sectorCoursesReducer(state: ISectorRecords = SECTOR_COURSES_INIT ...@@ -45,19 +36,6 @@ export function sectorCoursesReducer(state: ISectorRecords = SECTOR_COURSES_INIT
list.setIn([action.payload.sIndex, "courses"], list.get(action.payload.sIndex).get("courses").setIn([action.payload.cIndex, "selected"], action.payload.checked)); list.setIn([action.payload.sIndex, "courses"], list.get(action.payload.sIndex).get("courses").setIn([action.payload.cIndex, "selected"], action.payload.checked));
}); });
/* let sectorsWithSelections = Array<ISector>();
let ind = 0;
j = 0;
state.forEach(sector => {
sectorsWithSelections.push(<ISector>{ sector_id: sector.sector_id, sector_name: sector.sector_name, sector_selected: action.payload.sectorSelected[ind], courses: Array<ISectorCourse>() });
sector.courses.forEach(course => {
sectorsWithSelections[ind].courses.push(<ISectorCourse>{ course_id: course.course_id, course_name: course.course_name, globalIndex: course.globalIndex, selected: action.payload.sectorCoursesSelected[j] });
j++;
});
ind++;
});
return Seq(sectorsWithSelections).map(n => n).toList(); */
case SECTORCOURSES_INIT: case SECTORCOURSES_INIT:
return SECTOR_COURSES_INITIAL_STATE; return SECTOR_COURSES_INITIAL_STATE;
default: return state; default: return state;
......
...@@ -9,4 +9,3 @@ export interface ISectorField { ...@@ -9,4 +9,3 @@ export interface ISectorField {
export interface ISectorFieldRecord extends TypedRecord<ISectorFieldRecord>, ISectorField { }; export interface ISectorFieldRecord extends TypedRecord<ISectorFieldRecord>, ISectorField { };
export type ISectorFieldRecords = List<ISectorFieldRecord>; export type ISectorFieldRecords = List<ISectorFieldRecord>;
// export type ISectorFields = List<ISectorField>;
...@@ -11,7 +11,7 @@ export interface IAppState { ...@@ -11,7 +11,7 @@ export interface IAppState {
regions?: regions.IRegionRecords; regions?: regions.IRegionRecords;
sectors?: sectors.ISectorRecords; sectors?: sectors.ISectorRecords;
studentDataFields?: studentDataFields.IStudentDataFieldRecords; studentDataFields?: studentDataFields.IStudentDataFieldRecords;
epalclasses?: epalclasses.IEpalClasses; epalclasses?: epalclasses.IEpalClassRecords;
loginInfo?: loginInfo.ILoginInfo; loginInfo?: loginInfo.ILoginInfo;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment