Skip to content

Batch updates can't be applied to partner_genome under certain conditions #118

@anandaroop

Description

@anandaroop

Original Slack report: https://artsy.slack.com/archives/C52PH2UCA/p1498156643769406

Just wanted to flesh this issue out here, so we can discuss and decide whether/how to proceed.

@reganartsy noticed that some batch gene removals didn't apply. In the example given:

  • the gene being removed is Knitted and Crocheted
  • there are four works for which the removal fails, all belonging to LEVEL Gallery
  • the upstream error message from Gravity is Number of commercial categories exceeds limit (thanks @jonallured)

Turns out that the update fails because the partner has churned and therefore is currently allowed 0 categories, as opposed to 3, 4, or 5 for partners on Standard, Preferred or Premium plans:

gravity:staging> pp PartnerSubscriptionPlan.order(commercial_category_limit: -1).pluck(:name, :commercial_category_limit)
=> [
 ["Premium", 5],
 ["Plus", 4],
 ["Preferred", 4],
 ["Standard", 3],
 ["Folio", 0],
 ["Folio Unlimited", 0]
]

At this point any attempt to update the partner genome for this partner's works through the API will fail due to this validation.

So it's an edge case  — updating the partner genome of work belonging to a churned partner — but I'm not sure how edgy. (Note that this could even happen to a partner who merely downgrades their subscription plan, without churning)

@jonallured I wonder if we should try an attack this at the API level, like maybe skipping this validation if the update is coming from a genomer, along the lines of what we did in the API endpoint itself.

cc @reganartsy @madeleineb @jonallured

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions