From b7151a47da8768cf9f66aa8ea89339b954143353 Mon Sep 17 00:00:00 2001 From: Adam Kariv Date: Thu, 19 Dec 2024 15:43:23 +0200 Subject: [PATCH] Fixes hasadna/social-procurement#249 --- .../item-social-service-gov-unit/charts.ts | 16 +++--- .../item-social-service-gov-unit.component.ts | 56 +++++++++++++------ 2 files changed, 47 insertions(+), 25 deletions(-) diff --git a/projects/budgetkey/src/app/item/items/item-soproc/item-social-service-gov-unit/charts.ts b/projects/budgetkey/src/app/item/items/item-soproc/item-social-service-gov-unit/charts.ts index f5497e6..b70015a 100644 --- a/projects/budgetkey/src/app/item/items/item-soproc/item-social-service-gov-unit/charts.ts +++ b/projects/budgetkey/src/app/item/items/item-soproc/item-social-service-gov-unit/charts.ts @@ -388,7 +388,7 @@ export const chartTemplates: any[] = [ kind: 'org', data: (items: any[], info: any, xValues: any[]) => { const kinds = items.map((x) => x.supplier_kinds).filter((item, i, ar) => ar.indexOf(item) === i).sort(); - return ['מגזר שלישי', 'עסקי', 'משולב', 'אחר'].filter(k => kinds.indexOf(k) > -1).map((kind) => { + return ['משולב', 'מגזר שלישי', 'עסקי', 'אחר'].filter(k => kinds.indexOf(k) > -1).map((kind) => { return { type: 'bar', name: kind, @@ -432,7 +432,7 @@ export const chartTemplates: any[] = [ kind: 'org', data: (items: any[], info: any, xValues: any[]) => { const kinds = items.map((x) => x.supplier_kinds).filter((item, i, ar) => ar.indexOf(item) === i).sort(); - return ['מגזר שלישי', 'עסקי', 'משולב', 'אחר'].filter(k => kinds.indexOf(k) > -1).map((kind) => { + return ['משולב', 'מגזר שלישי', 'עסקי', 'אחר'].filter(k => kinds.indexOf(k) > -1).map((kind) => { return { type: 'bar', hovertemplate: '₪%{text}', @@ -682,7 +682,7 @@ export const chartTemplates: any[] = [ from s where t->>'active' = 'yes' group by 1,2 - ORDER BY 1`, + ORDER BY 3 desc`, title: 'מספר הליכי רכש לפי סוג הליך', titleTooltip: 'מספר מספר הליכי רכש לפי סוג ההליך - מרכזי, משרדי, התקשרות בפטור וכו׳', x_field: 'office', @@ -704,7 +704,7 @@ export const chartTemplates: any[] = [ }, kind: 'org', data: (items: any[], info: any, xValues: any[]) => { - const kinds = items.map((x) => x.tender_type_he).filter((item, i, ar) => ar.indexOf(item) === i).sort(); + const kinds = items.map((x) => x.tender_type_he).filter((item, i, ar) => ar.indexOf(item) === i);//.sort(); return kinds.filter(k => kinds.indexOf(k) > -1).map((kind) => { return { type: 'bar', @@ -728,7 +728,7 @@ export const chartTemplates: any[] = [ where t->>'tender_type' = 'exemptions' and t->>'active' = 'yes' group by 1,2 - ORDER BY 1`, + ORDER BY 3 desc`, title: 'מספר פטורים לפי סוג פטור', titleTooltip: 'מספר מספר הליכי פטור ממכרז לפי סוג תקנת הפטור', x_field: 'office', @@ -750,9 +750,9 @@ export const chartTemplates: any[] = [ }, kind: 'org', data: (items: any[], info: any, xValues: any[]) => { - const kinds = items.map((x) => x.sub_kind_he).filter((item, i, ar) => ar.indexOf(item) === i).sort(); - const ordered = ['אחר', 'מכרז סגור', 'התקשרות עם רשות מקומית', 'מיזם משותף', 'התקשרות המשך', 'ספק יחיד', 'מימוש אופציה'] - return ordered.filter(k => kinds.indexOf(k) > -1).map((kind) => { + const kinds = items.map((x) => x.sub_kind_he).filter((item, i, ar) => ar.indexOf(item) === i);//.sort(); + // const ordered = ['אחר', 'מכרז סגור', 'התקשרות עם רשות מקומית', 'מיזם משותף', 'התקשרות המשך', 'ספק יחיד', 'מימוש אופציה'] + return kinds.filter(k => kinds.indexOf(k) > -1).map((kind) => { return { type: 'bar', name: kind, diff --git a/projects/budgetkey/src/app/item/items/item-soproc/item-social-service-gov-unit/item-social-service-gov-unit.component.ts b/projects/budgetkey/src/app/item/items/item-soproc/item-social-service-gov-unit/item-social-service-gov-unit.component.ts index e128660..7ad173b 100644 --- a/projects/budgetkey/src/app/item/items/item-soproc/item-social-service-gov-unit/item-social-service-gov-unit.component.ts +++ b/projects/budgetkey/src/app/item/items/item-soproc/item-social-service-gov-unit/item-social-service-gov-unit.component.ts @@ -38,18 +38,20 @@ export class ItemSocialServiceGovUnitComponent implements OnInit, AfterViewInit {title: 'מודל תמחור', id: 'pricing_model', tooltip: 'האם נקבע מראש תעריף לאספקת השירות או שעל המציעים להגיש הצעת מחיר או מודל משולב'}, ]; COLORS = [ - '#9FD4AE', - '#38B264', - '#187388', - '#8FD6E8', - '#CC81AF', - '#9D7EAF', - '#643C6A', - '#7285B7', - '#B6AE86', - '#CC8A57', - '#444444' + '#038CA4', // 0 + '#A1767A', // 1 + '#84353D', // 2 + '#DB6B58', // 3 + '#DB8258', // 4 + '#9ED4C4', // 5 + '#81A351', // 6 + '#1A4F40', // 7 + '#CA7898', // 8 + '#BE4C9C', // 9 + '#763483', // 10 + '#E4CF43', // 11 ]; + OTHER_COLOR_IDX = this.COLORS.length - 1; public parameters: any = { pricing_model: [ @@ -200,17 +202,37 @@ export class ItemSocialServiceGovUnitComponent implements OnInit, AfterViewInit } } } - const orgSizes = ['1', '2-5', '6+'] + const orgSizes = ['1', '2-5', '6+']; + const orgSizesIdx = [8, 9, 10]; + for (const i in orgSizes) { + scheme[orgSizes[i]] = orgSizesIdx[i]; + } const orgKinds = ['עסקי', 'מגזר שלישי', 'רשויות מקומיות', 'משולב']; + const orgKindsIdx = [5, 0, 6, 7]; + for (const i in orgKinds) { + scheme[orgKinds[i]] = orgKindsIdx[i]; + } + const offices = ['משרד החינוך', 'משרד הרווחה', 'משרד הבריאות']; + const officeIdx = [9, 6, 4]; + for (const i in offices) { + scheme[offices[i]] = officeIdx[i]; + } const exemptionKinds = ['מימוש אופציה', 'ספק יחיד', 'התקשרות המשך', 'מיזם משותף', 'התקשרות עם רשות מקומית', 'מכרז סגור']; + const exemptionKindsIdx = [5, 10, 1, 7, 9, 11]; + for (const i in exemptionKinds) { + scheme[exemptionKinds[i]] = exemptionKindsIdx[i]; + } const tenderTypes = ['מכרז פומבי', 'התקשרות בפטור במכרז או בהליך תחרותי אחר', 'פרסום כוונה להתקשרות', 'פרסום מיזם ללא כוונת רווח', 'פניה לקבלת מידע RFI', 'קול קורא להקמת/עדכון רשימת מציעים (מאגר']; + const tenderTypesIdx = [2, 3, 5, 8, 1, 11]; + for (const i in tenderTypes) { + scheme[tenderTypes[i]] = tenderTypesIdx[i]; + } const model = ['מחיר קבוע (תעריף)', 'הצעת מחיר']; - for (const l of [orgSizes, orgKinds, exemptionKinds, tenderTypes, model]) { - for (const i in l) { - scheme[l[i]] = parseInt(i) + 4; - } + const modelIdx = [2, 5]; + for (const i in model) { + scheme[model[i]] = modelIdx[i]; } - scheme['אחר'] = 10; + scheme['אחר'] = this.OTHER_COLOR_IDX; this.colorscheme.next(scheme); this.colorscheme.complete(); });