* only fetch bookings of this month for weighted rr
* test set up
* only get bookings of current month
* reverts test setup
* first changes for weight adjustments
* reset booking count + adjust calibration
* depreciate weightAdjustment
* get only bookings created this month
* fix typo
* make sure createdAt for hosts is correct
* use earliest possibel date as fallback
* add missing createdAt date to tests
* fix typo
* clean up changes in tests
* fix typo
* change end date to current date
* fix: Fall back to empty host array when no hosts are found
* fix: Restructure code a little
* fixed test, incorrectly used now outdated var
* perf: remove Dayjs from getLuckyUser
* Refactor getHostsWithCalibration for optimised performance, intentionally break test as findMany is always an array
* Better mock for host.findMany
* Remove team-event-types.test.ts, move to appropriate package
* TypeScript cannot auto-infer that an array is non-empty when assigning to a var
* fix: Type Fixes and DistributionMethod enum add
* Optimise tests
* Added test to show that bookings made before a newHost was added affect the lucky user result
* Throw error when the usersWithHighestPriority is empty, which should never happen
---------
Co-authored-by: CarinaWolli <wollencarina@gmail.com>
Co-authored-by: Alex van Andel <me@alexvanandel.com>
* add feature to change host schedule
* update for type-check:ci
* Update SingleForm.tsx for linterr
* update as per design review
* update for rerendering
* migration files
* On Delete set null for schedule
if schedule is deleted, no need to delete the host
* updated schema
* added testcases
* checking permissions before
* updated for comments
* update for initial value
* updated and cleanup
* set initial value
* update after merge
* updated nit style
* update for console warning and added comments
* nit/chore
* chore
* update for typechecks
* update for scheduleId param after merge
* update after merge or new changes in metadata.config
* update after weights functionality
* updated description text and column name as per review suggestion
* resolved merge conflicts
* fix typecheck due to changes in getScheduleSchema
* update after merge having refactor
* update refactored EventTypeWebWrapper after merge
* updated props
* updated trpc err code and added log
* update due to refactor in EventAvailabilityTab
* perf: Optimise TS type + select only the data that's needed for a specific function
---------
Co-authored-by: Amit Sharma <74371312+Amit91848@users.noreply.github.com>
Co-authored-by: Syed Ali Shahbaz <52925846+alishaz-polymath@users.noreply.github.com>
Co-authored-by: Alex van Andel <me@alexvanandel.com>
* WIP
* add frontend
* backend to update weight
* UI improvements
* WIP weight algorithm
* enable weights switch + algorithm improvements
* fix weightDescription
* clean up code
* remove OOOEntryHost from schema.prisma
* implement logic (not yet tested)
* add tests for weight algorithm
* add test with weight adjustment
* finish unit tests
* fix type error
* fix type error
* add migration
* fix type error
* fix event type update handler
* fix failing test
* UI fixes for saving hosts
* make sure weightAdjustment is not lost on host changes
* fix weightadjustment for new hosts
* add weightAdjustment to availableUsers
* fix type errors
* fix default value for weight
* make weight and weightAdjustment optional
* fix type errors from schema changes
* type fix
* clean up code
* improve comments
* remove comment
* clean up code
* add tests & weight adjustment improvments
* better variable naming
* fixes for weight adjustments
* make weightAdjustments proportional to weights
* fix previous host weight adjustments
* improved tests for weight adjustments
* save weight and priority + sort hosts correctly
* fix type error
* code clean up
* remove console.log
* use BookingRepository to fetch bookings of users
* use BookingRepository to fetch bookings in getLuckyUser
* fix type errors
* fix weightAdjustment if changed from fixed to rr host
* disable weights when 'assign all' is enabled
* typo
* allow 0 weight
* set min (and max) for weight and priority
* use useWatch
* code clean up
* fix type error
* only count accepted bookings for RR
* fix type error
* improve data fetching of bookings
* only filter bookings of availableUsers
* code clean up form feedback
* fix tests
* don't count no show bookings
* code clean up
* choose user with highest weight
* use one reduce instead of two
* use reduce instead of filter and map
* don't show weights toggle when 'assign all' is enabled
* design fixes
* fix type errors
* fix: type check
* Update packages/features/eventtypes/components/AddMembersWithSwitch.tsx
---------
Co-authored-by: CarinaWolli <wollencarina@gmail.com>
Co-authored-by: Alex van Andel <me@alexvanandel.com>
* removed reduntand check on assignedusers
* update for managed eventtype
* formatted
* comments
* Updated comments
* extracted checkForEmptyAssignment and added tests
* updated comments
* updated to show dialog also when not yet saved
* update translations
* updated comments
* updated translation
* updated types
* chore: update naming and comments
* Delete apps/web/lib/checkForEmptyAssignment.ts
deleted since file was renamed
* Delete apps/web/test/lib/checkForEmptyAssignment.test.ts
deleted as the file is renamed to be more descriptive
* update to do teamcheck before
* chore: revert name to CheckForEmptyAssignment
* updated check conditions
* updated useEffect dependencies
---------
Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com>