feat(bulkProcessing): near limit alert DEV-1399#7232
Conversation
…dev-1399-near-limit-alert
|
@greptile-apps review please |
|
|
@greptile-apps review again |
| {t('Start Transcription')} | ||
| </ButtonNew> | ||
| )} | ||
| {hasExceededLimit && ( |
There was a problem hiding this comment.
Should we change the logic here to also display this button if the user is requesting more than their ASR allowance? Or say something like "your selection will surpass the amount of ASR time you have left, please purchase an add-on or select fewer submissions"?
There was a problem hiding this comment.
There was a problem hiding this comment.
Same as the BulkTranscriptionModal. Should we remove this comment and update the logic here?
There was a problem hiding this comment.
I removed both legacy alerts, since BulkProcessingAlerts are handling those cases already :)
|
|
||
| const remainingAmount = balance.balance_value | ||
|
|
||
| if (remainingAmount <= 0 || remainingAmount >= nearLimitRequiredAmount) { |
There was a problem hiding this comment.
I don't think I'm reading this right. Why do we return an error if the user's remaining amount of time is greater than the audio duration time?
There was a problem hiding this comment.
This is actually correct, I have added a comment to explain it :)
There was a problem hiding this comment.
I will also simplify the code to not return that weird createInactiveResult but instead simple null
| selectedRegion?: string | ||
| actionType: BulkActionType | ||
| /** Required amount for full job in base units: seconds (transcription) or characters (translation). */ | ||
| nearLimitRequiredAmount?: number |
There was a problem hiding this comment.
I think we should rename this variable, at least it's a bit confusing for me. When we say "required amount for full job" we mean the return of the duration form useCalculateAudioDuration right? I think "near limit" adds some ambiguity when this is the actual duration number
| assetUid: props.assetUid, | ||
| }) | ||
|
|
||
| const nearLimitRequiredSeconds = |
There was a problem hiding this comment.
Same here about the variable name, I think it reads better if we drop the "near limit" prefix
| assetUid: props.assetUid, | ||
| }) | ||
|
|
||
| const nearLimitRequiredSeconds = |
There was a problem hiding this comment.
From what I understand in the preview steps, we want this number to be big to simulate not having enough ASR minutes left(?) I tried setting this to very large numbers (1,000,000,000,000) and Number.POSITIVE_INFINITY and the alert still doesn't show.
|
@copilot resolve the merge conflicts in this pull request |
…bed-alert' into leszek/dev-1399-near-limit-alert # Conflicts: # jsapp/js/components/submissions/BulkProcessingModals/alerts/alertEvaluators.tests.ts
# Conflicts: # jsapp/js/components/submissions/BulkProcessingModals/BulkTranscriptionModal/BulkTranscriptionModal.tsx # jsapp/js/components/submissions/BulkProcessingModals/alerts/BulkProcessingAlerts.stories.tsx

🗒️ Checklist
#Support Docs Updates, if any<type>(<scope>)<!>: <title> DEV-1234Front endand/orBack endorworkflow📣 Summary
Adds a new Near Limit error alert to bulk transcription and bulk translation modals, shown when a user still has quota left but not enough to process all selected submissions.
💭 Notes
Changes here:
👀 Preview steps
const nearLimitRequiredSeconds) to something liketotalSelectedAudioDuration * 1000.nearLimitRequiredCharacters * 1000.