Railsで複数項目でGroupして帰ってきた結果の配列があります。
ruby
1{"[1, 16, 13, \"2022-01-11\", 3, 1]":1,"[1, 16, 13, \"2022-01-11\", 3, 2]":1,"[1, 16, 13, \"2022-01-11\", 3, 3]":1,"[1, 16, 13, \"2022-01-11\", 3, 4]":2,"[1, 16, 13, \"2022-01-11\", 3, 5]":2,"[1, 16, 13, \"2022-01-11\", 3, 6]":1,"[1, 16, 13, \"2022-01-11\", 3, 7]":1,"[1, 16, 13, \"2022-01-12\", 3, 1]":1,"[1, 16, 13, \"2022-01-12\", 3, 2]":1,"[1, 16, 13, \"2022-01-12\", 3, 3]":1,"[1, 16, 13, \"2022-01-12\", 3, 4]":2,"[1, 16, 13, \"2022-01-12\", 3, 5]":2,"[1, 16, 13, \"2022-01-12\", 3, 6]":1,"[1, 16, 13, \"2022-01-12\", 3, 7]":1}
このデータを下記のように加工したいです。
Ruby
1[ 2["2022-01-11",{"1":1,"2":1,"3":1,"4":2,"5":2,"6":1,"7":1}], 3["2022-01-12",{"1":1,"2":1,"3":1,"4":2,"5":2,"6":1,"7":1}] 4]
下記の部分のKeyは
Ruby
1{"1":1,"2":1,"3":1,"4":2,"5":2,"6":1,"7":1}
最初のデータのKeyになっている配列の最後の要素です(indexの6)。
Ruby
1[1, 16, 13, \"2022-01-11\", 3, 1⇦この部分]
以上わかる方いらっしゃいましたらよろしくお願いいたします。
あなたの回答
tips
プレビュー