Skip to content

Conversation

@kingraphaii
Copy link
Contributor

Related issues: [please specify]

Description:

Tracks when a bundle is claimed, unclaimed, when time is added, expired, completed.

Screenshots/videos

I solemnly swear that:

  • My code follows the style guidelines of this project
  • I have merged the develop branch into my branch and fixed any merge conflicts
  • I have performed a self-review of my own code
  • I have commented my code in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have tested new or existing tests and made sure that they pass

@kingraphaii kingraphaii marked this pull request as ready for review July 14, 2024 11:59
Copy link
Contributor

@Ngoakor12 Ngoakor12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting this when going to the unclaimed bundles page:

Traceback (most recent call last):
  File "/home/ngoako/Desktop/code/umuzi/Tilde/backend/venv/lib/python3.10/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/home/ngoako/Desktop/code/umuzi/Tilde/backend/venv/lib/python3.10/site-packages/django/core/handlers/base.py", line 179, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/ngoako/Desktop/code/umuzi/Tilde/backend/venv/lib/python3.10/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/home/ngoako/Desktop/code/umuzi/Tilde/backend/frontend/views.py", line 910, in project_review_coordination_unclaimed
    ProjectReviewBundleClaim.deactivate_expired_claims()
  File "/home/ngoako/Desktop/code/umuzi/Tilde/backend/project_review_coordination/models.py", line 131, in deactivate_expired_claims
    expired_claim_ids = list(expired_claims.values_list("pk", flat=True))
  File "/home/ngoako/Desktop/code/umuzi/Tilde/backend/venv/lib/python3.10/site-packages/django/db/models/query.py", line 287, in __iter__
    self._fetch_all()
  File "/home/ngoako/Desktop/code/umuzi/Tilde/backend/venv/lib/python3.10/site-packages/django/db/models/query.py", line 1308, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/home/ngoako/Desktop/code/umuzi/Tilde/backend/venv/lib/python3.10/site-packages/django/db/models/query.py", line 180, in __iter__
    for row in compiler.results_iter(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size):
  File "/home/ngoako/Desktop/code/umuzi/Tilde/backend/venv/lib/python3.10/site-packages/django/db/models/sql/compiler.py", line 1108, in results_iter
    results = self.execute_sql(MULTI, chunked_fetch=chunked_fetch, chunk_size=chunk_size)
  File "/home/ngoako/Desktop/code/umuzi/Tilde/backend/venv/lib/python3.10/site-packages/django/db/models/sql/compiler.py", line 1143, in execute_sql
    sql, params = self.as_sql()
  File "/home/ngoako/Desktop/code/umuzi/Tilde/backend/venv/lib/python3.10/site-packages/django/db/models/sql/compiler.py", line 542, in as_sql
    raise TransactionManagementError('select_for_update cannot be used outside of a transaction.')
django.db.transaction.TransactionManagementError: select_for_update cannot be used outside of a transaction.
[Tilde-backend] [2024-07-15 15:14:27] ERROR [django.server:157] "GET /project_review_coordination/unclaimed/ HTTP/1.1" 500 122526

Maybe it's todo with my existing claims. commenting out ProjectReviewBundleClaim.deactivate_expired_claims() in views helped

Copy link
Collaborator

@sheenarbw sheenarbw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dramatiq actor seems to have been created because a different TODO note was misunderstood. Also, the actor is being called like a normal funciton so its not actually using dramatiq.

Rather just write simple code here

Copy link
Collaborator

@sheenarbw sheenarbw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small change needed. I think reading the logs will be confusing unless we make the names a bit more verbose

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants