Skip to content
This repository has been archived by the owner on Sep 17, 2021. It is now read-only.

Commit

Permalink
Item scores now ignore fixed issue. Issue API only shows unfixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
scriptsrc committed Sep 15, 2017
1 parent e5be51d commit 2a8512d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions security_monkey/datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,13 +265,15 @@ def score(self):
).filter(
ItemAudit.item_id == self.id,
ItemAudit.auditor_setting_id == AuditorSettings.id,
ItemAudit.fixed == False,
AuditorSettings.disabled == False).one()[0] or 0

@score.expression
def score(cls):
return select([func.sum(ItemAudit.score)]). \
where(ItemAudit.item_id == cls.id). \
where(ItemAudit.auditor_setting_id == AuditorSettings.id). \
where(ItemAudit.fixed == False). \
where(AuditorSettings.disabled == False). \
label('item_score')

Expand All @@ -284,6 +286,7 @@ def unjustified_score(self):
).filter(
ItemAudit.item_id == self.id,
ItemAudit.justified == False,
ItemAudit.fixed == False,
ItemAudit.auditor_setting_id == AuditorSettings.id,
AuditorSettings.disabled == False).one()[0] or 0

Expand All @@ -292,13 +295,15 @@ def unjustified_score(cls):
return select([func.sum(ItemAudit.score)]). \
where(ItemAudit.item_id == cls.id). \
where(ItemAudit.justified == False). \
where(ItemAudit.fixed == False). \
where(ItemAudit.auditor_setting_id == AuditorSettings.id). \
where(AuditorSettings.disabled == False). \
label('item_unjustified_score')

issue_count = column_property(
select([func.count(ItemAudit.id)])
.where(ItemAudit.item_id == id)
.where(ItemAudit.fixed == False)
.where(ItemAudit.auditor_setting_id == AuditorSettings.id)
.where(AuditorSettings.disabled == False),
deferred=True
Expand Down
1 change: 1 addition & 0 deletions security_monkey/views/item_issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def get(self):
del args[k]

query = ItemAudit.query.join("item")
query = query.filter(ItemAudit.fixed == False)
if 'regions' in args:
regions = args['regions'].split(',')
query = query.filter(Item.region.in_(regions))
Expand Down

0 comments on commit 2a8512d

Please sign in to comment.