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

New "Promotion" Mode #59

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

New "Promotion" Mode #59

wants to merge 3 commits into from

Conversation

halelidan
Copy link
Collaborator

  • Implement config switching based on promotion flag
  • Modify image services to use CONFIG or PROMOTION_CONFIG as appropriate
  • Skip asset deletion in promotion mode for ImageExtensionService
  • Add new ImagePauseService for pausing uploaded assets

src/config.ts Outdated
}

export const sheet =
SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Config')!;
const DEFAULT_CONFIG = {
export const promotionSheet =
SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Promotion_Config')!;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can make the setup even more flexible if you use in the main config sheet Promotion Mode Config = <PROMO_CONFIG_SHEET_NAME> (if empty it is equal to Is Promotion Mode = no) instead of Is Promotion Mode = yes|no. In this way you can have several configs for e.g. different promo seasons and quickly switch them.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I totally agree! fixed in the new commit

src/config.ts Outdated
.filter(e => e[0])
.reduce((res, e) => {
return { ...res, [e[0]]: e[1] };
}, DEFAULT_CONFIG),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using the DEFAULT_CONFIG here, I would use CONFIG, in this way the promo config sheet can have only the fields that need to be overwritten (other config params will be copied from the main config).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, fixed in the new commit

@halelidan halelidan requested a review from akushnarov October 29, 2024 14:26
: {}),
} ?? CONFIG;

export const inPromotionMode = (): boolean => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this need to be a function and not a constant?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing to change here, just curious

src/image-pause-service.ts Outdated Show resolved Hide resolved
src/image-pause-service.ts Outdated Show resolved Hide resolved
src/menu.ts Outdated Show resolved Hide resolved
@gps-readability-bot
Copy link

Still need readability approvals from:

3 similar comments
@gps-readability-bot
Copy link

Still need readability approvals from:

@gps-readability-bot
Copy link

Still need readability approvals from:

@gps-readability-bot
Copy link

Still need readability approvals from:

- Implement config switching based on promotion flag
- Modify image services to use CONFIG or PROMOTION_CONFIG as appropriate
- Skip asset deletion in promotion mode for ImageExtensionService
- Add new ImagePauseService for pausing uploaded assets
- Replace yes/no flag with configurable sheet name
- Make promotion config inherit from main config
- Add helper function for promotion mode checks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants