partner list

This commit is contained in:
2026-09-17 11:04:37 +05:30
parent 2f1501883b
commit 692c10e553
2 changed files with 16 additions and 11 deletions

View File

@@ -109,16 +109,18 @@ func (r *partnerRepository) GetPartners(aid, pid, uid int) ([]models.Partnerinfo
//
// `partnerinfo.applocationid` is the HOME region — CreatePartner writes
// `regions[0]` there — while partnerlocations holds every region covered.
// Today those are always the same one region, because `regionsOf` returns a
// single district and the console's form offers one ("never a set"). So
// this is not a behaviour change yet; it is the filter being applied to the
// column that is allowed to grow. The moment a partner covers two cities,
// filtering on the home region would hide them from the second, and the
// link table is the whole reason that table exists.
// Those are not the same thing, and not only in theory: partner 44,
// Xpress-Cbe-Main, has a home region of 1 and link rows for 1 AND 2, so
// filtering on the partner row hid them from every Madurai query. That is
// the case the link table exists for.
//
// DISTINCT for that same future: a partner covering three regions has three
// rows in the join and is still one partner. Only partnerinfo columns are
// selected, so there is nothing per-region for it to fail to collapse.
// DISTINCT because such a partner has one row per region in the join and is
// still one partner. Only partnerinfo columns are selected, so there is
// nothing per-region for it to fail to collapse.
//
// A caller fanning out over regions and concatenating the answers still has
// to dedupe — the same partner is legitimately in two of them. The console's
// `useAllPartners` does; it listed Xpress-Cbe-Main twice until it did.
const columns = `select distinct p.partnerid,p.applocationid,p.partnertypeid,p.partnername,
p.primarycontact,p.primaryemail,p.contactno,p.address,p.suburb,p.state,p.city,p.partnerimage
from partnerinfo p