Activity
Lets say i have a form where a user can select something.
Is it also possible to use this method to render than depending on the selection different templates of a child form ?
Posted in Gem for making user groups
Well u can use Devise and Pundit to handle Usergroups.
Iam not using Jumpstart and if i try to even get the members in console i get an error:
NoMethodError (undefined method `redis_connection_for_subscriptions' for #ActionCable::SubscriptionAdapter::Async:0x00007f8bc0a80ba8)
has anyone an idea why ? or how to fix
Posted in Ruby combinations with ruleset ?
Hey iam trying to figure out how i could limit my combinations of objects.
My problem:
I want to generate x teams with the most "point" outcome of 432 players, max team size is 7 players. Each player has an "position" attribute, every team must have each position one time and max 3 times. Also an player has an "worth" attribute. Each team cant be more worth than 70. Every player can only be one time in an team.
Data example:
{ name: 'James Harden', position: 'PG', weight: 15.9, points: 62.63 },
{ name: 'Russell Westbrook', position: 'PG', weight: 14.9, points: 56.12 },
{ name: 'LeBron James', position: 'SF', weight: 15.9, points: 55.67 },
{ name: 'Bradley Beal', position: 'SG', weight: 14.8, points: 52.69 },
{ name: 'Anthony Davis', position: 'PF', weight: 14.6, points: 52.16 },
{ name: 'Damian Lillard', position: 'PG', weight: 13.5, points: 49.34 },
{ name: 'Nikola Vucevic', position: 'C', weight: 12.9, points: 47.97 },
{ name: 'Domantas Sabonis', position: 'PF', weight: 12.8, points: 47.6 }
My try:
Well i tried to use the combination method from ruby:
b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]
print b.combination(7).to_a
that take 52 minutes for my laptop so solve all combinations. so i search for a way to do it faster an to apply more options like mentioned above to limit the result of teams.
Later if i find an solution i want to build this thing into an rails app with picture of the players and so on. Hopefully someone can give me an hint or has done something similar to give advices.