Skip to content

Instantly share code, notes, and snippets.

@devanmoylan
devanmoylan / tm_ft_allocated_po_line_query
Last active May 12, 2022 21:36
[WIP] Transmetro and fashionthing allocated purchase order line query
-- TODOS:
-- filter out nike
-- filter out unpublished
-- improve allocated po number splitting
-- update item type data source to be transmetro
-- NOTES:
-- money: cost and price values are in lowest unit for the currency (e.g. cents for USD)
-- update date: a revision to update date does not necessarily mean a relevant attribute changed; but instead something on the data source changed
@devanmoylan
devanmoylan / tm_ft_allocated_po_header_query
Last active May 12, 2022 21:31
[WIP] Transmetro and fashionthing allocated purchase order header query
-- TODOS:
-- oracle po number substring approach sufficient? improve by dropping on and after the first dash
-- return null on Supplier Brand Name if multiple brands exist
-- filter out non published po's
-- talk with IT about how they plan us timestamps -- use that to drive our inclusion strat for timestamps
-- NOTES:
-- filters: inner and out filter exists for the header
-- update dates: are commented out right now
-- money: cost and price values are in lowest unit for the currency (e.g. cents for USD)
@devanmoylan
devanmoylan / tm_ft_blanket_po_header_query
Last active May 12, 2022 21:20
[WIP] Transmetro and fashionthing blanket purchase order header query
-- TODO:
-- return nil for multiple brand names
-- add filters
-- only published (look at `fashionthing.purchase_order_events.description`)
-- notes:
-- filters: inner and out filters exist for the header
-- money: cost and price values are in lowest unit for the currency (e.g. cents for USD)
-- exclusive brand: is_exclusive returns true if ANY merch buy is exclusive
-- update date: an update to update date does not necessarily mean a relevant attribute changed
@devanmoylan
devanmoylan / tm_ft_blanket_po_line_query
Last active May 12, 2022 21:22
[WIP] Transmetro and fashionthing blanket purchase order line query
-- TODOS:
-- update item type data source to be transmetro
-- filter out nike
-- filter out not published po's
-- NOTES:
-- cost and price values are in lowest unit for the currency (e.g. cents for USD)
-- size spectrum: if an issue of missing value, might have to fall back `style.merch_mode_object.size_spectrums.first`
-- primary client focus: if an issue of missing value, might have to default to 'general'
SELECT DISTINCT(pos.sku_id)
FROM "hive"."po_service"."purchase_orders" po
LEFT JOIN "hive"."po_service"."purchase_order_skus" pos ON po.id=pos.purchase_order_id
WHERE po.purchase_order_number IN (
'A130055',
'A151077',
'A163402',
'A164092',
'A165126',
'A165942',
business_line: womens
excluded_item_type_ids:
- 404
- 447
- 405
- 448
- 406
- 449
- 407
- 450
business_line: mens
excluded_item_type_ids:
- 404
- 447
- 405
- 448
- 406
- 449
- 407
- 450
business_line: all
excluded_item_type_ids:
- 80
- 429
- 434
- 91
- 180
- 467
- 468
- 182
business_line: all
excluded_item_type_ids:
- 378
- 84
- 393
- 386
- 404
- 24
- 32
- 422
business_line: ALL
excluded_item_type_ids:
- 24
- 26
- 30
- 53
- 172
- 173
- 449
- 450