Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #35

Merged
merged 3 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "api",
"version": "0.4.2",
"version": "0.4.3",
"main": "index.ts",
"type": "module",
"private": true,
Expand All @@ -13,7 +13,7 @@
"lib": "workspace:*"
},
"devDependencies": {
"@types/node": "^20.11.20",
"@types/node": "^20.11.21",
"esbuild": "^0.20.1",
"typescript": "^5.3.3",
"vite-node": "1.3.1"
Expand Down
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "app",
"version": "0.4.2",
"version": "0.4.3",
"private": true,
"type": "module",
"scripts": {
Expand Down
3 changes: 2 additions & 1 deletion app/reports/Primals.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@
@apply border-transparent;
}

.selected.stat {
.stat[data-selected=true] {
@apply border-purple-400;
@apply text-gray-700;
@apply cursor-default;
}

.value {
Expand Down
2 changes: 1 addition & 1 deletion app/reports/Primals.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<div class="primals report">
<div class="stats">
{#each $stats as stat, index}
<div role="button" tabindex="0" class={stat.selected ? "selected stat" : "stat"}
<div role="button" tabindex="0" class="stat" data-selected={stat.selected ? "true" : "false"}
on:click={select(Primals[index])}
on:keypress={click}>
<h5 class="label">{stat.label}</h5>
Expand Down
4 changes: 2 additions & 2 deletions lib/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lib",
"version": "0.4.2",
"version": "0.4.3",
"private": true,
"type": "module",
"dependencies": {
Expand All @@ -10,7 +10,7 @@
},
"devDependencies": {
"@types/lru-cache": "^7.10.10",
"@types/node": "^20.11.20",
"@types/node": "^20.11.21",
"typescript": "^5.3.3"
}
}
12 changes: 6 additions & 6 deletions lib/slaughter/CashIndex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ interface Values extends Observation {
netPrice: number;
}

const arrangements = [Arrangement.Negotiated, Arrangement.MarketFormula, Arrangement.NegotiatedFormula];

const weight = (slaughter: Values): number =>
slaughter.headCount * slaughter.carcassWeight;

Expand All @@ -30,8 +32,6 @@ const value = (slaughter: Values): number =>
const avgPrice = (value: number, weight: number): number =>
round(value / weight);

const arrangements = [Arrangement.Negotiated, Arrangement.MarketFormula, Arrangement.NegotiatedFormula];

const filterSlaughter = (slaughter: Iterable<Slaughter>): Iterable<Values> =>
filter(slaughter, ({ netPrice, carcassWeight, arrangement }) =>
carcassWeight != null && netPrice != null && arrangements.includes(arrangement)) as Iterable<Values>;
Expand Down Expand Up @@ -60,13 +60,13 @@ function cashIndex(records: Iterable<Slaughter>): Iterable<CashIndex> {
namespace CashIndex {
export const from = cashIndex;

export const index = (cutout: Iterable<CashIndex>): Series =>
Array.from(map(cutout, ({ date, indexPrice: value }) => ({
export const index = (cash: Iterable<CashIndex>): Series =>
Array.from(map(cash, ({ date, indexPrice: value }) => ({
date, value
})));

export const daily = (cutout: Iterable<CashIndex>): Series =>
Array.from(map(cutout, ({ date, dailyPrice: value }) => ({
export const daily = (cash: Iterable<CashIndex>): Series =>
Array.from(map(cash, ({ date, dailyPrice: value }) => ({
date, value
})));
}
Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"name": "mpr-dashboard",
"version": "0.4.2",
"name": "mpr.kirke.dev",
"version": "0.4.3",
"description": "Dashboard and analytics for USDA Mandatory Price Reporting",
"author": "Andrew Kirkegaard",
"homepage": "https://github.com/kirkedev/mpr.kirke.dev",
"author": "Andrew Kirkegaard <andrew@kirke.dev> (https://github.com/kirkedev)",
"license": "ISC",
"private": true,
"scripts": {
Expand All @@ -15,8 +16,8 @@
"start": "TAG=${TAG:-$(git describe --tags --match 'v*' --dirty --always)}; yarn stop && yarn build && docker compose -f docker-compose.yml up"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^7.0.2",
"@typescript-eslint/parser": "^7.0.2",
"@typescript-eslint/eslint-plugin": "^7.1.0",
"@typescript-eslint/parser": "^7.1.0",
"eslint": "^8.57.0",
"eslint-plugin-svelte": "^2.35.1",
"husky": "^9.0.11",
Expand Down
4 changes: 2 additions & 2 deletions test/mpr/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mpr",
"version": "0.4.2",
"version": "0.4.3",
"type": "module",
"main": "index.ts",
"scripts": {
Expand All @@ -10,7 +10,7 @@
"lib": "workspace:*"
},
"devDependencies": {
"@types/node": "^20.11.20",
"@types/node": "^20.11.21",
"typescript": "^5.3.3",
"vite-node": "1.3.1"
}
Expand Down
8 changes: 4 additions & 4 deletions test/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "test",
"version": "0.4.2",
"version": "0.4.3",
"private": true,
"type": "module",
"scripts": {
Expand All @@ -11,17 +11,17 @@
},
"devDependencies": {
"@testing-library/dom": "^9.3.4",
"@testing-library/svelte": "^4.2.0",
"@testing-library/svelte": "^4.2.1",
"@testing-library/user-event": "^14.5.2",
"@types/detect-port": "^1.3.5",
"@types/node": "^20.11.20",
"@types/node": "^20.11.21",
"@types/resolve": "^1.20.6",
"@vitest/coverage-v8": "^1.3.1",
"detect-port": "^1.5.1",
"esbuild": "^0.20.1",
"jsdom": "^24.0.0",
"msw": "^2.2.1",
"playwright": "^1.41.2",
"playwright": "^1.42.0",
"svelte": "^4.2.12",
"typescript": "^5.3.3",
"vite": "^5.1.4",
Expand Down
Loading