colonization 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 02d8e24b9f9e6eeb4e775c143eaa014089f816dd
|
4
|
+
data.tar.gz: 1476b843011250a4ff53766bdc976d10a5c6d535
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8ca96dcfd967a99b112d448e64e310efbc6a673dfad29588776b55b1d973be1ce816cd53b14e105535f6ab634509111ceae57f828e4d51b2c9ee70fd339bf6c
|
7
|
+
data.tar.gz: b3e1069366dd7e1378f6346ca70955859b5a7fff07167175222a5ce8744fb7f0520e1620c8dbd6f7d0e059b7bd463bc8b433f1fbd9f381ee3ddc61db5442284f
|
@@ -4,8 +4,8 @@ class Colonization::ModelInstancesRepository
|
|
4
4
|
model.all.sample
|
5
5
|
end
|
6
6
|
|
7
|
-
def get_instance_without_relation(model: ,relation:)
|
8
|
-
model.where("#{relation.name.downcase}" => nil).all.sample
|
7
|
+
def get_instance_without_relation(model: ,relation:, limit:)
|
8
|
+
model.where("#{relation.name.downcase}" => nil).limit(limit).all.sample
|
9
9
|
end
|
10
10
|
|
11
11
|
end
|
@@ -44,7 +44,7 @@ class Colonization::ModelRelation < Colonization::ModelEntity
|
|
44
44
|
def generate_relation_value_with_default_strategy
|
45
45
|
seed_index = strategy[:seed_index] || DEAFULT_SEED_INDEX
|
46
46
|
|
47
|
-
found_instances = Colonization::ModelInstancesRepository.new.get_instance_without_relation(model: reflection_class, relation: reflection_owner)
|
47
|
+
found_instances = Colonization::ModelInstancesRepository.new.get_instance_without_relation(model: reflection_class, relation: reflection_owner, limit: seed_index)
|
48
48
|
result_instances = Colonization::Colonizer.new(reflection_class).colonize(seed_index - (found_instances ? found_instances.count : 0))
|
49
49
|
result_instances
|
50
50
|
end
|
data/lib/colonization/version.rb
CHANGED