klastera 1.5.5.3 → 1.5.5.4
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
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c4b18c6803bcea9323fe454de8293d219fca55d5fade1913dc31e01dadf16efd
|
|
4
|
+
data.tar.gz: 184638381c45f93db22d2bec40c8d2536c0722dd8ec54d7f3f508502ebe73514
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 27bd431138c5c6f17f296e2e49a3aaff2846011aca1feb53e500f1eba5e60c0b98f1b69dfc0f9fad9b8c886069882744152fc3b89a4a14951dd21f87a2f3d2c6
|
|
7
|
+
data.tar.gz: d64254e8c67a7b54d49179f58721547ead68bd363dd4cd6174addd2a13957a21b795da9118289df8f9a228807388d4da8ab6e3639a00447dd3f04cb57e379f08
|
|
@@ -62,8 +62,11 @@ module Klastera::Concerns::Clusterizable
|
|
|
62
62
|
end
|
|
63
63
|
end
|
|
64
64
|
|
|
65
|
+
# No cuenta las filas marcadas para destruir: quitar una zona con el basurero y volver a agregar
|
|
66
|
+
# la misma en el mismo guardado deja una sola fila al final, y no es un duplicado.
|
|
65
67
|
def uniqueness_of_cluster_entity_record
|
|
66
|
-
|
|
68
|
+
vigentes = cluster_entities.reject(&:marked_for_destruction?)
|
|
69
|
+
if vigentes.map(&:cluster_id).uniq.size != vigentes.size
|
|
67
70
|
return errors.add(:cluster_entities, I18n.t('klastera.messages.duplicated_cluster_entity') )
|
|
68
71
|
end
|
|
69
72
|
end
|
data/lib/klastera/version.rb
CHANGED
|
@@ -60,5 +60,22 @@ module Klastera
|
|
|
60
60
|
entity.valid?
|
|
61
61
|
assert entity.errors[:cluster_entities].any?
|
|
62
62
|
end
|
|
63
|
+
|
|
64
|
+
test "acepta quitar una zona y volver a agregar la misma en el mismo guardado" do
|
|
65
|
+
entity, ce, cluster = build_entity_with_cluster
|
|
66
|
+
entity.assign_attributes(cluster_entities_attributes: {
|
|
67
|
+
"0" => { "id" => ce.id, "_destroy" => "1" },
|
|
68
|
+
"1" => { "cluster_id" => cluster.id.to_s, "_destroy" => "false" }
|
|
69
|
+
})
|
|
70
|
+
entity.valid?
|
|
71
|
+
assert_not entity.errors[:cluster_entities].any? { |m| m == I18n.t('klastera.messages.duplicated_cluster_entity') }
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
test "sigue rechazando la misma zona dos veces vigente" do
|
|
75
|
+
entity, _ce, cluster = build_entity_with_cluster
|
|
76
|
+
entity.assign_attributes(cluster_entities_attributes: { "1" => { "cluster_id" => cluster.id.to_s, "_destroy" => "false" } })
|
|
77
|
+
entity.valid?
|
|
78
|
+
assert entity.errors[:cluster_entities].any?
|
|
79
|
+
end
|
|
63
80
|
end
|
|
64
81
|
end
|