Spaces:
Running
Running
Heaven K Claude Opus 4.6 (1M context) commited on
Commit ·
7b00df2
1
Parent(s): 753edf0
fix: restore envelope number in export, remove accents from branches
Browse files- Added envelopeNumber column back to both Excel exports and the
/transactions/export endpoint
- Removed all accents from branch names: Montreal, Quebec,
Trois-Rivieres, Riviere-du-Loup, Sept-Iles, St-Jerome, Siege
- Updated both branch mapping and DB seeds
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
packages/server/src/db/index.ts
CHANGED
|
@@ -95,19 +95,19 @@ sqlite.exec(`
|
|
| 95 |
// Authoritative branch list — only these 20 branches should exist
|
| 96 |
const now = new Date().toISOString();
|
| 97 |
const branchSeeds: [string, string][] = [
|
| 98 |
-
['finances@iccameriques.org', '
|
| 99 |
['gatineauottawa.finances@iccameriques.org', 'Gatineau'],
|
| 100 |
['moncton.finances@iccameriques.org', 'Moncton'],
|
| 101 |
['chibougamau.finances@iccameriques.org', 'Chibougamau'],
|
| 102 |
-
['trois-rivieres.finances@iccameriques.org', 'Trois-
|
| 103 |
['sherbrooke.finances@iccameriques.org', 'Sherbrooke'],
|
| 104 |
['toronto.finances@iccameriques.org', 'Toronto'],
|
| 105 |
-
['quebec.finances@iccameriques.org', '
|
| 106 |
['lvl.finances@iccameriques.org', 'Laval'],
|
| 107 |
['lgl.finances@iccameriques.org', 'Longueuil'],
|
| 108 |
['victoriaville.finances@iccameriques.org', 'Victoriaville'],
|
| 109 |
['valleyfield.finances@iccameriques.org', 'Valleyfield'],
|
| 110 |
-
['finances.rdl@iccameriques.org', '
|
| 111 |
['ottawa.finances@iccameriques.org', 'Ottawa'],
|
| 112 |
['kingston.finances@iccameriques.org', 'Kingston'],
|
| 113 |
['hamilton.finances@iccameriques.org', 'Hamilton'],
|
|
|
|
| 95 |
// Authoritative branch list — only these 20 branches should exist
|
| 96 |
const now = new Date().toISOString();
|
| 97 |
const branchSeeds: [string, string][] = [
|
| 98 |
+
['finances@iccameriques.org', 'Montreal'],
|
| 99 |
['gatineauottawa.finances@iccameriques.org', 'Gatineau'],
|
| 100 |
['moncton.finances@iccameriques.org', 'Moncton'],
|
| 101 |
['chibougamau.finances@iccameriques.org', 'Chibougamau'],
|
| 102 |
+
['trois-rivieres.finances@iccameriques.org', 'Trois-Rivieres'],
|
| 103 |
['sherbrooke.finances@iccameriques.org', 'Sherbrooke'],
|
| 104 |
['toronto.finances@iccameriques.org', 'Toronto'],
|
| 105 |
+
['quebec.finances@iccameriques.org', 'Quebec'],
|
| 106 |
['lvl.finances@iccameriques.org', 'Laval'],
|
| 107 |
['lgl.finances@iccameriques.org', 'Longueuil'],
|
| 108 |
['victoriaville.finances@iccameriques.org', 'Victoriaville'],
|
| 109 |
['valleyfield.finances@iccameriques.org', 'Valleyfield'],
|
| 110 |
+
['finances.rdl@iccameriques.org', 'Riviere-du-Loup'],
|
| 111 |
['ottawa.finances@iccameriques.org', 'Ottawa'],
|
| 112 |
['kingston.finances@iccameriques.org', 'Kingston'],
|
| 113 |
['hamilton.finances@iccameriques.org', 'Hamilton'],
|
packages/server/src/routes/transactions.ts
CHANGED
|
@@ -93,6 +93,7 @@ router.get('/export', requireAuth, async (req: AuthRequest, res) => {
|
|
| 93 |
const rows = await db.select({
|
| 94 |
date: transactions.date,
|
| 95 |
sender: transactions.sender,
|
|
|
|
| 96 |
amount: transactions.amount,
|
| 97 |
currency: transactions.currency,
|
| 98 |
reference: transactions.reference,
|
|
|
|
| 93 |
const rows = await db.select({
|
| 94 |
date: transactions.date,
|
| 95 |
sender: transactions.sender,
|
| 96 |
+
envelopeNumber: transactions.envelopeNumber,
|
| 97 |
amount: transactions.amount,
|
| 98 |
currency: transactions.currency,
|
| 99 |
reference: transactions.reference,
|
packages/shared/src/constants/branches.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
export const BRANCH_MAPPING: Record<string, string> = {
|
| 2 |
-
'finances@iccameriques.org': '
|
| 3 |
-
'montreal.finances@iccameriques.org': '
|
| 4 |
-
'quebec.finances@iccameriques.org': '
|
| 5 |
-
'troisrivieres.finances@iccameriques.org': 'Trois-
|
| 6 |
-
'trois-rivieres.finances@iccameriques.org': 'Trois-
|
| 7 |
'sherbrooke.finances@iccameriques.org': 'Sherbrooke',
|
| 8 |
'gatineau.finances@iccameriques.org': 'Gatineau',
|
| 9 |
'ottawa.finances@iccameriques.org': 'Ottawa',
|
|
@@ -29,9 +29,9 @@ export const BRANCH_MAPPING: Record<string, string> = {
|
|
| 29 |
'lgl.finances@iccameriques.org': 'Longueuil',
|
| 30 |
'victoriaville.finances@iccameriques.org': 'Victoriaville',
|
| 31 |
'valleyfield.finances@iccameriques.org': 'Valleyfield',
|
| 32 |
-
'finances.rdl@iccameriques.org': '
|
| 33 |
'rimouski.finances@iccameriques.org': 'Rimouski',
|
| 34 |
-
'septiles.finances@iccameriques.org': 'Sept-
|
| 35 |
'saguenay.finances@iccameriques.org': 'Saguenay',
|
| 36 |
'chibougamau.finances@iccameriques.org': 'Chibougamau',
|
| 37 |
"valdor.finances@iccameriques.org": "Val-d'Or",
|
|
@@ -41,11 +41,11 @@ export const BRANCH_MAPPING: Record<string, string> = {
|
|
| 41 |
'drummondville.finances@iccameriques.org': 'Drummondville',
|
| 42 |
'granby.finances@iccameriques.org': 'Granby',
|
| 43 |
'sthyacinthe.finances@iccameriques.org': 'St-Hyacinthe',
|
| 44 |
-
'stjerome.finances@iccameriques.org': 'St-
|
| 45 |
'joliette.finances@iccameriques.org': 'Joliette',
|
| 46 |
'terrebonne.finances@iccameriques.org': 'Terrebonne',
|
| 47 |
'repentigny.finances@iccameriques.org': 'Repentigny',
|
| 48 |
-
'siege@iccameriques.org': '
|
| 49 |
'mission.finances@iccameriques.org': 'Mission',
|
| 50 |
};
|
| 51 |
|
|
|
|
| 1 |
export const BRANCH_MAPPING: Record<string, string> = {
|
| 2 |
+
'finances@iccameriques.org': 'Montreal',
|
| 3 |
+
'montreal.finances@iccameriques.org': 'Montreal',
|
| 4 |
+
'quebec.finances@iccameriques.org': 'Quebec',
|
| 5 |
+
'troisrivieres.finances@iccameriques.org': 'Trois-Rivieres',
|
| 6 |
+
'trois-rivieres.finances@iccameriques.org': 'Trois-Rivieres',
|
| 7 |
'sherbrooke.finances@iccameriques.org': 'Sherbrooke',
|
| 8 |
'gatineau.finances@iccameriques.org': 'Gatineau',
|
| 9 |
'ottawa.finances@iccameriques.org': 'Ottawa',
|
|
|
|
| 29 |
'lgl.finances@iccameriques.org': 'Longueuil',
|
| 30 |
'victoriaville.finances@iccameriques.org': 'Victoriaville',
|
| 31 |
'valleyfield.finances@iccameriques.org': 'Valleyfield',
|
| 32 |
+
'finances.rdl@iccameriques.org': 'Riviere-du-Loup',
|
| 33 |
'rimouski.finances@iccameriques.org': 'Rimouski',
|
| 34 |
+
'septiles.finances@iccameriques.org': 'Sept-Iles',
|
| 35 |
'saguenay.finances@iccameriques.org': 'Saguenay',
|
| 36 |
'chibougamau.finances@iccameriques.org': 'Chibougamau',
|
| 37 |
"valdor.finances@iccameriques.org": "Val-d'Or",
|
|
|
|
| 41 |
'drummondville.finances@iccameriques.org': 'Drummondville',
|
| 42 |
'granby.finances@iccameriques.org': 'Granby',
|
| 43 |
'sthyacinthe.finances@iccameriques.org': 'St-Hyacinthe',
|
| 44 |
+
'stjerome.finances@iccameriques.org': 'St-Jerome',
|
| 45 |
'joliette.finances@iccameriques.org': 'Joliette',
|
| 46 |
'terrebonne.finances@iccameriques.org': 'Terrebonne',
|
| 47 |
'repentigny.finances@iccameriques.org': 'Repentigny',
|
| 48 |
+
'siege@iccameriques.org': 'Siege',
|
| 49 |
'mission.finances@iccameriques.org': 'Mission',
|
| 50 |
};
|
| 51 |
|
packages/web/src/components/dashboard/TransactionTable.tsx
CHANGED
|
@@ -148,6 +148,7 @@ export default function TransactionTable() {
|
|
| 148 |
const wsData = rows.map((tx: any) => ({
|
| 149 |
[t('table.date')]: tx.date ? new Date(tx.date).toLocaleDateString('fr-CA', { timeZone: 'America/Toronto' }) : '',
|
| 150 |
[t('table.sender')]: tx.sender || '',
|
|
|
|
| 151 |
[t('table.amount')]: tx.amount,
|
| 152 |
'Currency': tx.currency || 'CAD',
|
| 153 |
[t('table.reference')]: tx.reference || '',
|
|
@@ -162,6 +163,7 @@ export default function TransactionTable() {
|
|
| 162 |
ws['!cols'] = [
|
| 163 |
{ wch: 12 }, // Date
|
| 164 |
{ wch: 25 }, // Sender
|
|
|
|
| 165 |
{ wch: 12 }, // Amount
|
| 166 |
{ wch: 6 }, // Currency
|
| 167 |
{ wch: 20 }, // Reference
|
|
|
|
| 148 |
const wsData = rows.map((tx: any) => ({
|
| 149 |
[t('table.date')]: tx.date ? new Date(tx.date).toLocaleDateString('fr-CA', { timeZone: 'America/Toronto' }) : '',
|
| 150 |
[t('table.sender')]: tx.sender || '',
|
| 151 |
+
[t('table.envelopeNumber')]: tx.envelopeNumber || '',
|
| 152 |
[t('table.amount')]: tx.amount,
|
| 153 |
'Currency': tx.currency || 'CAD',
|
| 154 |
[t('table.reference')]: tx.reference || '',
|
|
|
|
| 163 |
ws['!cols'] = [
|
| 164 |
{ wch: 12 }, // Date
|
| 165 |
{ wch: 25 }, // Sender
|
| 166 |
+
{ wch: 16 }, // Envelope Number
|
| 167 |
{ wch: 12 }, // Amount
|
| 168 |
{ wch: 6 }, // Currency
|
| 169 |
{ wch: 20 }, // Reference
|
packages/web/src/components/reports/ExportSection.tsx
CHANGED
|
@@ -44,6 +44,7 @@ export default function ExportSection() {
|
|
| 44 |
const wsData = rows.map((tx: any) => ({
|
| 45 |
[t('table.date')]: tx.date ? new Date(tx.date).toLocaleDateString('fr-CA', { timeZone: 'America/Toronto' }) : '',
|
| 46 |
[t('table.sender')]: tx.sender || '',
|
|
|
|
| 47 |
[t('table.amount')]: tx.amount,
|
| 48 |
'Currency': tx.currency || 'CAD',
|
| 49 |
[t('table.reference')]: tx.reference || '',
|
|
@@ -56,10 +57,10 @@ export default function ExportSection() {
|
|
| 56 |
setActiveDownload({ fileName, progress: 80, processedFiles: rows.length, totalFiles: rows.length });
|
| 57 |
|
| 58 |
const ws = XLSX.utils.json_to_sheet(wsData);
|
| 59 |
-
// Fixed column widths — avoids slow O(rows*cols) scan
|
| 60 |
ws['!cols'] = [
|
| 61 |
{ wch: 12 }, // Date
|
| 62 |
{ wch: 25 }, // Sender
|
|
|
|
| 63 |
{ wch: 12 }, // Amount
|
| 64 |
{ wch: 6 }, // Currency
|
| 65 |
{ wch: 20 }, // Reference
|
|
|
|
| 44 |
const wsData = rows.map((tx: any) => ({
|
| 45 |
[t('table.date')]: tx.date ? new Date(tx.date).toLocaleDateString('fr-CA', { timeZone: 'America/Toronto' }) : '',
|
| 46 |
[t('table.sender')]: tx.sender || '',
|
| 47 |
+
[t('table.envelopeNumber')]: tx.envelopeNumber || '',
|
| 48 |
[t('table.amount')]: tx.amount,
|
| 49 |
'Currency': tx.currency || 'CAD',
|
| 50 |
[t('table.reference')]: tx.reference || '',
|
|
|
|
| 57 |
setActiveDownload({ fileName, progress: 80, processedFiles: rows.length, totalFiles: rows.length });
|
| 58 |
|
| 59 |
const ws = XLSX.utils.json_to_sheet(wsData);
|
|
|
|
| 60 |
ws['!cols'] = [
|
| 61 |
{ wch: 12 }, // Date
|
| 62 |
{ wch: 25 }, // Sender
|
| 63 |
+
{ wch: 16 }, // Envelope Number
|
| 64 |
{ wch: 12 }, // Amount
|
| 65 |
{ wch: 6 }, // Currency
|
| 66 |
{ wch: 20 }, // Reference
|