From 4d48978b22a04e0f8c17f3ba3365c9348de5e42d Mon Sep 17 00:00:00 2001 From: Tim Waters Date: Thu, 23 Jul 2015 14:46:28 +0100 Subject: [PATCH] Fix for bug where inset maps were getting the same status as the original map and causing errors with the layers --- app/models/map.rb | 4 ++++ test/models/map.rb | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/app/models/map.rb b/app/models/map.rb index 4c932009..f9065615 100644 --- a/app/models/map.rb +++ b/app/models/map.rb @@ -764,6 +764,10 @@ def create_inset inset_map.filename = File.join(maps_dir, unique_id) + ".tif" FileUtils.copy(self.filename, inset_map.filename) + inset_map.status = :available + inset_map.mask_status = :unmasked + inset_map.rectified_at = nil + inset_map.layers = self.layers inset_map.uuid = unique_id diff --git a/test/models/map.rb b/test/models/map.rb index cfb586e9..98386b93 100644 --- a/test/models/map.rb +++ b/test/models/map.rb @@ -55,4 +55,17 @@ def teardown assert_nil @inset_map.create_inset end + test "should not copy the status to an inset map" do + assert_not_equal @map.status, @inset_map.status + end + + test "an inset map should be unmasked" do + assert_equal :unmasked, @inset_map.mask_status + end + + test "an inset map should be unrectified" do + assert_equal :available, @inset_map.status + assert_nil @inset_map.rectified_at + end + end \ No newline at end of file