I have an entity Dancers that has a lookup to entity Level. The level is determined based on the hours that the dancer dances per week. Currently there are 4 levels (Level 1, Level 2, Level 3, Level 4)
I also have an entity called Routine. Once the user adds dancers from the Dancers table (N:N) to this routine, the field 'Routine Level' (also a lookup to the Levels entity) must be calculated based on the majority level of the related dancers.
I'm looking to get some guidance on how I might go about calculating the majority and then setting that Routine Level Lookup using Javascript.