Skip to content

Commit

Permalink
Merge pull request #111 from openimis/main
Browse files Browse the repository at this point in the history
MERGING RELEASE branches
  • Loading branch information
delcroip authored Dec 6, 2023
2 parents 9e139c8 + 1e8bc2d commit e1de2eb
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
query-filters:
- exclude:
id: py/similar-function
42 changes: 42 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: "CodeQL"

on:
push:
branches: [ "main", "develop" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: "27 3 * * 0"

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ python ]

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql.yml
queries: +security-and-quality

- name: Autobuild
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{ matrix.language }}"
2 changes: 1 addition & 1 deletion location/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ def get_user_districts(cls, user):
.filter(*filter_validity())
.filter(location__type='D')
)
elif user.is_imis_admin:
elif hasattr(user, "is_imis_admin") and user.is_imis_admin:
# TODO: Use 'distinct()' when it is supported by MSSQL or if PostgreSQL becomes the sole database.
distinct_districts_codes = UserDistrict.objects.all().values_list('location__code')
usd_list = list(set(item[0] for item in distinct_districts_codes))
Expand Down

0 comments on commit e1de2eb

Please sign in to comment.