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: 1b7a266fca197bb8333a1bfa72e2a36b2bdec447429a1e50e95b5b89dc31fb5f
4
- data.tar.gz: fd8ec6949e6fea5015fe33090ecf09a90e9815361d8e861fb42ac856e83ff111
3
+ metadata.gz: c4b18c6803bcea9323fe454de8293d219fca55d5fade1913dc31e01dadf16efd
4
+ data.tar.gz: 184638381c45f93db22d2bec40c8d2536c0722dd8ec54d7f3f508502ebe73514
5
5
  SHA512:
6
- metadata.gz: 29ed3030a1296a3fb95073255642e9bef489fea5d136291d8d6f8e71f5b2b6f8ab040034e56c5dc66e70d09451d1880290fedfbbc904ac105ec7dc58ae4810f8
7
- data.tar.gz: 7bc4e57bdac9abc5cf68be34bc64c48dbce81f6db405485e4dca1e6a8079e1d97e28630e159fb5049158a5d0f280fd000849b89e0cf6dfdc87f2a56bd4ae4e6b
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
- if cluster_entities.map(&:cluster_id).uniq.size != cluster_entities.size
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
@@ -1,3 +1,3 @@
1
1
  module Klastera
2
- VERSION = "1.5.5.3"
2
+ VERSION = "1.5.5.4"
3
3
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: klastera
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.5.3
4
+ version: 1.5.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gino Barahona