Skip to content

Commit

Permalink
Merge pull request #776 from kbevers/minus-refnr
Browse files Browse the repository at this point in the history
Udelad refgeo id'er fra søgning med FireDb.hent_punkt()
  • Loading branch information
kbevers authored Oct 1, 2024
2 parents a3de811 + c66c296 commit c0986b1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 13 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,31 +31,31 @@ jobs:

- name: Installer Oracle instantclient et al
run: |
mkdir -p /opt/oracle
cd /opt/oracle
# Download links findes her: https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html
wget -nv https://download.oracle.com/otn_software/linux/instantclient/2340000/instantclient-basic-linux.x64-23.4.0.24.05.zip
wget -nv https://download.oracle.com/otn_software/linux/instantclient/2340000/instantclient-sqlplus-linux.x64-23.4.0.24.05.zip
unzip -o instantclient-basic-linux.x64-23.4.0.24.05.zip
unzip -o instantclient-sqlplus-linux.x64-23.4.0.24.05.zip
ls -la /opt/oracle/instantclient_23_4
sudo apt-get install libaio1
sudo sh -c "echo /opt/oracle/instantclient_23_4 > /etc/ld.so.conf.d/oracle-instantclient.conf"
sudo ldconfig
export LD_LIBRARY_PATH=/opt/oracle/instantclient_23_4:$LD_LIBRARY_PATH
export PATH=/opt/oracle/instantclient_23_4:$PATH
# Gem miljøvariable til brug i de følgende trin
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" >> "$GITHUB_ENV"
echo "PATH=$PATH" >> "$GITHUB_ENV"
which sqlplus
- name: Cache conda
Expand All @@ -68,9 +68,8 @@ jobs:
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment-dev.yml') }}

- name: Setup conda
uses: conda-incubator/setup-miniconda@v2
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Mambaforge
miniforge-version: latest
use-mamba: true
environment-file: environment-dev.yml
Expand Down
24 changes: 18 additions & 6 deletions fire/api/firedb/hent.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ def hent_punkter(self, ident: str) -> List[Punkt]:
.join(PunktInformation)
.join(PunktInformationType)
.filter(
PunktInformationType.name.startswith("IDENT:"),
and_(
PunktInformationType.name.startswith("IDENT:"),
PunktInformationType.name != "IDENT:refgeo_id",
),
PunktInformation._registreringtil == None, # NOQA
or_(
PunktInformation.tekst == ident,
Expand Down Expand Up @@ -144,7 +147,8 @@ def chunks(lst, n):
self.session.query(Punkt)
.filter(
Punkt.id.in_(subset),
).all()
)
.all()
)

return punkter
Expand Down Expand Up @@ -370,11 +374,19 @@ def hent_srid(self, sridid: str) -> Srid:
srid_filter = str(sridid).upper()

try:
# Prøv først at søge på det egentlige srid-navn.
srid = self.session.query(Srid).filter(func.upper(Srid.name) == srid_filter).one()
# Prøv først at søge på det egentlige srid-navn.
srid = (
self.session.query(Srid)
.filter(func.upper(Srid.name) == srid_filter)
.one()
)
except NoResultFound as e:
# Ellers søges på sridens korte navn
srid = self.session.query(Srid).filter(func.upper(Srid.kortnavn) == srid_filter).one()
# Ellers søges på sridens korte navn
srid = (
self.session.query(Srid)
.filter(func.upper(Srid.kortnavn) == srid_filter)
.one()
)

return srid

Expand Down

0 comments on commit c0986b1

Please sign in to comment.