(user, originalArray)
| 15 | } |
| 16 | |
| 17 | export function deterministicShuffleForUserAndDay (user, originalArray) { |
| 18 | if (originalArray.length < 2) return originalArray |
| 19 | const rand = new RandomSeed(`${getDateString()}${user.id}`) |
| 20 | |
| 21 | let shuffledArray, array |
| 22 | do { |
| 23 | shuffledArray = [] |
| 24 | array = _.cloneDeep(originalArray) |
| 25 | while (array.length > 0) { |
| 26 | const element = rand.range(array.length) |
| 27 | |
| 28 | shuffledArray.push( |
| 29 | array.splice(element, 1)[0] |
| 30 | ) |
| 31 | } |
| 32 | } while (_.isEqual(shuffledArray, originalArray)) |
| 33 | |
| 34 | return shuffledArray |
| 35 | } |
| 36 | |
| 37 | export function getDisplayPermission (permission) { |
| 38 | const display = permission?.toLowerCase() |
nothing calls this directly
no test coverage detected