fixing 12 gauge format

This commit is contained in:
blaisadmin
2026-03-29 22:56:21 -04:00
parent 289dbb324b
commit b8ed8b94f2
2 changed files with 20 additions and 5 deletions
+18 -3
View File
@@ -117,7 +117,7 @@ const pool = databaseUrl
password: postgresPassword, password: postgresPassword,
}); });
const defaultCalibers = ['9mm', '.22 LR', '5.56 NATO', '.308 Win', '12 Gauge - Birdshot', '12 Gauge - Buckshot', '12 Gauge - Slug', '12 Gauge Sporting', '.45 ACP']; const defaultCalibers = ['9mm', '.22 LR', '5.56 NATO', '.308 Win', '12 Gauge - Birdshot', '12 Gauge - Buckshot', '12 Gauge - Slug', '12 Gauge - Sporting', '.45 ACP'];
const firearmCategories = ['Handgun', 'Rifle', 'Shotgun', 'PCC', 'Other']; const firearmCategories = ['Handgun', 'Rifle', 'Shotgun', 'PCC', 'Other'];
const sessionHours = 24 * 7; const sessionHours = 24 * 7;
@@ -386,7 +386,7 @@ const ensureSchema = async () => {
const ensureProfileDefaults = async (profileId: string) => { const ensureProfileDefaults = async (profileId: string) => {
await pool.query( await pool.query(
`UPDATE calibers `UPDATE calibers
SET name = '12 Gauge Sporting', SET name = '12 Gauge - Sporting',
is_default = TRUE is_default = TRUE
WHERE profile_id = $1 WHERE profile_id = $1
AND name = '12 Gauge' AND name = '12 Gauge'
@@ -394,7 +394,22 @@ const ensureProfileDefaults = async (profileId: string) => {
SELECT 1 SELECT 1
FROM calibers existing FROM calibers existing
WHERE existing.profile_id = $1 WHERE existing.profile_id = $1
AND existing.name = '12 Gauge Sporting' AND existing.name = '12 Gauge - Sporting'
)`,
[profileId],
);
await pool.query(
`UPDATE calibers
SET name = '12 Gauge - Sporting',
is_default = TRUE
WHERE profile_id = $1
AND name = '12 Gauge Sporting'
AND NOT EXISTS (
SELECT 1
FROM calibers existing
WHERE existing.profile_id = $1
AND existing.name = '12 Gauge - Sporting'
)`, )`,
[profileId], [profileId],
); );
+2 -2
View File
@@ -117,8 +117,8 @@ const ammoPageSelectionKey = 'arsenal-iq-ammo-page-calibers';
const ammoPageSelectionMigrationKey = 'arsenal-iq-ammo-page-calibers-v2'; const ammoPageSelectionMigrationKey = 'arsenal-iq-ammo-page-calibers-v2';
const firearmCategories = ['Handgun', 'Rifle', 'Shotgun', 'PCC', 'Other']; const firearmCategories = ['Handgun', 'Rifle', 'Shotgun', 'PCC', 'Other'];
const allFirearmCategoriesLabel = 'All categories'; const allFirearmCategoriesLabel = 'All categories';
const defaultCaliberNames = ['9mm', '.22 LR', '5.56 NATO', '.308 Win', '12 Gauge - Birdshot', '12 Gauge - Buckshot', '12 Gauge - Slug', '12 Gauge Sporting', '.45 ACP']; const defaultCaliberNames = ['9mm', '.22 LR', '5.56 NATO', '.308 Win', '12 Gauge - Birdshot', '12 Gauge - Buckshot', '12 Gauge - Slug', '12 Gauge - Sporting', '.45 ACP'];
const boxTrackedCalibers = ['12 Gauge Sporting']; const boxTrackedCalibers = ['12 Gauge - Sporting'];
const currency = new Intl.NumberFormat('en-US', { const currency = new Intl.NumberFormat('en-US', {
style: 'currency', style: 'currency',