Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hub: replace ResultGroup.defects_count with direct queries
... to fix the following Traceback: ``` Scan failed due to: Traceback (most recent call last): File "/usr/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) psycopg2.DataError: smallint out of range The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/lib/python3.6/site-packages/covscanhub/scan/xmlrpc_helper.py", line 35, in finish_scan process_scan(sb) File "/usr/lib/python3.6/site-packages/covscanhub/waiving/results_loader.py", line 219, in process_scan rl.process() File "/usr/lib/python3.6/site-packages/covscanhub/waiving/results_loader.py", line 198, in process self.store_defects(self.all.get_defects(), DEFECT_STATES['NEW']) File "/usr/lib/python3.6/site-packages/covscanhub/waiving/results_loader.py", line 174, in store_defects rg.save() File "/usr/lib/python3.6/site-packages/django/db/models/base.py", line 744, in save force_update=force_update, update_fields=update_fields) File "/usr/lib/python3.6/site-packages/django/db/models/base.py", line 782, in save_base force_update, using, update_fields, File "/usr/lib/python3.6/site-packages/django/db/models/base.py", line 854, in _save_table forced_update) File "/usr/lib/python3.6/site-packages/django/db/models/base.py", line 903, in _do_update return filtered._update(values) > 0 File "/usr/lib/python3.6/site-packages/django/db/models/query.py", line 760, in _update return query.get_compiler(self.db).execute_sql(CURSOR) File "/usr/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1471, in execute_sql cursor = super().execute_sql(result_type) File "/usr/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1142, in execute_sql cursor.execute(sql, params) File "/usr/lib/python3.6/site-packages/django/db/backends/utils.py", line 99, in execute return super().execute(sql, params) File "/usr/lib/python3.6/site-packages/django/db/backends/utils.py", line 67, in execute return self._execute_with_wrappers(sql, params, many=False, executor=self._execute) File "/usr/lib/python3.6/site-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers return executor(sql, params, many, context) File "/usr/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) File "/usr/lib/python3.6/site-packages/django/db/utils.py", line 89, in __exit__ raise dj_exc_value.with_traceback(traceback) from exc_value File "/usr/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) django.db.utils.DataError: smallint out of range ``` Resolves: https://issues.redhat.com/browse/OSH-242
- Loading branch information