mirror of
https://github.com/Drop-OSS/drop.git
synced 2026-01-31 15:37:09 +01:00
Combined fixes (#116)
* fix: missing CheckIcon import in LanguageSelector * fix: #114 and error handling * fix: #97 * fix: lint * feat: #104 * fix: #72
This commit is contained in:
@@ -39,7 +39,7 @@ export class ObjectTransactionalHandler {
|
||||
if (!transaction) return;
|
||||
|
||||
let progress = 0;
|
||||
const increment = (1 / transaction.size) * 100;
|
||||
const increment = 100 / transaction.size;
|
||||
|
||||
for (const [id, data] of transaction) {
|
||||
if (typeof data === "string") {
|
||||
|
||||
@@ -374,8 +374,15 @@ export function wrapTaskContext(
|
||||
): TaskRunContext {
|
||||
return {
|
||||
progress(progress) {
|
||||
const scalar = 100 / (options.max - options.min);
|
||||
const adjustedProgress = progress * scalar + options.min;
|
||||
if (progress > 100 || progress < 0) {
|
||||
console.warn("[wrapTaskContext] progress must be between 0 and 100");
|
||||
}
|
||||
|
||||
// I was too tired to figure this out
|
||||
// https://stackoverflow.com/a/929107
|
||||
const oldRange = 100;
|
||||
const newRange = options.max - options.min;
|
||||
const adjustedProgress = (progress * newRange) / oldRange + options.min;
|
||||
return context.progress(adjustedProgress);
|
||||
},
|
||||
log(message) {
|
||||
|
||||
Reference in New Issue
Block a user