Conditions | 3 |
Total Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | # frozen_string_literal: true |
||
31 | def current_room_exceeds_limit(room) |
||
32 | # Get how many rooms need to be deleted to reach allowed room number |
||
33 | limit = @settings.get_value("Room Limit").to_i |
||
34 | |||
35 | return false if current_user&.has_role?(:admin) || limit == 15 |
||
36 | |||
37 | @diff = current_user.rooms.count - limit |
||
38 | @diff.positive? && current_user.rooms.pluck(:id).index(room.id) + 1 > limit |
||
39 | end |
||
40 | end |
||
41 |