From 26f90d8fc854954506f59504e1a76c8f30d2d979 Mon Sep 17 00:00:00 2001
From: Robin Goodall <rjg21@cam.ac.uk>
Date: Tue, 29 Aug 2023 09:29:01 +0100
Subject: [PATCH] fix: logging when licenses run out

---
 CHANGELOG.md              | 6 ++++++
 gsuitesync/sync/update.py | 2 +-
 setup.py                  | 2 +-
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 59f4b9f..f984c02 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 
+## [1.0.1] - 2023-08-29
+
+### Fixed
+
+- Error handling when there are insufficient licences to assign
+
 ## [1.0.0] - 2023-06-22
 
 ### Changed
diff --git a/gsuitesync/sync/update.py b/gsuitesync/sync/update.py
index 57b0703..7e84b32 100644
--- a/gsuitesync/sync/update.py
+++ b/gsuitesync/sync/update.py
@@ -179,7 +179,7 @@ class GAPIUpdater(ConfigurationStateConsumer):
             if skuId is None:
                 LOG.warning(
                     "No more available licences to allocate missing licenses for %d user(s)",
-                    len(self.state.licences_to_add - index),
+                    len(self.state.licences_to_add) - index,
                 )
                 return
             LOG.info('Adding licence to user: "%s" (%s)', uid, skuId)
diff --git a/setup.py b/setup.py
index 4ef1d12..8b94bcb 100644
--- a/setup.py
+++ b/setup.py
@@ -16,7 +16,7 @@ def load_requirements():
 
 setup(
     name="gsuitesync",
-    version="1.0.0",
+    version="1.0.1",
     packages=find_packages(),
     install_requires=load_requirements(),
     entry_points={
-- 
GitLab