diff --git a/src/core/models/schedules.py b/src/core/models/schedules.py index ca3ad8650844051a387f6f3387256866206e0faf..e9245a6fff58b973224c68ca2defedf3cc27e73f 100644 --- a/src/core/models/schedules.py +++ b/src/core/models/schedules.py @@ -839,15 +839,9 @@ class ScheduleSourceImport(models.Model): # create list of unique errors for summary msgs = list({x['message'].split('\n')[0] for x in errors}) - stats = ( - ', '.join( - (t + '=' + str(sum(1 for x in activity if x['action'] == t))) - for t in ['added', 'changed', 'seen', 'deleted', 'missing', 'error', 'skipped'] - ) - + ' \n' - + ' \n'.join(msgs) - ) - self.summary = f"{data.get('version') or ''}\nDONE: {stats}"[:200] + stats = {t: sum(1 for x in activity if x['action'] == t) for t in ['added', 'changed', 'seen', 'deleted', 'missing', 'error', 'skipped']} + stats_str = ', '.join([f'{v}={k}' for (k, v) in stats.items() if v]) + ' \n' + ' \n'.join(msgs) + self.summary = f"{data.get('version') or ''}\nDONE: {stats_str}"[:200] # add debug option to disable abort feature, as it might hide the actual error messages if len(errors) > len(activity) / 2 and self.import_configuration.get('debug') is not True: