| 300 | } |
| 301 | |
| 302 | campaigns.sort((left, right) => { |
| 303 | const rank = (status) => { |
| 304 | if (status === 'active') return 0; |
| 305 | if (status === 'needs-review-package') return 1; |
| 306 | if (status === 'needs-completion') return 1; |
| 307 | if (status === 'needs-archive') return 1; |
| 308 | if (status.includes('approval') || status.includes('pending') || status === 'needs-continue') return 1; |
| 309 | if (status === 'parked' || status === 'paused') return 2; |
| 310 | return 3; |
| 311 | }; |
| 312 | return rank(left.status) - rank(right.status) || |
| 313 | new Date(right.modifiedAt).getTime() - new Date(left.modifiedAt).getTime(); |