From b7003436e568b94c9778430b1e4c2e56e4184b17 Mon Sep 17 00:00:00 2001 From: Fang Lin Date: Fri, 4 Aug 2023 12:35:02 -0700 Subject: [PATCH 1/3] Add building status --- uw_space/__init__.py | 2 ++ uw_space/models.py | 3 ++- uw_space/tests/test_facilities.py | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/uw_space/__init__.py b/uw_space/__init__.py index 9cbf737..cccce4e 100644 --- a/uw_space/__init__.py +++ b/uw_space/__init__.py @@ -49,9 +49,11 @@ def __process_json(self, json_data): objs = [] facilitys = json_data.get("Facilitys") for facility in facilitys: + status = facility.get("Status") fnumber = facility.get("FacilityNumber") if fnumber and len(fnumber): fac = self.search_by_number(fnumber) if fac: + fac.status = status objs.append(fac) return objs diff --git a/uw_space/models.py b/uw_space/models.py index 023b538..eb8a6b8 100644 --- a/uw_space/models.py +++ b/uw_space/models.py @@ -16,6 +16,7 @@ class Facility(models.Model): number = models.CharField(max_length=16) type = models.CharField(max_length=32) site = models.CharField(max_length=96) + status = models.CharField(max_length=64) def __init__(self, *args, **kwargs): super(Facility, self).__init__(*args, **kwargs) @@ -27,7 +28,6 @@ def from_json(json_data): obj.number = json_data.get("FacilityNumber") obj.last_updated = str_to_datetime(json_data.get("ModifiedDate")) obj.name = json_data.get("LongName") - cpoint = json_data.get("CenterPoint") if cpoint: obj.latitude = cpoint.get("Latitude") @@ -51,6 +51,7 @@ def json_data(self): "name": self.name, "number": self.number, "site": self.site, + "status": self.status, "type": self.type, } diff --git a/uw_space/tests/test_facilities.py b/uw_space/tests/test_facilities.py index b4b14dd..2798986 100644 --- a/uw_space/tests/test_facilities.py +++ b/uw_space/tests/test_facilities.py @@ -24,6 +24,7 @@ class TestSpace(TestCase): def test_search_by_code(self): fac = Facilities().search_by_code("MEB") self.assertEqual(len(fac), 1) + data['status'] = 'A' self.assertEqual(fac[0].json_data(), data) self.assertRaises( @@ -33,6 +34,7 @@ def test_search_by_code(self): def test_search_by_number(self): fac = Facilities().search_by_number("1347") + data['status'] = '' self.assertEqual(fac.json_data(), data) self.assertRaises( From 5a71fe5f1fd3c3ab9bad20d40e9a289014a05c5a Mon Sep 17 00:00:00 2001 From: Fang Lin Date: Fri, 4 Aug 2023 12:54:39 -0700 Subject: [PATCH 2/3] update actions and python version --- .github/workflows/cicd.yml | 16 ++++++++-------- setup.py | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 5a727a7..7820e16 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -37,16 +37,16 @@ on: jobs: test: - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 steps: - name: Checkout Repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: - python-version: 3.6 + python-version: 3.8 - name: Install Dependencies run: | @@ -75,16 +75,16 @@ jobs: needs: test - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 steps: - name: Checkout Repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: - python-version: '3.x' + python-version: 3.8 - name: Publish to PyPi uses: uw-it-aca/actions/publish-pypi@main diff --git a/setup.py b/setup.py index af31ba3..51a90db 100644 --- a/setup.py +++ b/setup.py @@ -35,6 +35,6 @@ 'License :: OSI Approved :: Apache Software License', 'Operating System :: OS Independent', 'Programming Language :: Python', - 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.8', ], ) From 509d0a926ba8b23af446c739ebc2733e9f1b4f55 Mon Sep 17 00:00:00 2001 From: Fang Lin Date: Fri, 4 Aug 2023 12:58:11 -0700 Subject: [PATCH 3/3] Updated Copyright year --- setup.py | 3 +++ uw_space/__init__.py | 2 +- uw_space/dao.py | 2 +- uw_space/models.py | 2 +- uw_space/test.py | 2 +- uw_space/tests/test_dao.py | 2 +- uw_space/tests/test_facilities.py | 2 +- uw_space/utils.py | 2 +- 8 files changed, 10 insertions(+), 7 deletions(-) diff --git a/setup.py b/setup.py index 51a90db..6fc088d 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,6 @@ +# Copyright 2023 UW-IT, University of Washington +# SPDX-License-Identifier: Apache-2.0 + import os from setuptools import setup diff --git a/uw_space/__init__.py b/uw_space/__init__.py index cccce4e..928aaae 100644 --- a/uw_space/__init__.py +++ b/uw_space/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2022 UW-IT, University of Washington +# Copyright 2023 UW-IT, University of Washington # SPDX-License-Identifier: Apache-2.0 diff --git a/uw_space/dao.py b/uw_space/dao.py index c1fbb8a..c54cfe4 100644 --- a/uw_space/dao.py +++ b/uw_space/dao.py @@ -1,4 +1,4 @@ -# Copyright 2022 UW-IT, University of Washington +# Copyright 2023 UW-IT, University of Washington # SPDX-License-Identifier: Apache-2.0 diff --git a/uw_space/models.py b/uw_space/models.py index eb8a6b8..269a992 100644 --- a/uw_space/models.py +++ b/uw_space/models.py @@ -1,4 +1,4 @@ -# Copyright 2022 UW-IT, University of Washington +# Copyright 2023 UW-IT, University of Washington # SPDX-License-Identifier: Apache-2.0 diff --git a/uw_space/test.py b/uw_space/test.py index 38fee61..771a666 100644 --- a/uw_space/test.py +++ b/uw_space/test.py @@ -1,4 +1,4 @@ -# Copyright 2022 UW-IT, University of Washington +# Copyright 2023 UW-IT, University of Washington # SPDX-License-Identifier: Apache-2.0 diff --git a/uw_space/tests/test_dao.py b/uw_space/tests/test_dao.py index ebb9418..cb167e4 100644 --- a/uw_space/tests/test_dao.py +++ b/uw_space/tests/test_dao.py @@ -1,4 +1,4 @@ -# Copyright 2022 UW-IT, University of Washington +# Copyright 2023 UW-IT, University of Washington # SPDX-License-Identifier: Apache-2.0 diff --git a/uw_space/tests/test_facilities.py b/uw_space/tests/test_facilities.py index 2798986..6eac85d 100644 --- a/uw_space/tests/test_facilities.py +++ b/uw_space/tests/test_facilities.py @@ -1,4 +1,4 @@ -# Copyright 2022 UW-IT, University of Washington +# Copyright 2023 UW-IT, University of Washington # SPDX-License-Identifier: Apache-2.0 diff --git a/uw_space/utils.py b/uw_space/utils.py index 8f047b6..8f7dbd0 100644 --- a/uw_space/utils.py +++ b/uw_space/utils.py @@ -1,4 +1,4 @@ -# Copyright 2022 UW-IT, University of Washington +# Copyright 2023 UW-IT, University of Washington # SPDX-License-Identifier: Apache-2.0