From c0a97854e09b9c900a2f21d83afad63326fb1f46 Mon Sep 17 00:00:00 2001 From: laxman h Date: Mon, 30 Mar 2026 20:09:40 +0530 Subject: [PATCH] district mpping isue resolved after table changes --- restore-full-questionnaire.ts | 62 ++++++++++++++++---------------- src/database/models/State.ts | 2 +- src/scripts/seedQuestionnaire.ts | 62 ++++++++++++++++---------------- 3 files changed, 63 insertions(+), 63 deletions(-) diff --git a/restore-full-questionnaire.ts b/restore-full-questionnaire.ts index 0a35b52..6405a48 100644 --- a/restore-full-questionnaire.ts +++ b/restore-full-questionnaire.ts @@ -36,26 +36,26 @@ async function restoreQuestionnaire() { text: "Educational Qualification", type: "radio", section: "Profile & Background", - weight: 15, + weight: 5, order: 8, options: [ - { text: "Under Graduate", score: 5 }, - { text: "Graduate", score: 10 }, - { text: "Post Graduate", score: 15 } + { text: "Under Graduate", score: 2 }, + { text: "Graduate", score: 3 }, + { text: "Post Graduate", score: 5 } ] }, { text: "What is your Personal Networth", type: "select", section: "Financials", - weight: 25, + weight: 15, order: 9, options: [ - { text: "Less than 2 Crores", score: 5 }, - { text: "Between 2 - 5 Crores", score: 10 }, - { text: "Between 5 - 10 Crores", score: 15 }, - { text: "Between 10 - 15 Crores", score: 20 }, - { text: "Greater than 15 Crores", score: 25 } + { text: "Less than 2 Crores", score: 3 }, + { text: "Between 2 - 5 Crores", score: 6 }, + { text: "Between 5 - 10 Crores", score: 9 }, + { text: "Between 10 - 15 Crores", score: 12 }, + { text: "Greater than 15 Crores", score: 15 } ] }, { @@ -75,12 +75,12 @@ async function restoreQuestionnaire() { text: "Why do you want to partner with Royal Enfield?", type: "radio", section: "Strategy", - weight: 10, + weight: 5, order: 12, options: [ - { text: "Absence of Royal Enfield in the particular location and presence of opportunity", score: 5 }, - { text: "Passionate about the brand", score: 5 }, - { text: "Experience in the automobile business and would like to expand with Royal Enfield", score: 10 } + { text: "Absence of Royal Enfield in the particular location and presence of opportunity", score: 2 }, + { text: "Passionate about the brand", score: 2 }, + { text: "Experience in the automobile business and would like to expand with Royal Enfield", score: 5 } ] }, { @@ -112,13 +112,13 @@ async function restoreQuestionnaire() { text: "Proposed Firm Type", type: "radio", section: "Business Structure", - weight: 10, + weight: 5, order: 15, options: [ - { text: "Proprietorship", score: 5 }, - { text: "Partnership", score: 5 }, - { text: "Limited Liability partnership", score: 5 }, - { text: "Private Limited Company", score: 10 } + { text: "Proprietorship", score: 3 }, + { text: "Partnership", score: 3 }, + { text: "Limited Liability partnership", score: 3 }, + { text: "Private Limited Company", score: 5 } ] }, { @@ -161,11 +161,11 @@ async function restoreQuestionnaire() { text: "What are your plans of expansion with RE?", type: "radio", section: "Strategy", - weight: 10, + weight: 5, order: 19, options: [ - { text: "Willing to expand with the help of partners", score: 5 }, - { text: "Willing to expand by myself", score: 10 }, + { text: "Willing to expand with the help of partners", score: 2 }, + { text: "Willing to expand by myself", score: 5 }, { text: "No plans for expansion", score: 0 } ] }, @@ -173,23 +173,23 @@ async function restoreQuestionnaire() { text: "Will you be expanding to any other automobile OEM in the future?", type: "radio", section: "Strategy", - weight: 5, + weight: 4, order: 20, options: [ { text: "Yes", score: 0 }, - { text: "No", score: 5 } + { text: "No", score: 4 } ] }, { text: "Do you own a Royal Enfield ?", type: "radio", section: "Brand Loyalty", - weight: 5, + weight: 3, order: 21, options: [ - { text: "Yes, it is registered in my name", score: 5 }, - { text: "Yes, it is registered to my immediate family member", score: 3 }, - { text: "Not at the moment but owned it earlier", score: 2 }, + { text: "Yes, it is registered in my name", score: 3 }, + { text: "Yes, it is registered to my immediate family member", score: 2 }, + { text: "Not at the moment but owned it earlier", score: 1 }, { text: "No", score: 0 } ] }, @@ -197,11 +197,11 @@ async function restoreQuestionnaire() { text: "Do you go for long leisure rides", type: "radio", section: "Brand Loyalty", - weight: 5, + weight: 3, order: 22, options: [ - { text: "Yes, with the Royal Enfield riders", score: 5 }, - { text: "Yes, with other brands", score: 3 }, + { text: "Yes, with the Royal Enfield riders", score: 3 }, + { text: "Yes, with other brands", score: 2 }, { text: "No", score: 0 } ] }, diff --git a/src/database/models/State.ts b/src/database/models/State.ts index b6da721..4f142ed 100644 --- a/src/database/models/State.ts +++ b/src/database/models/State.ts @@ -35,7 +35,7 @@ export default (sequelize: Sequelize) => { (State as any).associate = (models: any) => { State.belongsTo(models.Zone, { foreignKey: 'zoneId', as: 'zone' }); - State.hasMany(models.Location, { foreignKey: 'stateId', as: 'districts' }); + State.hasMany(models.District, { foreignKey: 'stateId', as: 'districts' }); }; return State; diff --git a/src/scripts/seedQuestionnaire.ts b/src/scripts/seedQuestionnaire.ts index 1c87be0..78cef92 100644 --- a/src/scripts/seedQuestionnaire.ts +++ b/src/scripts/seedQuestionnaire.ts @@ -135,11 +135,11 @@ const seedQuestionnaire = async () => { type: "radio", section: "Profile & Background", options: [ - { text: "Under Graduate", score: 5 }, - { text: "Graduate", score: 10 }, - { text: "Post Graduate", score: 15 } + { text: "Under Graduate", score: 2 }, + { text: "Graduate", score: 3 }, + { text: "Post Graduate", score: 5 } ], - weight: 15, // Max possible + weight: 5, // Max possible order: 8 }, { @@ -147,13 +147,13 @@ const seedQuestionnaire = async () => { type: "select", section: "Financials", options: [ - { text: "Less than 2 Crores", score: 5 }, - { text: "Between 2 - 5 Crores", score: 10 }, - { text: "Between 5 - 10 Crores", score: 15 }, - { text: "Between 10 - 15 Crores", score: 20 }, - { text: "Greater than 15 Crores", score: 25 } + { text: "Less than 2 Crores", score: 3 }, + { text: "Between 2 - 5 Crores", score: 6 }, + { text: "Between 5 - 10 Crores", score: 9 }, + { text: "Between 10 - 15 Crores", score: 12 }, + { text: "Greater than 15 Crores", score: 15 } ], - weight: 25, + weight: 15, order: 9 }, { @@ -181,11 +181,11 @@ const seedQuestionnaire = async () => { type: "radio", section: "Strategy", options: [ - { text: "Absence of Royal Enfield in the particular location and presence of opportunity", score: 5 }, - { text: "Passionate about the brand", score: 5 }, - { text: "Experience in the automobile business and would like to expand with Royal Enfield", score: 10 } + { text: "Absence of Royal Enfield in the particular location and presence of opportunity", score: 2 }, + { text: "Passionate about the brand", score: 2 }, + { text: "Experience in the automobile business and would like to expand with Royal Enfield", score: 5 } ], - weight: 10, + weight: 5, order: 12 }, { @@ -218,12 +218,12 @@ const seedQuestionnaire = async () => { type: "radio", section: "Business Structure", options: [ - { text: "Proprietorship", score: 5 }, - { text: "Partnership", score: 5 }, - { text: "Limited Liability partnership", score: 5 }, - { text: "Private Limited Company", score: 10 } + { text: "Proprietorship", score: 3 }, + { text: "Partnership", score: 3 }, + { text: "Limited Liability partnership", score: 3 }, + { text: "Private Limited Company", score: 5 } ], - weight: 10, + weight: 5, order: 15 }, { @@ -267,11 +267,11 @@ const seedQuestionnaire = async () => { type: "radio", section: "Strategy", options: [ - { text: "Willing to expand with the help of partners", score: 5 }, - { text: "Willing to expand by myself", score: 10 }, + { text: "Willing to expand with the help of partners", score: 2 }, + { text: "Willing to expand by myself", score: 5 }, { text: "No plans for expansion", score: 0 } ], - weight: 10, + weight: 5, order: 19 }, { @@ -280,9 +280,9 @@ const seedQuestionnaire = async () => { section: "Strategy", options: [ { text: "Yes", score: 0 }, - { text: "No", score: 5 } + { text: "No", score: 4 } ], - weight: 5, + weight: 4, order: 20 }, { @@ -290,12 +290,12 @@ const seedQuestionnaire = async () => { type: "radio", section: "Brand Loyalty", options: [ - { text: "Yes, it is registered in my name", score: 5 }, - { text: "Yes, it is registered to my immediate family member", score: 3 }, - { text: "Not at the moment but owned it earlier", score: 2 }, + { text: "Yes, it is registered in my name", score: 3 }, + { text: "Yes, it is registered to my immediate family member", score: 2 }, + { text: "Not at the moment but owned it earlier", score: 1 }, { text: "No", score: 0 } ], - weight: 5, + weight: 3, order: 21 }, { @@ -303,11 +303,11 @@ const seedQuestionnaire = async () => { type: "radio", section: "Brand Loyalty", options: [ - { text: "Yes, with the Royal Enfield riders", score: 5 }, - { text: "Yes, with other brands", score: 3 }, + { text: "Yes, with the Royal Enfield riders", score: 3 }, + { text: "Yes, with other brands", score: 2 }, { text: "No", score: 0 } ], - weight: 5, + weight: 3, order: 22 }, {