B
B
bdr2016-05-11 16:12:52
Python
bdr, 2016-05-11 16:12:52

How to generate json data for charts?

Hello. I can't solve the problem for a week now.
The bottom line is that I need to collect and display in a graph how many times a client has used a particular service of the company.
For example, if a company has 5 services: python development, html layout, website promotion, audit, copywriting... then for each client of the company I have to form a simple array of service demand, for example: [4,12,3,5,6]
From the first look is not a difficult task, but I have been suffering for a week already...
Here is the first method pastebin.com/XZsAMAQS
It worked and returned the result but only for one client, the rest of the clients did not receive any data on the use of services, which were marked in the tasks
Second option pastebin.com/uqGizDbL
gives an out of range error because the final array is too big...
The third option pastebin.com/uqGizDbL
is also out of range I
use webpy as a framework
I would be glad for any help, even just pseudocode that will help to implement the functionality...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir, 2016-05-11
@vintello

c webpy не работал, но кажется что проблема у вас когда вы работаете с результатами выборки
после строки service_tasks = db.query('SELECT * fro ....
нужно сделать цикл получения данных

for row in service_tasks:
      print row

так оно должно выбирать все записи

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question