Skip to content

Commit

Permalink
[server] デフォルトDBレコードの更新 / [sensor] ドアセンサー1号機の固有IDの更新
Browse files Browse the repository at this point in the history
  • Loading branch information
tissueMO committed Jan 20, 2020
1 parent 57ffdff commit 29ad72c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions sensor/ESPrDoorSensor.ino → sensor/sensor.ino
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ const int port = PORT;
WiFiClient client;

// 機器固有設定
const char* TOILET_ID = "11";
// const char* TOILET_ID = "21";
// const char* TOILET_ID = "11";
const char* TOILET_ID = "21";
// const char* TOILET_ID = "31";
// const char* TOILET_ID = "32";
// const char* TOILET_ID = "41";
Expand Down
1 change: 1 addition & 0 deletions server/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.vscode
__pycache__
*.pyc
db/*.db
migrate/versions/*.py
16 changes: 8 additions & 8 deletions server/model/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,20 @@
])
# トイレマスター
session.add_all([
Toilet(id=11, name="4F男性用トイレ", valid=True, is_closed=False, modified_time=now),
Toilet(id=11, name="4F男性用トイレ", valid=False, is_closed=False, modified_time=now),
Toilet(id=21, name="6F男性用トイレ", valid=True, is_closed=False, modified_time=now),
Toilet(id=31, name="4F女性用トイレ", valid=False, is_closed=False, modified_time=now),
Toilet(id=32, name="4F女性用トイレ", valid=False, is_closed=False, modified_time=now),
Toilet(id=41, name="6F女性用トイレ", valid=False, is_closed=False, modified_time=now),
Toilet(id=42, name="6F女性用トイレ", valid=False, is_closed=False, modified_time=now)
])
# [デバッグ用] トイレ入退室トランザクションテーブル
import random
for toilet_id in [11, 21, 31, 32, 41, 42]:
count = random.randint(1, 10)
for i in range(count):
timedelta_minutes = random.randint(1, 10000)
session.add(ToiletStatus(toilet_id=toilet_id, is_closed=False, created_time=now-timedelta(minutes=timedelta_minutes)))
# # [デバッグ用] トイレ入退室トランザクションテーブル
# import random
# for toilet_id in [11, 21, 31, 32, 41, 42]:
# count = random.randint(1, 10)
# for i in range(count):
# timedelta_minutes = random.randint(1, 10000)
# session.add(ToiletStatus(toilet_id=toilet_id, is_closed=False, created_time=now-timedelta(minutes=timedelta_minutes)))
# 初期状態で挿入しておきたいレコードの定義 ここまで <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

# 変更をコミット
Expand Down

0 comments on commit 29ad72c

Please sign in to comment.