File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ class EventsFactory extends Factory {
100100
101101 const cursor = this . getCollection ( this . TYPES . EVENTS )
102102 . find ( query )
103- . sort ( [ [ '_id' , - 1 ] ] )
103+ . sort ( [ [ '_id' , - 1 ] ] )
104104 . limit ( limit )
105105 . skip ( skip ) ;
106106
@@ -159,7 +159,18 @@ class EventsFactory extends Factory {
159159 filters = { }
160160 ) {
161161 limit = this . validateLimit ( limit ) ;
162- sort = sort === 'BY_COUNT' ? 'count' : 'lastRepetitionTime' ;
162+
163+ switch ( sort ) {
164+ case 'BY_COUNT' :
165+ sort = 'count' ;
166+ break ;
167+ case 'BY_DATE' :
168+ sort = 'lastRepetitionTime' ;
169+ break ;
170+ case 'BY_AFFECTED_USERS' :
171+ sort = 'affectedUsers' ;
172+ break ;
173+ }
163174
164175 const pipeline = [
165176 {
@@ -197,7 +208,7 @@ class EventsFactory extends Factory {
197208 ...Object . fromEntries (
198209 Object
199210 . entries ( filters )
200- . map ( ( [ mark , exists ] ) => [ `event.marks.${ mark } ` , { $exists : exists } ] )
211+ . map ( ( [ mark , exists ] ) => [ `event.marks.${ mark } ` , { $exists : exists } ] )
201212 ) ,
202213 } ,
203214 } ,
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ Possible events order
88enum EventsSortOrder {
99 BY_DATE
1010 BY_COUNT
11+ BY_AFFECTED_USERS
1112}
1213
1314"""
You can’t perform that action at this time.
0 commit comments