Have twitter bootstrap and using the progress bar.
Want to animate the bar with javascript. Figured how to animate the bar based on time, now trying to figure how to animate based on progress.
The load screen comes when pulling elements out of a mongo api. How do I go about creating this animated progress bar that will move as i pull more elements?
def self.get_xxx_users(read_db)
db_users = read_db.collection("users");
db_users = db_users.find({"$and" => [:plan => { "$ne" =>"XXX"}, :'xxx.xxx_type' => {"$ne" => "XXX"}]},{}).to_a
db_users
Progess bars don’t progress magically as such you have to provide the hooks manually.
A good but simple (and probably in need of optimisation) method of doing this is to count the number of records you wanna pick out:
And then divide that up by a set area using
limit()each time to complete a certain amount of batch processing you require.So as you add those, say, 100 per batch (this is what I magically decided was a good number per batch of processing) users to the main array (
to_a) within your ruby app you ping a response back via AJAX or something to your app telling it to increment your progess bar.