質問編集履歴
2
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -162,7 +162,7 @@
|
|
162
162
|
|
163
163
|
```
|
164
164
|
|
165
|
-
|
165
|
+
集計結果を入れる予定のモデル(daily_reports)
|
166
166
|
|
167
167
|
# Table name: daily_reports
|
168
168
|
|
1
モデルなどを追記しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -84,6 +84,130 @@
|
|
84
84
|
|
85
85
|
```
|
86
86
|
|
87
|
+
### モデル
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
```
|
92
|
+
|
93
|
+
LocationLog 位置および業務内容のモデル
|
94
|
+
|
95
|
+
# == Schema Information
|
96
|
+
|
97
|
+
#
|
98
|
+
|
99
|
+
# Table name: location_logs
|
100
|
+
|
101
|
+
#
|
102
|
+
|
103
|
+
# id :integer not null, primary key
|
104
|
+
|
105
|
+
# user_id :integer not null
|
106
|
+
|
107
|
+
# work_category_id :integer not null
|
108
|
+
|
109
|
+
# item_id :integer
|
110
|
+
|
111
|
+
# latitude :float not null
|
112
|
+
|
113
|
+
# longitude :float not null
|
114
|
+
|
115
|
+
# current_at :datetime
|
116
|
+
|
117
|
+
# created_at :datetime not null
|
118
|
+
|
119
|
+
# updated_at :datetime not null
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
```
|
124
|
+
|
125
|
+
```
|
126
|
+
|
127
|
+
# Table name: work_categories
|
128
|
+
|
129
|
+
#
|
130
|
+
|
131
|
+
# id :integer not null, primary key
|
132
|
+
|
133
|
+
# name :string not null
|
134
|
+
|
135
|
+
# created_at :datetime not null
|
136
|
+
|
137
|
+
# updated_at :datetime not null
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
# Seedで作成している
|
142
|
+
|
143
|
+
# WorkCategory.create(id: 100, name:"その他")
|
144
|
+
|
145
|
+
# WorkCategory.create(id: 1, name:"移動")
|
146
|
+
|
147
|
+
# WorkCategory.create(id: 2, name:"休憩")
|
148
|
+
|
149
|
+
# WorkCategory.create(id: 3, name:"接客")
|
150
|
+
|
151
|
+
# WorkCategory.create(id: 4, name:"待機")
|
152
|
+
|
153
|
+
# WorkCategory.create(id: 5, name:"完了")
|
154
|
+
|
155
|
+
```
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
以下は今回作ったモデルです。上記の情報を収集して格納したいと考えているものです。
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
```
|
164
|
+
|
165
|
+
LocationLog 集計結果を入れる予定のモデル(daily_reports)
|
166
|
+
|
167
|
+
# Table name: daily_reports
|
168
|
+
|
169
|
+
#
|
170
|
+
|
171
|
+
# id :integer not null, primary key
|
172
|
+
|
173
|
+
# item_count :string
|
174
|
+
|
175
|
+
# total_distance :string
|
176
|
+
|
177
|
+
# total_business_time :string
|
178
|
+
|
179
|
+
# total_moving_time :string
|
180
|
+
|
181
|
+
# total_breaking_time :string
|
182
|
+
|
183
|
+
# total_working_time :string
|
184
|
+
|
185
|
+
# total_waiting_time :string
|
186
|
+
|
187
|
+
# total_other_time :string
|
188
|
+
|
189
|
+
# created_at :datetime not null
|
190
|
+
|
191
|
+
# updated_at :datetime not null
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
```
|
196
|
+
|
197
|
+
他にもモデルはたくさんありますが、関係するモデルを記しました。また、とりあえず作ったのでstringなど最終的にintegerにすべき部分もありそうですが取り急ぎ。
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
最終的には、sidekiq& wheneverを使って、翌日にBatch処理して、データを保存できたらと思っています。(そのためのWorkerはすでに出来ています。)
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
データベースは、postgresqlを利用しています。
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
87
211
|
|
88
212
|
|
89
213
|
### 補足情報(FW/ツールのバージョンなど)
|