Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PB-UOE-10137 : Fetch platform details from wrapper_profile table and move to profile level #727

Merged
merged 9 commits into from
Apr 8, 2024
15 changes: 10 additions & 5 deletions modules/pubmatic/openwrap/database/mysql/partner_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,18 @@ import (
// return the list of active server side header bidding partners
// with their configurations at publisher-profile-version level
func (db *mySqlDB) GetActivePartnerConfigurations(pubID, profileID int, displayVersion int) (map[int]map[string]string, error) {
versionID, displayVersionID, err := db.getVersionID(profileID, displayVersion, pubID)
versionID, displayVersionID, platform, err := db.getVersionID(profileID, displayVersion, pubID)
if err != nil {
return nil, err
}

partnerConfigMap, err := db.getActivePartnerConfigurations(versionID)
if err == nil && partnerConfigMap[-1] != nil {
partnerConfigMap[-1][models.DisplayVersionID] = strconv.Itoa(displayVersionID)
// check for SDK new UI
if platform != "" {
pm-priyanka-bagade marked this conversation as resolved.
Show resolved Hide resolved
partnerConfigMap[-1][models.PLATFORM_KEY] = platform
}
}
return partnerConfigMap, err
}
Expand Down Expand Up @@ -78,18 +82,19 @@ func (db *mySqlDB) getActivePartnerConfigurations(versionID int) (map[int]map[st
return partnerConfigMap, nil
}

func (db *mySqlDB) getVersionID(profileID, displayVersion, pubID int) (int, int, error) {
func (db *mySqlDB) getVersionID(profileID, displayVersion, pubID int) (int, int, string, error) {
var row *sql.Row
if displayVersion == 0 {
row = db.conn.QueryRow(db.cfg.Queries.LiveVersionInnerQuery, profileID, pubID)
} else {
row = db.conn.QueryRow(db.cfg.Queries.DisplayVersionInnerQuery, profileID, displayVersion, pubID)
}

var platform sql.NullString
var versionID, displayVersionIDFromDB int
err := row.Scan(&versionID, &displayVersionIDFromDB)
err := row.Scan(&versionID, &displayVersionIDFromDB, &platform)
if err != nil {
return versionID, displayVersionIDFromDB, err
return versionID, displayVersionIDFromDB, platform.String, err
}
return versionID, displayVersionIDFromDB, nil
return versionID, displayVersionIDFromDB, platform.String, nil
}
Loading
Loading