@@ -113,74 +113,74 @@ export function createRotation(
113
113
monthArrayInfo [ i ] [ j ] . arr [ arrIndex ++ ] = participant1 . userId ;
114
114
}
115
115
116
- shuffle ( rotationAttendeeInfo ) ;
117
- sortByArray ( rotationAttendeeInfo ) ;
118
-
119
- let participant2 = undefined ;
120
- for ( let k = 0 ; k < rotationAttendeeInfo . length ; k ++ ) {
121
- if (
122
- rotationAttendeeInfo [ k ] . attended < participation &&
123
- ! rotationAttendeeInfo [ k ] . attendLimit . includes (
124
- monthArrayInfo [ i ] [ j ] . day ,
125
- ) &&
126
- ! monthArrayInfo [ i ] [ j ] . arr . includes ( rotationAttendeeInfo [ k ] . userId )
127
- ) {
128
- participant2 = rotationAttendeeInfo [ k ] ;
129
- participant2 . attended += 1 ;
130
- break ;
131
- }
132
- }
133
- if ( canDuplicate && participant2 === undefined ) {
134
- for ( let k = 0 ; k < rotationAttendeeInfo . length ; k ++ ) {
135
- if (
136
- rotationAttendeeInfo [ k ] . attended < participation + 1 &&
137
- ! rotationAttendeeInfo [ k ] . attendLimit . includes (
138
- monthArrayInfo [ i ] [ j ] . day ,
139
- ) &&
140
- ! monthArrayInfo [ i ] [ j ] . arr . includes ( rotationAttendeeInfo [ k ] . userId )
141
- ) {
142
- participant2 = rotationAttendeeInfo [ k ] ;
143
- participant2 . attended += 1 ;
144
- break ;
145
- }
146
- }
147
- }
148
- if ( participant2 === undefined ) {
149
- participation += 1 ;
150
- if ( j > 0 ) {
151
- j -= 1 ;
152
- } else {
153
- j = - 1 ;
154
- }
155
- if ( participant1 && isLooped === false ) {
156
- if ( isLoopedAgain === true ) {
157
- participation -= 1 ;
158
- isLoopedAgain = false ;
159
- continue ;
160
- }
161
- const index = rotationAttendeeInfo . findIndex (
162
- ( obj ) => obj . userId === participant1 . userId ,
163
- ) ;
164
- continueIndex = index ;
165
- checkContinue = true ;
166
- isLooped = true ;
167
- isLoopedAgain = true ;
168
- participant1 . attended -= 1 ;
169
- monthArrayInfo [ i ] [ j + 1 ] . arr [ 0 ] = 0 ;
170
- } else if ( isLooped ) {
171
- participation -= 1 ;
172
- isLooped = false ;
173
- isLoopedAgain = false ;
174
- j += 1 ;
175
- }
176
- continue ;
177
- } else {
178
- continueIndex = 0 ;
179
- checkContinue = false ;
180
- isLooped = false ;
181
- isLoopedAgain = false ;
182
- monthArrayInfo [ i ] [ j ] . arr [ arrIndex -- ] = participant2 . userId ;
183
- }
116
+ // shuffle(rotationAttendeeInfo);
117
+ // sortByArray(rotationAttendeeInfo);
118
+ //
119
+ // let participant2 = undefined;
120
+ // for (let k = 0; k < rotationAttendeeInfo.length; k++) {
121
+ // if (
122
+ // rotationAttendeeInfo[k].attended < participation &&
123
+ // !rotationAttendeeInfo[k].attendLimit.includes(
124
+ // monthArrayInfo[i][j].day,
125
+ // ) &&
126
+ // !monthArrayInfo[i][j].arr.includes(rotationAttendeeInfo[k].userId)
127
+ // ) {
128
+ // participant2 = rotationAttendeeInfo[k];
129
+ // participant2.attended += 1;
130
+ // break;
131
+ // }
132
+ // }
133
+ // if (canDuplicate && participant2 === undefined) {
134
+ // for (let k = 0; k < rotationAttendeeInfo.length; k++) {
135
+ // if (
136
+ // rotationAttendeeInfo[k].attended < participation + 1 &&
137
+ // !rotationAttendeeInfo[k].attendLimit.includes(
138
+ // monthArrayInfo[i][j].day,
139
+ // ) &&
140
+ // !monthArrayInfo[i][j].arr.includes(rotationAttendeeInfo[k].userId)
141
+ // ) {
142
+ // participant2 = rotationAttendeeInfo[k];
143
+ // participant2.attended += 1;
144
+ // break;
145
+ // }
146
+ // }
147
+ // }
148
+ // if (participant2 === undefined) {
149
+ // participation += 1;
150
+ // if (j > 0) {
151
+ // j -= 1;
152
+ // } else {
153
+ // j = -1;
154
+ // }
155
+ // if (participant1 && isLooped === false) {
156
+ // if (isLoopedAgain === true) {
157
+ // participation -= 1;
158
+ // isLoopedAgain = false;
159
+ // continue;
160
+ // }
161
+ // const index = rotationAttendeeInfo.findIndex(
162
+ // (obj) => obj.userId === participant1.userId,
163
+ // );
164
+ // continueIndex = index;
165
+ // checkContinue = true;
166
+ // isLooped = true;
167
+ // isLoopedAgain = true;
168
+ // participant1.attended -= 1;
169
+ // monthArrayInfo[i][j + 1].arr[0] = 0;
170
+ // } else if (isLooped) {
171
+ // participation -= 1;
172
+ // isLooped = false;
173
+ // isLoopedAgain = false;
174
+ // j += 1;
175
+ // }
176
+ // continue;
177
+ // } else {
178
+ // continueIndex = 0;
179
+ // checkContinue = false;
180
+ // isLooped = false;
181
+ // isLoopedAgain = false;
182
+ // monthArrayInfo[i][j].arr[arrIndex--] = participant2.userId;
183
+ // }
184
184
}
185
185
}
186
186
0 commit comments