# Script sometimes sends random data to database?

**URL:** <https://www.ruby-forum.com/t/script-sometimes-sends-random-data-to-database/177218>\
**Category:** Rails\
**Created:** [October 13, 2009, 3:51pm UTC](https://www.ruby-forum.com/t/script-sometimes-sends-random-data-to-database/177218 "2009-10-13T15:51:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![trevoke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ee7513/32.png) [@trevoke](https://www.ruby-forum.com/u/trevoke)\
**Post date:** [October 13, 2009, 3:51pm UTC](https://www.ruby-forum.com/t/script-sometimes-sends-random-data-to-database/177218/1 "2009-10-13T15:51:48Z")

</div>

I use the rufus-scheduler to execute jobs within my Rails application. I  
have the following code: [http://pastie.org/652937](http://pastie.org/652937)  
This is run every ~10 min. The database is mySQL, just in case it  
matters.

The data that gets skewed / screwed up is “score\_keeper”.  
As far as I can tell, what I wrote should do this:  
At the end of the script, either create a row for today if it doesn’t  
exist, or update the row for today with the integers that were built up  
as the script goes, with a value of 0 or more.

I’ll come in the morning sometimes and see that both dictated and  
proofread have values of ~144 or more in the database, which makes no  
sense because I know there haven’t been that many dictated or proofread  
since the beginning of the day. Sometimes it’s 220. I don’t understand  
where it gets these values from.

Any ideas?
