var foundRegTime = _.findWhere(foundClass.get('times'), { id: registrants[i].reg_time });
if ( foundRegTime ) {
foundRegTime.reg_event = foundClass.get('reg_event');
+
+ // Now add the time if needed
+ var hasRegTime = _.findWhere(foundClass, { reg_time: foundRegTime.id });
+ if ( !hasRegTime ) {
+ foundClass.regTimes.create( foundRegTime );
+ hasRegTime = foundClass.regTimes.findWhere({ id: foundRegTime.id });
+ hasRegTime.set({ parent: foundClass });
+ }
+ // Add the registrant
+ var nRegTime = foundClass.regTimes.findWhere({id: hasRegTime.get('id')});
+ nRegTime.registrants.create( registrants[i] );
}
- // Now add the time if needed
- var hasRegTime = _.findWhere(foundClass, { reg_time: foundRegTime.id });
- if ( !hasRegTime ) {
- foundClass.regTimes.create( foundRegTime );
- hasRegTime = foundClass.regTimes.findWhere({ id: foundRegTime.id });
- hasRegTime.set({ parent: foundClass });
- }
- // Add the registrant
- var nRegTime = foundClass.regTimes.findWhere({id: hasRegTime.get('id')});
- nRegTime.registrants.create( registrants[i] );
}
}
var foundRegTime = _.findWhere(foundClass.get('times'), { id: registrants[i].reg_time });
if ( foundRegTime ) {
foundRegTime.reg_event = foundClass.get('reg_event');
+
+ // Now add the time if needed
+ var hasRegTime = _.findWhere(foundClass, { reg_time: foundRegTime.id });
+ if ( !hasRegTime ) {
+ foundClass.regTimes.create( foundRegTime );
+ hasRegTime = foundClass.regTimes.findWhere({ id: foundRegTime.id });
+ hasRegTime.set({ parent: foundClass });
+ }
+ // Add the registrant
+ var nRegTime = foundClass.regTimes.findWhere({id: hasRegTime.get('id')});
+ nRegTime.registrants.create( registrants[i] );
}
- // Now add the time if needed
- var hasRegTime = _.findWhere(foundClass, { reg_time: foundRegTime.id });
- if ( !hasRegTime ) {
- foundClass.regTimes.create( foundRegTime );
- hasRegTime = foundClass.regTimes.findWhere({ id: foundRegTime.id });
- hasRegTime.set({ parent: foundClass });
- }
- // Add the registrant
- var nRegTime = foundClass.regTimes.findWhere({id: hasRegTime.get('id')});
- nRegTime.registrants.create( registrants[i] );
}
}