From eff656fdaf55a9c19ec54dbb9000039428952026 Mon Sep 17 00:00:00 2001 From: hellekin Date: Sat, 23 Jan 2021 15:43:36 +0100 Subject: Document extra steps to cleanup imported data --- doc/import/README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'doc/import') 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) } +``` -- cgit v1.2.3