Skip to content

Instantly share code, notes, and snippets.

View lordhx's full-sized avatar
🙈

Nikita Kharitonov lordhx

🙈
View GitHub Profile
SELECT
spree_orders.number,
date_trunc('day', spree_orders.completed_at at time zone 'utc' at time zone 'edt') as date,
total - additional_tax_total as revenue,
cost_total as items_cost,
COALESCE(SUM(shipping_cost), 0) as shipping_cost,
ARRAY_AGG(DISTINCT spree_suppliers.name) as suppliers
FROM "spree_orders"
LEFT JOIN "supplier_orders" ON "supplier_orders"."spree_order_id" = "spree_orders"."id"
LEFT JOIN "supplier_shipments" ON "supplier_shipments"."order_id" = "supplier_orders"."id"
def call
@all_dishes = []
# У нас есть требование чтобы одно блюдо встречалось не более трех раз в неделю
# Таким образом получается что нам нужно подобрать 3 рациона на пн, вт, ср
# а дальше мы просто повторим их же
variants = 3.times.map do
# недобор или перебор по конкретным материалам, изначально все в 0
@diff = {}
@lordhx
lordhx / gfHumanResourcesValue.js
Last active October 15, 2015 11:33
gfHumanResourcesValue
angular.module('glassFactory').filter('gfHumanResourcesValue', function (currentProjectPlan, zoomLevel) {
function fUtil(val) {
console.log('fUtil', currentProjectPlan.settings.utilization, val)
switch (currentProjectPlan.settings.utilization) {
case 'perc':
return val + '%'
case 'mh':
return 8 * val / 100 + 'mh'
case 'md':
return val / 100 + 'md'