@xuda.io/account_module 1.2.2066 → 1.2.2068

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.
Files changed (2) hide show
  1. package/index.mjs +6 -1
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -2951,7 +2951,12 @@ export const get_account_profile_info = async function (uid, contact_profile_doc
2951
2951
  debugger;
2952
2952
  const usage_ret = await get_account_ai_usage({ uid });
2953
2953
  doc.max_credits = usage_ret?.data?.credits.total / user_account_profiles.length;
2954
- doc.used_credits = usage_ret?.data?.usage?.profile?.[doc._id] || 0;
2954
+ doc.used_credits = 0;
2955
+ for (const [user, amount] of Object.entries(usage_ret?.data?.usage?.profile?.[doc._id] || {})) {
2956
+ doc.used_credits += amount;
2957
+ }
2958
+
2959
+ // doc.used_credits = usage_ret?.data?.usage?.profile?.[doc._id] || 0;
2955
2960
 
2956
2961
  if (doc.shared_from_uid) {
2957
2962
  doc.max_credits = doc.max_credits / doc.members.length;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.2066",
3
+ "version": "1.2.2068",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {