Skip to content

Commit

Permalink
Merge branch 'release/v202410.1139'
Browse files Browse the repository at this point in the history
  • Loading branch information
mpasternak committed Oct 6, 2024
2 parents 7642f98 + 7dea7f7 commit 364f535
Show file tree
Hide file tree
Showing 19 changed files with 122 additions and 61 deletions.
34 changes: 19 additions & 15 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ jobs:
- checkout

# - restore_cache:
# key: cache-15-{{ checksum "poetry.lock" }}-{{ checksum "yarn.lock" }}
- restore_cache:
key: cache-15-{{ checksum "poetry.lock" }}-{{ checksum "yarn.lock" }}

- run: sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
- run: wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
Expand Down Expand Up @@ -103,12 +103,6 @@ jobs:
command: |
poetry run src/manage.py migrate
- run:
name: Fix yarn on CI maybe
command: |
sudo yarn global add n
sudo n 16.19.0
- run:
name: make assets
command: |
Expand All @@ -120,10 +114,10 @@ jobs:
# ls -las /home/circleci/.cache
# ls -las /home/circleci/.cache/*poetry*/

# - save_cache:
# key: cache-15-{{ checksum "poetry.lock" }}-{{ checksum "yarn.lock" }}
# paths:
# - "/home/circleci/.cache"
- save_cache:
key: cache-15-{{ checksum "poetry.lock" }}-{{ checksum "yarn.lock" }}
paths:
- "/home/circleci/.cache"

# Stworz dump bazy danych na potrzeby kolejnych kroków
- run:
Expand Down Expand Up @@ -308,12 +302,22 @@ jobs:
name: Recreate db
command: cat pg_dump.sql | psql bpp

- run:
name: Zainstaluj pakiety JavaScript
command: poetry run make yarn

# Doinstaluj explicte Chrome; normalnie przy 'yarn install' okazuje
# sie, ze apka 'puppeteer' nie jest w stanie go pobrac bo jest timeout;
# tutaj explicte instalujemy chrome, zeby widziec, gdzie i kiedy szlag
# trafia tą instalajce...
- run:
name: Instaluj Chrome dla JS testow
command: npx puppeteer browsers install chrome

# Testy JavaScript
- run:
name: JS Tests
command: |
poetry run make yarn
poetry run make js-tests
command: poetry run make js-tests

coveralls:
docker:
Expand Down
10 changes: 6 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ distclean: clean


yarn:
export PUPPETEER_SKIP_CHROME_DOWNLOAD=true PUPPETEER_SKIP_CHROME_HEADLESS_SHELL_DOWNLOAD=true && yarn cache clean && yarn install
# yarn install # --no-progress --emoji false -s
export PUPPETEER_SKIP_CHROME_DOWNLOAD=true PUPPETEER_SKIP_CHROME_HEADLESS_SHELL_DOWNLOAD=true && yarn install --no-progress --emoji false -s

grunt-build:
grunt build
Expand Down Expand Up @@ -68,7 +67,10 @@ bdist_wheel: distclean production-assets compilemessages
upload:
twine upload dist/*whl

js-tests: assets
puppeteer-install-chrome:
npx puppeteer browsers install chrome

js-tests: assets puppeteer-install-chrome
grunt qunit

# cel: live-docs
Expand Down Expand Up @@ -163,7 +165,7 @@ loc: clean
pygount -N ... -F "...,staticroot,migrations,fixtures" src --format=summary


DOCKER_VERSION="202410.1138"
DOCKER_VERSION="202410.1139"
DOCKER_BUILD=build --platform linux/amd64,linux/arm64 --push

build-dbserver:
Expand Down
3 changes: 3 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
:align: center
:alt: Logo projektu

.. image:: https://github.com/iplweb/bpp/actions/workflows/build.yml/badge.svg
:targer: https://github.com/iplweb/bpp/actions/workflows/build.yml

.. image:: https://circleci.com/gh/iplweb/bpp/tree/dev.svg?style=svg
:target: https://circleci.com/gh/iplweb/bpp

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bpp-iplweb",
"version": "v202410.1138",
"version": "v202410.1139",
"license": "MIT",
"devDependencies": {
"grunt": ">=1.6.1",
Expand Down
20 changes: 10 additions & 10 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 3 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "bpp_iplweb"
version = "202410.1138"
version = "202410.1139"
description = ""
authors = ["Michał Pasternak <michal.dtz@gmail.com>"]
license = "MIT"
Expand Down Expand Up @@ -113,7 +113,7 @@ pytest-rerunfailures = "^14.0"
django-debug-toolbar = "^4.4.6"

[tool.bumpver]
current_version = "v202410.1138"
current_version = "v202410.1139"
version_pattern = "vYYYY0M.BUILD[-TAGNUM][GITHASH]"
commit_message = "bump version {old_version} -> {new_version}"
commit = true
Expand All @@ -127,9 +127,6 @@ push = false
"src/django_bpp/version.py" = ['VERSION = "{pep440_version}"']
"package.json" = ['"version": "{version}",']
"Makefile" = [ 'DOCKER_VERSION="{pep440_version}"' ]
"docker-compose.yml" = [ ":{pep440_version}"]




[tool.poetry.dependencies]
Expand Down Expand Up @@ -268,7 +265,7 @@ build-backend = "poetry.core.masonry.api"

[tool.towncrier]
package = "bpp"
version = "202410.1138"
version = "202410.1139"
package_dir = "src"
filename = "HISTORY.rst"

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def requirements(fn="requirements.txt"):

setup(
name="bpp-iplweb",
version="202410.1138",
version="202410.1139",
description="System informatyczny do zarządzania bibliografią publikacji pracowników naukowych",
long_description=readme,
long_description_content_type="text/x-rst",
Expand Down
2 changes: 1 addition & 1 deletion src/bpp/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class TRYB_DOSTEPU(Enum):
PBN_MIN_ROK = 2017

# Maksymalny rok dla procedur eksportujących do PBN, liczącyc punkty/sloty oraz testów
PBN_MAX_ROK = 2024
PBN_MAX_ROK = 2025

PBN_LATA = list(range(PBN_MIN_ROK, PBN_MAX_ROK + 1))

Expand Down
2 changes: 2 additions & 0 deletions src/bpp/newsfragments/+faa6dfa4.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

szybsze generowanie XLSa w raport slotów - ewaluacja
2 changes: 2 additions & 0 deletions src/bpp/newsfragments/1409.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

maksymalny rok dla PBN ustawiony na 2025
2 changes: 2 additions & 0 deletions src/bpp/newsfragments/1412.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

wyswietlaj ID systemu kadrowego w raport slotów - uczelnia
2 changes: 2 additions & 0 deletions src/bpp/newsfragments/1445.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

usuń błąd który nie wyświetlał nie-obcych autorów w sytuacji gdy byli przypisani do obcej jednostki + błędnej jednostki (ale mieli dodatkowe przypisania, właściwe dla uczelni) w sytuacji wyłączonej opcji "pokazuj obcych autorów w przeglądaniu danych"
3 changes: 2 additions & 1 deletion src/bpp/views/browse.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ def get_queryset(self):
Q(
autor_jednostka__jednostka__pk=-1
) # "BŁĄD: brak wpisanej jednostki"
& Q(autor_jednostka__jednostka__pk=uczelnia.obca_jednostka_id),
& Q(autor_jednostka__jednostka__pk=uczelnia.obca_jednostka_id)
& Q(autor_jednostka__count__lte=2)
)

ret = ret.exclude(aktualna_jednostka=None, autor_jednostka__count=1)
Expand Down
26 changes: 19 additions & 7 deletions src/django_bpp/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

SCRIPT_PATH = os.path.abspath(os.path.dirname(__file__))

SITE_ROOT = os.path.abspath(os.path.join(SCRIPT_PATH, "..", ".."))

SECRET_KEY_UNSET = "Please set the DJANGO_BPP_SECRET_KEY variable."

# Ponieważ konieczna jest konfiguracja django-ldap-auth i potrzebne będą kolejne zmienne
Expand Down Expand Up @@ -119,14 +121,27 @@
STATIC_ROOT=(str, os.path.abspath(os.path.join(SCRIPT_PATH, "..", "staticroot"))),
)

ENVFILE_PATH = os.path.join(os.path.expanduser("~"), ".env")
ENVFILE_PATHS = []

#
# Jeżeli NIE działąmy z site-packages, to prawdopodobnie działamy ze źródeł; w tej sytuacji skorzystaj z
# pliku .env w głównym katalogu repozytorium:
#
if "site-packages" not in __file__:
ENVFILE_SOURCEDIR = os.path.abspath(os.path.join(SITE_ROOT, "..", ".env"))
ENVFILE_PATHS.append(ENVFILE_SOURCEDIR)

#
# Odczytaj plik ~/.env oraz dodatkowo ~/.env.local ;
# jeżeli zmienna jest zdefiniowana w tym drugim to nadpisz ten pierwszy...
# Kolejny plik w kolejności to plik w katalogu $HOME/.env oraz $HOME/.env.local:
#
ENVFILE_HOMEDIR = os.path.abspath(os.path.join(os.path.expanduser("~"), ".env"))
ENVFILE_PATHS.append(ENVFILE_HOMEDIR)
ENVFILE_PATHS.append(ENVFILE_HOMEDIR + ".local")

for fn in [ENVFILE_PATH, ENVFILE_PATH + ".local"]:
# Jeżeli zmienna jest zdefiniowana w więcej, niż jednym pliku to zmienna będzie nadpisana
# w kolejności plików:

for fn in ENVFILE_PATHS:
if os.path.exists(fn) and os.path.isfile(fn):
environ.Env.read_env(fn, overwrite=True)

Expand Down Expand Up @@ -430,8 +445,6 @@ def autoslug_gen():

MAT_VIEW_REFRESH_COUNTDOWN = 30

SITE_ROOT = os.path.abspath(os.path.join(SCRIPT_PATH, "..", ".."))

STATIC_ROOT = env("STATIC_ROOT")

COMPRESS_CSS_FILTERS = [
Expand Down Expand Up @@ -937,7 +950,6 @@ def can_login_as(request, target_user):
" została wyłączona"
)


#
# Koniec konfiguracji django-microsoft-auth
#
Expand Down
2 changes: 1 addition & 1 deletion src/django_bpp/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION = "202410.1138"
VERSION = "202410.1139"

if __name__ == "__main__":
import sys
Expand Down
3 changes: 3 additions & 0 deletions src/raport_slotow/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ class Meta:
"jednostka",
"pbn_id",
"orcid",
"system_kadrowy_id",
"dyscyplina",
"pkd_aut_sum",
"slot",
Expand All @@ -116,6 +117,7 @@ class Meta:
dyscyplina = Column()
pbn_id = Column("PBN ID", "autor.pbn_id")
orcid = Column("ORCID", "autor.orcid")
system_kadrowy_id = Column("System kadrowy ID", "autor.system_kadrowy_id")
jednostka = Column("Aktualna jednostka")

def __init__(self, od_roku, do_roku, slot, *args, **kw):
Expand Down Expand Up @@ -160,6 +162,7 @@ class Meta:
"autor",
"pbn_id",
"orcid",
"system_kadrowy_id",
"jednostka",
"wydzial",
"dyscyplina",
Expand Down
28 changes: 17 additions & 11 deletions src/raport_slotow/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,42 @@
from bpp.models import Cache_Punktacja_Autora_Query, Cache_Punktacja_Dyscypliny, Rekord


@pytest.mark.django_db
@pytest.fixture
def rekord_slotu(
autor_jan_kowalski, jednostka, dyscyplina1, wydawnictwo_ciagle_z_autorem, rok
):
wydawnictwo_ciagle_z_autorem.autorzy_set.update(dyscyplina_naukowa=dyscyplina1)
def _rekord_slotu_maker(autor, jednostka, dyscyplina, wydawnictwo_ciagle, rok):
wydawnictwo_ciagle.autorzy_set.update(dyscyplina_naukowa=dyscyplina)

rekord = Rekord.objects.get_for_model(wydawnictwo_ciagle_z_autorem)
rekord = Rekord.objects.get_for_model(wydawnictwo_ciagle)
Cache_Punktacja_Dyscypliny.objects.create(
rekord_id=rekord.pk,
dyscyplina=dyscyplina1,
dyscyplina=dyscyplina,
pkd=50,
slot=20,
autorzy_z_dyscypliny=[
autor_jan_kowalski.pk,
autor.pk,
],
zapisani_autorzy_z_dyscypliny=[
"Foo",
],
)
return Cache_Punktacja_Autora_Query.objects.create(
autor=autor_jan_kowalski,
autor=autor,
jednostka=jednostka,
dyscyplina=dyscyplina1,
dyscyplina=dyscyplina,
pkdaut=50,
slot=20,
rekord=rekord,
)


@pytest.mark.django_db
@pytest.fixture
def rekord_slotu(
autor_jan_kowalski, jednostka, dyscyplina1, wydawnictwo_ciagle_z_autorem, rok
):
return _rekord_slotu_maker(
autor_jan_kowalski, jednostka, dyscyplina1, wydawnictwo_ciagle_z_autorem, rok
)


@pytest.mark.django_db
@pytest.fixture
def raport_slotow_uczelnia(db):
Expand Down
Loading

0 comments on commit 364f535

Please sign in to comment.