@zodic/shared 0.0.187 → 0.0.189
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/durable/ConceptNameDO.ts +28 -10
- package/package.json +1 -1
|
@@ -85,26 +85,44 @@ export class ConceptNameDO {
|
|
|
85
85
|
ratePerMinute: number;
|
|
86
86
|
estimatedTimeMinutes: number | 'N/A';
|
|
87
87
|
}> {
|
|
88
|
+
console.log(`📡 Fetching progress...`);
|
|
89
|
+
|
|
90
|
+
// 🔥 Fetch latest names directly from storage
|
|
91
|
+
const storedNames = await this.state.storage.get<{ 'en-us': string[]; 'pt-br': string[] }>('names');
|
|
92
|
+
if (storedNames) {
|
|
93
|
+
this.names = storedNames;
|
|
94
|
+
} else {
|
|
95
|
+
this.names = { 'en-us': [], 'pt-br': [] };
|
|
96
|
+
}
|
|
97
|
+
|
|
88
98
|
await this.loadCount();
|
|
89
99
|
await this.loadTimestamps();
|
|
90
100
|
await this.loadLastIndex(); // ✅ Ensure latest lastIndex is fetched
|
|
91
|
-
|
|
101
|
+
|
|
102
|
+
console.log(`🔍 Current stored names (DO): ${JSON.stringify(this.names)}`);
|
|
103
|
+
|
|
92
104
|
const now = Date.now();
|
|
93
105
|
const oneMinuteAgo = now - 60 * 1000;
|
|
94
|
-
|
|
106
|
+
|
|
95
107
|
const recentTimestamps = this.timestamps.filter((ts) => ts >= oneMinuteAgo);
|
|
96
108
|
const ratePerMinute = recentTimestamps.length;
|
|
97
|
-
|
|
98
|
-
|
|
109
|
+
|
|
110
|
+
// 🔥 Only count the `en-us` names to reflect progress properly
|
|
111
|
+
const enUsCount = Array.isArray(this.names['en-us']) ? this.names['en-us'].length : 0;
|
|
112
|
+
|
|
113
|
+
console.log(
|
|
114
|
+
`🛠️ Debugging Progress: count=${this.count}, en-us=${enUsCount}, lastIndex=${this.lastIndex}`
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
const remainingNames = ConceptNameDO.TOTAL_NAMES - enUsCount;
|
|
99
118
|
const estimatedTimeMinutes =
|
|
100
119
|
ratePerMinute > 0 ? Math.round(remainingNames / ratePerMinute) : 'N/A';
|
|
101
|
-
|
|
120
|
+
|
|
102
121
|
return {
|
|
103
|
-
count: this.count,
|
|
104
|
-
total: ConceptNameDO.TOTAL_NAMES,
|
|
105
|
-
lastIndex: this.lastIndex,
|
|
106
|
-
progress:
|
|
107
|
-
((this.count / ConceptNameDO.TOTAL_NAMES) * 100).toFixed(2) + '%',
|
|
122
|
+
count: this.count, // ✅ Keep full count (en-us + pt-br)
|
|
123
|
+
total: ConceptNameDO.TOTAL_NAMES, // ✅ Base progress on 1728
|
|
124
|
+
lastIndex: this.lastIndex,
|
|
125
|
+
progress: ((enUsCount / ConceptNameDO.TOTAL_NAMES) * 100).toFixed(2) + '%', // ✅ Use only en-us count
|
|
108
126
|
ratePerMinute,
|
|
109
127
|
estimatedTimeMinutes,
|
|
110
128
|
};
|