A
Adam Akhtar
I making a script which generates some basic stats for completed
listings on ebay. Its merely a means to improve on my ruby so its pretty
primitive
I have an array of hashes. Each hash represents a listing on ebay.
e.g.
{:title => "Canon Accessory R45-WD45", :model_number =>"R45-WD45"
:did_it_sell => TRUE}
Within in the array there will be many listings for the same product.
E.g. 25 wiis, 45 xboxes 35 sigma 18-50mm lenses etc.
I want to work out statistics for each product grouping. Teh desired
output would be something like this
Wii - Total listings 25. Total sold 10. Sell through rate 40%
Xbox - Total listings 50. Total sold 2. Sell through rate 4%
So i need to at least sort the array of products in order of their model
number passing sort a custom block.
From here on im not sure how to proceed. Should I bundle the groupings
of model numbers into their own arrays or should i simply iterate over
this nicely sorted array and make the script keep a mental note of what
product its calculating for.
in C i would have used a structure to contain the product information.
Is a hash the best thing to use?
Im not looking for someone to write the code but rather a general
outline of how this type of stuff is usually done. any help greatly
apprecated.
listings on ebay. Its merely a means to improve on my ruby so its pretty
primitive
I have an array of hashes. Each hash represents a listing on ebay.
e.g.
{:title => "Canon Accessory R45-WD45", :model_number =>"R45-WD45"
:did_it_sell => TRUE}
Within in the array there will be many listings for the same product.
E.g. 25 wiis, 45 xboxes 35 sigma 18-50mm lenses etc.
I want to work out statistics for each product grouping. Teh desired
output would be something like this
Wii - Total listings 25. Total sold 10. Sell through rate 40%
Xbox - Total listings 50. Total sold 2. Sell through rate 4%
So i need to at least sort the array of products in order of their model
number passing sort a custom block.
From here on im not sure how to proceed. Should I bundle the groupings
of model numbers into their own arrays or should i simply iterate over
this nicely sorted array and make the script keep a mental note of what
product its calculating for.
in C i would have used a structure to contain the product information.
Is a hash the best thing to use?
Im not looking for someone to write the code but rather a general
outline of how this type of stuff is usually done. any help greatly
apprecated.