diff --git a/modules/features/commcoach/serviceCommcoachGamification.py b/modules/features/commcoach/serviceCommcoachGamification.py index 180706de..badf9761 100644 --- a/modules/features/commcoach/serviceCommcoachGamification.py +++ b/modules/features/commcoach/serviceCommcoachGamification.py @@ -150,7 +150,7 @@ async def checkAndAwardBadges(interface, userId: str, mandateId: str, instanceId except Exception: allContexts = [] - completedTasks = interface.getCompletedTaskCount(userId) if hasattr(interface, 'getCompletedTaskCount') else 0 + completedTasks = interface.getCompletedTaskCount(userId, instanceId) if hasattr(interface, 'getCompletedTaskCount') else 0 if completedTasks >= 10: badgesToCheck.append(("task_completer", True)) diff --git a/modules/features/trustee/routeFeatureTrustee.py b/modules/features/trustee/routeFeatureTrustee.py index 0f2efd02..c4c96017 100644 --- a/modules/features/trustee/routeFeatureTrustee.py +++ b/modules/features/trustee/routeFeatureTrustee.py @@ -1563,7 +1563,13 @@ async def sync_positions_to_accounting( raise HTTPException(status_code=400, detail=routeApiMsg("positionIds required")) results = await bridge.pushBatchToAccounting(instanceId, positionIds) - failed = [r for r in results if not r.success] + skipped = [r for r in results if not r.success and r.errorMessage and "already synced" in r.errorMessage] + failed = [r for r in results if not r.success and r not in skipped] + if skipped: + logger.info( + "Accounting sync: %s position(s) already synced, skipped", + len(skipped), + ) if failed: logger.warning( "Accounting sync had %s failure(s): %s", @@ -1573,7 +1579,8 @@ async def sync_positions_to_accounting( return { "total": len(results), "success": sum(1 for r in results if r.success), - "errors": sum(1 for r in results if not r.success), + "skipped": len(skipped), + "errors": len(failed), "results": [r.model_dump() for r in results], }