Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev marshal shiva 2965 rrt #5152

Merged
merged 6 commits into from
Apr 27, 2024
Merged

Dev marshal shiva 2965 rrt #5152

merged 6 commits into from
Apr 27, 2024

Conversation

antsand
Copy link
Collaborator

@antsand antsand commented Apr 18, 2024

No description provided.

@antsand antsand changed the base branch from main to dev-marshal April 18, 2024 21:12
if 'rrt' in document['category']:
#Create notification event for RRT document
print(f"RRT Uploaded on FOI Request {ministryrequestid}")
#message = f'RRT Uploaded on FOI Request {ministryrequestid}'
Copy link
Collaborator

Choose a reason for hiding this comment

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

comment

Comment on lines 18 to 20
print("notificationtype", notificationtype)
print("requesttype", requesttype)
print("foirequest", foirequest)
Copy link
Collaborator

Choose a reason for hiding this comment

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

comments

for document in documentschema['documents']:
# Add attachment event here as we need to pass in the document
# to the event service to identify if the document is an RRT document.
attachmenteventresponse = attachmentevent().createattachmentevent(requestid, userid, document)
return self.createrequestdocument(requestid, documentschema, None, "rawrequest")
Copy link
Contributor

Choose a reason for hiding this comment

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

As discussed, attachmentevent call should be at resource level not at the service level.

@@ -11,6 +11,7 @@
from request_api.models.FOIApplicantCorrespondenceAttachments import FOIApplicantCorrespondenceAttachment
from request_api.services.eventservice import eventservice
from request_api.utils.enums import RequestType
from request_api.services.events.attachment import attachmentevent
import logging
Copy link
Contributor

Choose a reason for hiding this comment

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

remove unnecessary import

Copy link
Contributor

Choose a reason for hiding this comment

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

Response should contain ministryrequestID and not version.

Copy link
Contributor

Choose a reason for hiding this comment

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

Response should contain ministryrequestID and not version.

@@ -101,7 +101,7 @@ def createdocuments(cls,ministryrequestid,ministryrequestversion, documents, use
newdocuments.append(FOIMinistryRequestDocument(documentpath=document["documentpath"], version='1', filename=document["filename"], category=document["category"], isactive=True, foiministryrequest_id=ministryrequestid, foiministryrequestversion_id=ministryrequestversion, created_at=createdat, createdby=createuserid))
db.session.add_all(newdocuments)
db.session.commit()
return DefaultMethodResult(True,'Documents created')
return DefaultMethodResult(True,'Documents created',None, ministryrequestversion)
Copy link
Contributor

Choose a reason for hiding this comment

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

Response should have the ministryrequestid instead of None.

@@ -65,7 +65,7 @@ def createdocuments(cls,requestid,requestversion, documents, userid):
newdocuments.append(FOIRawRequestDocument(documentpath=document["documentpath"], version='1', filename=document["filename"], category=document["category"], isactive=True, foirequest_id=requestid, foirequestversion_id=requestversion, created_at=createdat, createdby=createuserid))
db.session.add_all(newdocuments)
db.session.commit()
return DefaultMethodResult(True,'Documents created')
return DefaultMethodResult(True,'Documents created', None, requestversion)
Copy link
Contributor

Choose a reason for hiding this comment

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

Response should have the ministryrequestid instead of None.

for document in documentschema['documents']:
# Add attachment event here as we need to pass in the document
# to the event service to identify if the document is an RRT document.
eventservice().attachmenteventservice(requestid, document, AuthHelper.getuserid(), ministryversion)
Copy link
Contributor

Choose a reason for hiding this comment

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

-Do not pass version to the event class. Leverage the below loc for getting version in the attachment event class.
version = FOIMinistryRequest.getversionforrequest(requestid)

Reference: divisionevent.class

@@ -13,10 +13,14 @@ class attachmentevent():
""" FOI Attachment Event management service

"""
def createattachmentevent(self, ministryrequestid, message, userid, event):
def createattachmentevent(self, ministryrequestid, userid, document, ministryversion):
Copy link
Contributor

Choose a reason for hiding this comment

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

Please make the necessary changes mentioned in accordance with callstack.

_comment = self.__preparecomment(ministryrequestid, message, ministryversion)
return commentservice().createcomments(_comment, userid, 2)

def __preparecomment(self, ministryrequestid, message, ministryversion):
Copy link
Contributor

Choose a reason for hiding this comment

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

Refer the divisionevent for creation of __createcomment

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Division comment event does not seem to take any raw request.


def attachmenteventservice(self, ministryrequestid, document, userid, ministryversion):
try:
attachmenteventresponse = attachmentevent().createattachmentevent(ministryrequestid, userid, document, ministryversion)
Copy link
Contributor

Choose a reason for hiding this comment

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

Please make the necessary changes mentioned in accordance with callstack.


def __getscanningteam(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

Please make the necessary changes mentioned in accordance with callstack.

Copy link
Contributor

Choose a reason for hiding this comment

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

@antsand , use __getgroupmembers method.

Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@antsand antsand merged commit 0c68a08 into dev-marshal Apr 27, 2024
3 checks passed
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