From c480cb8f307c0c7ad9713c27411a649d265eb088 Mon Sep 17 00:00:00 2001
From: Arnaud Levy <contact@arnaudlevy.com>
Date: Wed, 5 Jan 2022 17:40:49 +0100
Subject: [PATCH] fix

---
 app/models/communication/website/git_file.rb | 13 +++++++++++--
 app/models/education/school.rb               | 12 ------------
 2 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/app/models/communication/website/git_file.rb b/app/models/communication/website/git_file.rb
index 83607a85d..99993d0e5 100644
--- a/app/models/communication/website/git_file.rb
+++ b/app/models/communication/website/git_file.rb
@@ -38,11 +38,20 @@ class Communication::Website::GitFile < ApplicationRecord
   end
 
   def should_create?
-    !synchronized_with_git? || previous_path.nil? || previous_sha.nil?
+    !should_destroy? &&
+    (
+      !synchronized_with_git? ||
+      previous_path.nil? ||
+      previous_sha.nil?
+    )
   end
 
   def should_update?
-    !path.nil? && (previous_path != path || previous_sha != sha)
+    !should_destroy? &&
+    (
+      previous_path != path ||
+      previous_sha != sha
+    )
   end
 
   def should_destroy?
diff --git a/app/models/education/school.rb b/app/models/education/school.rb
index 84660f756..9dfad4268 100644
--- a/app/models/education/school.rb
+++ b/app/models/education/school.rb
@@ -46,16 +46,4 @@ class Education::School < ApplicationRecord
   def git_path_static
     "data/school.yml"
   end
-
-  def to_static(github_file)
-    {
-      name: name,
-      address: address,
-      zipcode: zipcode,
-      city: city,
-      country: ISO3166::Country[country].translations[country.downcase],
-      phone: phone
-    }.deep_stringify_keys.to_yaml.lines[1..-1].join
-  end
-
 end
-- 
GitLab