This question has already been answered:
There is an array of the form:
var data = [ {"time":["00:00"],"workstation":4,"worker":4}, {"time":["00:00","01:45","03:30","05:15","07:00","08:45","10:30","12:15","14:00"],"workstation":11,"worker":4}, {"time":["02:40"],"workstation":14,"worker":1}, {"time":["02:40"],"workstation":4,"worker":1}, {"time":["17:30","19:15","21:00","22:45"],"workstation":4,"worker":1}, {"time":["17:30","19:15","21:00","22:45"],"workstation":14,"worker":1} ]; (The time is stored in the timestamp. For the sake of simplicity, I have done so far in a normal format. Here the source array is http://jsfiddle.net/p2exsn36/1/ )
That is, each element is an object of the form:
{ "time" : [], "workstation" : 14, "worker" : 1 } There are duplicates of time in this object in the time array, a worker can also be different and workstation. At the exit, I would like to get a "clean" array of the form:
[ {"time" : "00:00", "workstation" : [14,5], "worker" : [1,4]}, {"time" : "01:45", "workstation" : [11], "worker" : [4]} ] Tell me, please, how can they be glued correctly? Thank! Just starting to learn javascript