20170417_jeffrey - silenceuncrio/diary GitHub Wiki
0910
review
0925
engineering notebook
0940
今天先把 GPS WEB UI 完成再來做 monkeyjj 的事情
首先要能依據 make menuconfig
產生出來的 macro PROSRC_GNSS
被定義與否來決定網頁是否要顯示該功能
先實作該功能再來想辦法從 proscend/prosrc/www/Makefile
來連動該功能
1310
繼續 monkeyjj 的資料庫分析
進行 Step 3: Create simplified Entity-Relationship diagram
之前
我需要把上禮拜 Step 1
和 Step 2
的結果寫成英文
step 1: Discover entities and assign attributes
客人 | 商品 | 貨源 | 架(團購貨架) | 單 |
---|---|---|---|---|
臉書帳號 | 名稱 | 貨源名稱 | 團購名稱 | 下單日期 |
成本售價 | 網址 | 上架時間 |
用英文再寫一次 順便補一下 attribute
Customers | Commodities | CommoditySources | CommodityShelves | Orders |
---|---|---|---|---|
(PK) CustomerId | (PK) CommodityId | (PK) CommoditySourceId | (PK) CommodityShelveId | (PK) OrderId |
Name | Name | SourceName | ShelveName | DatePlaced |
FBAccount | Cost | DateStarted | TotalPrice | |
Price | DateEnded | |||
Description |
1335
Step 2: Derive unary and binary relationships
客人 | 商品 | 貨源 | 架(團購貨架) | 單 | |
---|---|---|---|---|---|
客人 | - | - | - | - | |
商品 | - | - | - | ||
貨源 | 包含 | - | - | ||
團購貨架 | 在 | - | |||
單 | 下 | 包含 |
用英文再寫一次 順便補一下 attribute
Customers | Commodities | CommoditySources | CommodityShelves | Orders | |
---|---|---|---|---|---|
Customers | - | - | - | - | |
Commodities | - | - | - | ||
CommoditySources | supply | - | - | ||
CommodityShelves | hit | - | |||
Orders | place | has |
1345
進行 Step 3: Create simplified Entity-Relationship diagram
利用 draw.io
來畫圖
1425
先把 GPS 網頁時做的部分 上 code
1435
進行 Step 4: List assertions for all relationships
參考 Step 2: Derive unary and binary relationships
Customers | Commodities | CommoditySources | CommodityShelves | Orders | |
---|---|---|---|---|---|
Customers | - | - | - | - | |
Commodities | - | - | - | ||
CommoditySources | supply | - | - | ||
CommodityShelves | hit | - | |||
Orders | place | has |
從 row 開始寫
- A Customer can place many orders
- A Commodity must be supplied from only one CommoditySource
- A Commodity can hit many CommodityShelve
- A Commodity can be contained in many orders
反過來描述
- A order must be placed by only one Customer
- A CommoditySource must supply at least one Commodity
- A CommodityShelve must be hit by at least one Commodity
- A order must have at least one Commodity
反覆檢查一下符不符合目前的情況
覺得 Commodity(商品) 的 Price(售價) 應該是跟著每次的開團而決定
看來要從頭來一次了
1525
回到 Step 1-1: Discover the entities
之前的 entities 有
- 客人
- 商品
- 貨源
- 架(團購貨架)
- 單
目前再次思考過的 entities 有
- 團主
- 團購團
- 客人
- 團購商品
- 商品
- 貨源
- 單
先跳過 Step 1-2
直接整理 Step 2: Derive unary and binary relationships
所需要的 Matrix
團主 | 團購團 | 客人 | 團購商品 | 商品 | 貨源 | 團購單 | |
---|---|---|---|---|---|---|---|
團主 | |||||||
團購團 | 開團 | ||||||
客人 | |||||||
團購商品 | 包含 | ||||||
商品 | 屬於 | 入團 | |||||
貨源 | 供應 | ||||||
團購單 | 下單 | 包含 |
直接進行 Step 4: List assertions for all relationships
的分析
團主
can開團
many團購團
團主
can擁有
many商品
團購團
must包含
at least one團購商品
客人
can下單
many團購單
團購商品
must be入團
ed by only one商品
團購商品
must be包含
ed in only one團購團
商品
must be供應
ed by only one貨源
反過來看看
團購團
must be開團
by only one團主
商品
must be擁有
by only one團主
團購商品
must be包含
ed in only one團購團
團購單
must be下單
by only one客人
商品
can入團
成為 only one團購商品
團購團
must包含
at least one團購商品
貨源
must供應
at least one商品
仔細 review 一下
1625
把 Step 2: Derive unary and binary relationships
的 Matrix
轉成 英文
Owners | GroupBuyings | Buyers | GroupBuyingProducts | Products | ProductSupplier | GroupBuyingOrders | |
---|---|---|---|---|---|---|---|
Owners | |||||||
GroupBuyings | create | ||||||
Buyers | |||||||
GroupBuyingProducts | contain | ||||||
Products | own | join | |||||
ProductSupplier | supply | ||||||
GroupBuyingOrders | place | fill |
再做一次 Step 4: List assertions for all relationships
- A Owner can create many GroupBuyings
- A Owner can own many Products
- A GroupBuying must contain at least one GroupBuyingProducts
- A Buyer can place many GroupBuyingOrders
- A GroupBuyingProduct must be joined by only one Product
- A GroupBuyingProduct must fill into only one ...
覺得可以把 GroupBuyingProduct
這個 entity 刪掉
再重新整理一下 Step 2: Derive unary and binary relationships
Owners | GroupBuyings | Buyers | Products | ProductSuppliers | GroupBuyingOrders | |
---|---|---|---|---|---|---|
Owners | ||||||
GroupBuyings | create | |||||
Buyers | ||||||
Products | own | join | ||||
ProductSuppliers | supply | |||||
GroupBuyingOrders | place | fill |
再做一次 Step 4: List assertions for all relationships
- A Owner can create many GroupBuyings
- A Owner can own many Products
- A GroupBuying must be joined by at least one Product
- A Buyer can place many GroupBuyingOrders
- A Product must be supply by only one ProductSupplier
- A Product can fill into many GroupBuyingOrders
反過來
- A GroupBuyings must be created by only one Owner
- A Product must be owned by only one Owner
- A Product can join many GroupBuying
- A GroupBuyingOrders must be placed by only one Buyer
- A ProductSupplier must supply at lease one Products
- A GroupBuyingOrders must be filled by at least one Product
順多了
補 Step 1-2: Assign attributes to each entity discovered
- Owners
- Name
- GroupBuyings
- Name
- Description
- DateStarted
- DateEnded
- Buyers
- Name
- FBAccount
- Products
- Name
- Cost
- ProductSupplier
- Name
- URL
- GroupBuyingOrders
- DatePlaces
- TotalCost
補 Step 1-3: Select identifiers, keys and primary keys from attributes for each entity
- Owners
- (PK) OwnerId
- Name
- GroupBuyings
- (PK) GroupBuyingId
- Name
- Description
- DateStarted
- DateEnded
- Buyers
- (PK) BuyerId
- Name
- FBAccount
- Products
- (PK) ProductId
- Name
- Cost
- ProductSuppliers
- (PK) ProductSupplierId
- Name
- URL
- GroupBuyingOrders
- (PK) GroupBuyingOrderId
- DatePlaces
- TotalCost
1725
再來一次 Step 3: Create simplified Entity-Relationship diagram
感覺 GroupBuyingOrders
不應該跟 Products
有關係
而是等 GroupBuyings
和 Products
產生關係後的那個 關係 才會跟 GroupBuyingOrders
有某種關係
我先把 GroupBuyingOrders
跟 Products
之間的關係拿掉好了
重新整理一下 Step 2: Derive unary and binary relationships
Owners | GroupBuyings | Buyers | Products | ProductSuppliers | GroupBuyingOrders | |
---|---|---|---|---|---|---|
Owners | ||||||
GroupBuyings | create | |||||
Buyers | ||||||
Products | own | join | ||||
ProductSuppliers | supply | |||||
GroupBuyingOrders | place |
再一次 Step 3: Create simplified Entity-Relationship diagram