From f92ad9bb8fec1d7cfcaf5e71692b3b7db7787e47 Mon Sep 17 00:00:00 2001 From: Gabriela Navarro Date: Thu, 9 Jul 2015 12:50:46 +0000 Subject: [PATCH] Finally fixing the last problems of the script --- date-communities.txt | 16 ++++++++-------- update.rb | 36 +++++++++++++++++++++++------------- 2 files changed, 31 insertions(+), 21 deletions(-) diff --git a/date-communities.txt b/date-communities.txt index afbe92c..1f8ccbb 100644 --- a/date-communities.txt +++ b/date-communities.txt @@ -20,15 +20,15 @@ 31042 | 2007-03-12 09:47:54.97039-03 | e-Proinfo 23731755 | 2010-08-24 12:17:02.069138-03 | ERP5 BR 126403824 | 2014-12-08 10:28:11.812721-02 | e-Sic Livre - 11809545 | 2009-06-17 09:19:30.697619-03 | Fila - Sistema de Atendimento + 11809545 | 2009-06-17 09:19:30.697619-03 | Fila 44509627 | 2011-11-30 16:11:20.487561-02 | FormDin 30726269 | 2011-03-25 18:15:38.333798-03 | Geosan 20483099 | 2010-04-16 14:53:04.201919-03 | Geplanes 33752093 | 2011-05-25 13:08:28.449124-03 | GGAS 1101545 | 2007-06-18 15:31:22.060335-03 | Ginga - 30724784 | 2011-03-25 17:44:11.373481-03 | Gnuteca - Gestão de Bibliotecas + 30724784 | 2011-03-25 17:44:11.373481-03 | Gnuteca 31574974 | 2011-04-15 15:57:57.260004-03 | gpweb - 1593449 | 2007-08-30 16:51:38.073906-03 | GSAN + 1593449 | 2007-08-30 16:51:38.073906-03 | Gsan - Sistema Integrado de Gestão de Serviços de Saneamento 66594611 | 2013-04-23 15:06:59.865025-03 | Guarux 1444332 | 2007-08-07 08:15:42.941934-03 | i3GEO 6552490 | 2008-09-29 13:26:07.553951-03 | i-Educar @@ -36,7 +36,7 @@ 25913900 | 2010-11-09 15:33:43.132943-02 | Jaguar 18068594 | 2010-01-06 16:28:29.99099-02 | Koruja 601158 | 2007-05-03 14:49:32.350206-03 | KyaPanel - 3673574 | 2008-04-09 15:18:24.118203-03 | LightBase - Banco de Dados Textual Multimídia e Soluções de GED. + 3673574 | 2008-04-09 15:18:24.118203-03 | LightBase 11809207 | 2009-06-17 09:18:46.708981-03 | Linux Educacional 9022831 | 2009-02-04 15:21:13.18503-02 | MDArte 11808514 | 2009-06-17 09:10:36.619105-03 | Minuano @@ -52,14 +52,14 @@ 3695494 | 2008-04-11 10:38:11.361528-03 | Sagui 15719494 | 2009-10-20 10:38:37.237684-02 | SGA LIVRE - Sistema de Gerenciamento do Atendimento 63022108 | 2013-01-30 11:22:50.327218-02 | SGDoc - 51261 | 2007-03-23 15:10:36.399602-03 | SGD - Sistema de Gestão de Demandas + 51261 | 2007-03-23 15:10:36.399602-03 | SGD – Sistema de Gestão de Demandas 23369799 | 2010-08-13 14:04:43.562233-03 | SGF - Sistema de Gestão de Frotas 93658 | 2007-03-29 08:41:09.667033-03 | Sigati - 3485513 | 2008-03-26 16:45:51.301379-03 | SIMEC - Sistema Integrado de Planejamento Orçamento e Finanças + 3485513 | 2008-03-26 16:45:51.301379-03 | SIMEC - Sistema Integrado de Planejamento Orçamento e Finanças 5482 | 2007-02-09 10:05:23.803077-02 | Sisau-Saci-Contra - 42365353 | 2011-10-19 16:17:57.49005-02 | Sistema Aberto de Eleições Eletrônicas + 42365353 | 2011-10-19 16:17:57.49005-02 | SAELE 44620010 | 2011-12-05 18:03:30.046532-02 | Sistema de Ouvidoria - 54650395 | 2012-06-29 15:24:43.920424-03 | SIVAC - Sistema on-line de Vacinação + 54650395 | 2012-06-29 15:24:43.920424-03 | SIVAC - Sistema on-line de Vacinação 26934301 | 2010-12-02 17:40:23.960186-02 | SNEP PBX IP 7283318 | 2008-11-11 14:31:33.260701-02 | SPED - Sistema de protocolo eletrônico 51053337 | 2012-04-27 13:49:25.11419-03 | Tucunaré diff --git a/update.rb b/update.rb index 3b5018b..c26f090 100644 --- a/update.rb +++ b/update.rb @@ -1,4 +1,25 @@ # Update software dates +softwares = SoftwareInfo.all +puts "Removing trailling spaces of softwares name and updating the box layout" +softwares.each do |soft| + if soft.community + name = soft.community.name.strip + soft.community.name = name + soft.community.save + + soft.community.layout_template = "lefttopright" + print "." if soft.community.save + boxToMove = soft.community.boxes.where(:position => 1).first + blockToMove = boxToMove.blocks.where(:type => "SoftwareInformationBlock").first + newBox = soft.community.boxes.where(:position => 4).first + blockToMove.box = newBox + print "." if blockToMove.save + else + soft.destroy + end +end + +puts "" puts "Updating dates for software" file = File.new("date-communities.txt", "r") while (line = file.gets) @@ -10,6 +31,7 @@ while (line = file.gets) print "." else print "F" + puts software_name end end file.close @@ -35,23 +57,11 @@ boxTemplateSoftware.blocks.each do |block| print "." if block.save end -softwares = SoftwareInfo.all - -softwares.each do |soft| - soft.community.layout_template = "lefttopright" - print "." if soft.community.save - boxToMove = soft.community.boxes.where(:position => 1).first - blockToMove = boxToMove.blocks.where(:type => "SoftwareInformationBlock").first - newBox = soft.community.boxes.where(:position => 4).first - blockToMove.box = newBox - print "." if blockToMove.save -end - blocks.each do |block| if block.settings[:fixed] == true block.move_modes = 'none' block.edit_modes = 'none' - end + end if !(block.owner.class == Environment) && block.owner.organization? && !block.owner.enterprise? if block.owner.software? software_block = boxTemplateSoftware.blocks.where(:title => block.title).first -- libgit2 0.21.2