11import { Op } from "sequelize" ;
22import {
3- PositionTitle ,
43 ReviewDashboardRowDTO ,
54 ReviewedApplicantRecordDTO ,
6- EngineeringPositionTitles ,
7- DesignPositionTitles ,
8- ProductPositionTitles ,
9- CommunityPositionTitles ,
105 CreateReviewedApplicantRecordDTO ,
116 ReviewDashboardSidePanelDTO ,
127} from "../../types" ;
@@ -167,7 +162,7 @@ class ReviewDashboardService implements IReviewDashboardService {
167162 const groups = (
168163 await User . findAll ( {
169164 attributes : { exclude : [ "createdAt" , "updatedAt" ] } ,
170- where : { position : { [ Op . ne ] : null } } ,
165+ where : { position : { [ Op . in ] : positions } } ,
171166 } )
172167 ) . reduce ( ( map , user ) => {
173168 // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -181,12 +176,7 @@ class ReviewDashboardService implements IReviewDashboardService {
181176 // Build FSM
182177 // maps (position title) => (current index of list, list of users with position_title)
183178 const FSM = new Map < string , [ number , ( number | undefined ) [ ] ] > (
184- [
185- ...EngineeringPositionTitles ,
186- ...DesignPositionTitles ,
187- ...ProductPositionTitles ,
188- ...CommunityPositionTitles ,
189- ] . map ( ( title ) => [ title , [ 0 , groups . get ( title ) ?? [ ] ] ] ) ,
179+ positions . map ( ( title ) => [ title , [ 0 , groups . get ( title ) ?? [ ] ] ] ) ,
190180 ) ;
191181
192182 // Validate FSM for correctness
@@ -222,6 +212,7 @@ class ReviewDashboardService implements IReviewDashboardService {
222212 */
223213 const applicantRecords = await ApplicantRecord . findAll ( {
224214 attributes : { exclude : [ "createdAt" , "updatedAt" ] } ,
215+ where : { position : { [ Op . in ] : positions } } ,
225216 } ) ;
226217 applicantRecords . forEach ( ( record ) => {
227218 /* eslint-disable @typescript-eslint/no-non-null-assertion */
@@ -253,7 +244,6 @@ class ReviewDashboardService implements IReviewDashboardService {
253244 // STEP 3:
254245 // Batch the delegations into ReviewedApplicantRecords
255246 // NOTE: do not add the sentinel value we inserted earlier.
256- console . log ( delegations ) ;
257247 return reviewedApplicantRecordService . bulkCreateReviewedApplicantRecord (
258248 delegations ,
259249 ) ;
0 commit comments