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

fix: Duplicate entries allowed in Ticket-Tag #6351

Merged
merged 2 commits into from Aug 13, 2019

Conversation

prateekj117
Copy link
Member

Fixes #6350

Short description of what this resolves:

It should check if the same ticket-tag already exists for the specified event.

Checklist

  • I have read the Contribution & Best practices Guide and my PR follows them.
  • My branch is up-to-date with the Upstream development branch.
  • The unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • All the functions created/modified in this PR contain relevant docstrings.

@auto-label auto-label bot added the fix label Aug 12, 2019
:param view_kwargs:
:return:
"""
if self.session.query(TicketTag).filter_by(event_id=data['event'], name=data['name'], deleted_at=None).first():
Copy link
Member

Choose a reason for hiding this comment

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

There might be a possibility of ticket tags having the same name. Filtering by name might not be one of the best methods.

Copy link
Member Author

Choose a reason for hiding this comment

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

@mrsaicharan1 Yup, that's why I am using event_id as well.

Copy link
Member

Choose a reason for hiding this comment

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

@prateekj117 Can't a single event have multiple tags with the same name? What about that case?

Copy link
Member

Choose a reason for hiding this comment

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

@mrsaicharan1 What'd be the usecase of that?

Copy link
Member

Choose a reason for hiding this comment

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

@iamareebjamal @prateekj117 Okay. Yeah, wouldn't have any advantage. This is fine.

@codecov
Copy link

codecov bot commented Aug 12, 2019

Codecov Report

Merging #6351 into development will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@               Coverage Diff               @@
##           development    #6351      +/-   ##
===============================================
+ Coverage        65.38%   65.38%   +<.01%     
===============================================
  Files              287      287              
  Lines            14725    14726       +1     
===============================================
+ Hits              9628     9629       +1     
  Misses            5097     5097
Impacted Files Coverage Δ
app/models/ticket.py 73.19% <100%> (+0.27%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3ea8a96...87249a3. Read the comment docs.

Copy link
Member

@iamareebjamal iamareebjamal left a comment

Choose a reason for hiding this comment

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

Use unique contraint

@prateekj117
Copy link
Member Author

@iamareebjamal Done.

@iamareebjamal iamareebjamal merged commit 7a0091c into fossasia:development Aug 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multiple rows with same value allowed in ticket-tags
3 participants