aboutsummaryrefslogtreecommitdiff
path: root/doc/import
diff options
context:
space:
mode:
authorhellekin <hellekin@cepheide.org>2021-01-23 15:43:36 +0100
committerhellekin <hellekin@cepheide.org>2021-01-23 15:43:36 +0100
commiteff656fdaf55a9c19ec54dbb9000039428952026 (patch)
treea88c2cd54c525aa304ab1bca4b443c712de1c668 /doc/import
parent84dc56483203e13eafe69962ec6bc0c28c47aca7 (diff)
downloadincommon-map-eff656fdaf55a9c19ec54dbb9000039428952026.tar.gz
Document extra steps to cleanup imported data
Diffstat (limited to 'doc/import')
-rw-r--r--doc/import/README.md19
1 files changed, 19 insertions, 0 deletions
diff --git a/doc/import/README.md b/doc/import/README.md
index 92108a3..50ef74b 100644
--- a/doc/import/README.md
+++ b/doc/import/README.md
@@ -66,3 +66,22 @@ end
```
It's taken into account in `rails db:seed`
+
+
+### Cleaning up records
+
+Some records need cleanup...
+
+#### Category names
+
+Remove prepended numbers from names:
+`Category.all.each { |c| c.update(name: c.name.sub(/^\d. /,'')) if c.name =~ /^\d/ }`
+
+#### Category colors
+
+Match category rank with style color:
+```ruby
+cat_colors = ['#BCBCBC', '#95a5a6', '#848482', '#948279', '#59706a', '#16a085', '#27ae60', '#2980b9', '#34495e', '#bd3525', '#d35400', '#eead0e']
+
+Category.all.each { |c| c.update!(color: cat_colors.shift) }
+```