private void generateShiftForTimeslot()

in use-cases/employee-scheduling/src/main/java/org/acme/employeescheduling/bootstrap/DemoDataGenerator.java [137:155]


    private void generateShiftForTimeslot(LocalDateTime timeslotStart, LocalDateTime timeslotEnd, String location,
                                          Random random) {
        int shiftCount = 1;

        if (random.nextDouble() > 0.9) {
            // generate an extra shift
            shiftCount++;
        }

        for (int i = 0; i < shiftCount; i++) {
            String requiredSkill;
            if (random.nextBoolean()) {
                requiredSkill = pickRandom(REQUIRED_SKILLS, random);
            } else {
                requiredSkill = pickRandom(OPTIONAL_SKILLS, random);
            }
            shiftRepository.persist(new Shift(timeslotStart, timeslotEnd, location, requiredSkill));
        }
    }