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

create function for calculating product progress #244

Open
META-DREAMER opened this issue Jan 13, 2023 · 0 comments
Open

create function for calculating product progress #244

META-DREAMER opened this issue Jan 13, 2023 · 0 comments
Labels

Comments

@META-DREAMER
Copy link
Contributor

Takes in product info and returns a % progress it has based on what collaborators, assets and stage the product is in. e.g. if has design files, brand, wearables, content, etc the score goes up.

CoPilot psuedocode:

export const getProductProgress = (product: ProductWithFiles) => {
  const { product_stage, clo3d_file, content, design_files, wearable_files } =
    product;

  const { name: productStageName } = product_stage;

  if (productStageName === PRODUCT_STAGES.rejected.name) {
    return 0;
  }

  if (productStageName === PRODUCT_STAGES.fulfillment_completed.name) {
    return 100;
  }

  const progress = [
    clo3d_file,
    content,
    design_files,
    wearable_files,
  ].reduce((acc, files) => {
    if (files.length > 0) {
      acc += 25;
    }
    return acc;
  }, 0);

  return progress;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant