diff --git a/authentication/auth.go b/authentication/auth.go index 2e39f2fc..c8cd3ac7 100644 --- a/authentication/auth.go +++ b/authentication/auth.go @@ -143,8 +143,7 @@ func generateClaims(claimValues map[string][]string, launcherSchema surveys.Laun claims[key] = value } } - var isCensusTestSchema = len(claimValues["schema_name"]) > 0 && claimValues["schema_name"][0] == "test_individual_response" - if !isCensusTestSchema && (len(claimValues["survey"]) > 0 || len(claimValues["form_type"]) > 0 || len(claimValues["region_code"]) > 0) { + if len(claimValues["form_type"]) > 0 && len(claimValues["eq_id"]) > 0 { log.Println("Deleting schema name from claims") delete(claims, "schema_name") } else { @@ -389,25 +388,15 @@ func GenerateTokenFromDefaults(surveyURL string, accountServiceURL string, accou return token, "" } -// TransformSchemaParamsToName Returns a schema name from census schema parameters -// This function can be removed after census claims are removed. +// TransformSchemaParamsToName Returns a schema name from business schema parameters func TransformSchemaParamsToName(postValues url.Values) string { if postValues.Get("schema_name") != "" { return postValues["schema_name"][0] } - formTypeMap := map[string]string{ - "H": "household", - "I": "individual", - "C": "communal_establishment", - } - - regionCode := strings.Replace(postValues.Get("region_code"), "-", "_", -1) - regionCode = strings.ToLower(regionCode) - - survey := postValues.Get("survey") - formType := formTypeMap[postValues.Get("form_type")] - schemaName := fmt.Sprintf("%s_%s_%s", survey, formType, regionCode) + eqId := postValues.Get("eq_id") + formType := postValues.Get("form_type") + schemaName := fmt.Sprintf("%s_%s", eqId, formType) return schemaName } diff --git a/surveys/surveys.go b/surveys/surveys.go index 9656b490..0ff4e5e8 100644 --- a/surveys/surveys.go +++ b/surveys/surveys.go @@ -24,8 +24,6 @@ type LauncherSchema struct { // LauncherSchemas is a separation of Test and Live schemas type LauncherSchemas struct { Business []LauncherSchema - CCS []LauncherSchema - Census []LauncherSchema Social []LauncherSchema Test []LauncherSchema Other []LauncherSchema @@ -63,13 +61,9 @@ func GetAvailableSchemas() LauncherSchemas { for _, launcherSchema := range runnerSchemas { if strings.HasPrefix(launcherSchema.Name, "test_") { schemaList.Test = append(schemaList.Test, launcherSchema) - } else if strings.HasPrefix(launcherSchema.Name, "census_") { - schemaList.Census = append(schemaList.Census, launcherSchema) - } else if strings.HasPrefix(launcherSchema.Name, "lms_") { + } else if strings.HasPrefix(launcherSchema.Name, "lms_") { schemaList.Social = append(schemaList.Social, launcherSchema) - } else if strings.HasPrefix(launcherSchema.Name, "ccs_") { - schemaList.CCS = append(schemaList.CCS, launcherSchema) - } else { + } else { schemaList.Business = append(schemaList.Business, launcherSchema) } } @@ -77,10 +71,8 @@ func GetAvailableSchemas() LauncherSchemas { schemaList.Other = getAvailableSchemasFromRegister() sort.Sort(ByFilename(schemaList.Business)) - sort.Sort(ByFilename(schemaList.Census)) sort.Sort(ByFilename(schemaList.Social)) sort.Sort(ByFilename(schemaList.Test)) - sort.Sort(ByFilename(schemaList.CCS)) return schemaList } @@ -183,16 +175,6 @@ func FindSurveyByName(name string) LauncherSchema { return survey } } - for _, survey := range availableSchemas.CCS { - if survey.Name == name { - return survey - } - } - for _, survey := range availableSchemas.Census { - if survey.Name == name { - return survey - } - } for _, survey := range availableSchemas.Social { if survey.Name == name { return survey diff --git a/templates/launch.html b/templates/launch.html index 126a239b..b294ba1c 100644 --- a/templates/launch.html +++ b/templates/launch.html @@ -15,16 +15,6 @@