Skip to content

Commit

Permalink
Liczenie punktw dla tlumaczen (#931)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpasternak committed Nov 29, 2020
1 parent cab5411 commit f23825b
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 18 deletions.
1 change: 1 addition & 0 deletions HISTORY.rst
Expand Up @@ -11,6 +11,7 @@ Historia zmian
* wyświetlanie wewnętrznego ID autora na podstronie autora (b/n),
* możliwość otwarcia strony autora po ID za pomocą linku /bpp/autor/{ID}/ (b/n),
* prawidłowe obliczanie punktów dla referatów (#930)
* prawidłowe obliczanie punktów dla tłumaczeń (#931)

202009.48
---------
Expand Down
18 changes: 9 additions & 9 deletions docs/sloty.rst
Expand Up @@ -172,25 +172,25 @@ Wydawnictwa zwarte

* poziom wydawcy równy 2 oraz:

- autorstwo + książka + punkty PK = 200, lub
- redakcja + książka + punkty PK = 100, lub
- rozdział + punkty PK = 50
- autorstwo + książka + punkty PK = (200 lub 100), lub
- redakcja + książka + punkty PK = (100 lub 50), lub
- rozdział + punkty PK = (50 lub 25)

... da w rezultacie próg 1. algorytmu

* poziom wydawcy równy 1 oraz:

- autorstwo + książka + punkty PK = 80 lub 100, lub
- redakcja + książka + punkty PK = 20, lub
- rozdział + punkty PK = 20
- autorstwo + książka + punkty PK = (80 lub 40 lub 100), lub
- redakcja + książka + punkty PK = (20 lub 10), lub
- rozdział + punkty PK = (20 lub 10)

... da w rezultacie próg 2. algorytmu

* poziom wydawcy inny lub bez określenia wydawcy oraz:

- książka + autorstwo + punkty PK = 20, lub
- książka + redakcja + punkty PK = 5, lub
- rozdział + punkty KBN = 5
- książka + autorstwo + punkty PK = (20 lub 10), lub
- książka + redakcja + punkty PK = (5 lub 2.5), lub
- rozdział + punkty KBN = (5 lub 2.5)

... da w rezultacie próg 3. algorytmu.

Expand Down
18 changes: 9 additions & 9 deletions src/bpp/models/sloty/core.py
Expand Up @@ -138,29 +138,29 @@ def ISlot(original):

if poziom_wydawcy == 2:
if (
(ksiazka and autorstwo and original.punkty_kbn == 200)
or (ksiazka and redakcja and original.punkty_kbn == 100)
or (rozdzial and original.punkty_kbn == 50)
(ksiazka and autorstwo and original.punkty_kbn in [200, 100])
or (ksiazka and redakcja and original.punkty_kbn in [100, 50])
or (rozdzial and original.punkty_kbn in [50, 25])
):
return SlotKalkulator_Wydawnictwo_Zwarte_Prog1(
original, tryb_kalkulacji
)

elif poziom_wydawcy == 1:
if (
(ksiazka and autorstwo and original.punkty_kbn in [80, 100])
or (ksiazka and redakcja and original.punkty_kbn == 20)
or (rozdzial and original.punkty_kbn == 20)
(ksiazka and autorstwo and original.punkty_kbn in [80, 40, 100])
or (ksiazka and redakcja and original.punkty_kbn in [20, 10])
or (rozdzial and original.punkty_kbn in [20, 10])
):
return SlotKalkulator_Wydawnictwo_Zwarte_Prog2(
original, tryb_kalkulacji
)

else:
if (
(ksiazka and autorstwo and original.punkty_kbn == 20)
or (ksiazka and redakcja and original.punkty_kbn == 5)
or (rozdzial and original.punkty_kbn == 5)
(ksiazka and autorstwo and original.punkty_kbn in [20, 10])
or (ksiazka and redakcja and original.punkty_kbn in [5, 2.5])
or (rozdzial and original.punkty_kbn in [5, 2.5])
):
return SlotKalkulator_Wydawnictwo_Zwarte_Prog3(
original, tryb_kalkulacji
Expand Down
31 changes: 31 additions & 0 deletions src/bpp/tests/test_models/test_sloty/test_sloty_tlumaczenie.py
@@ -0,0 +1,31 @@
import pytest

from bpp.models.sloty.core import ISlot
from bpp.models.sloty.wydawnictwo_zwarte import (
SlotKalkulator_Wydawnictwo_Zwarte_Prog3,
SlotKalkulator_Wydawnictwo_Zwarte_Prog2,
SlotKalkulator_Wydawnictwo_Zwarte_Prog1,
)


@pytest.mark.django_db
def test_ISlot_tlumaczenie_tier3(zwarte_z_dyscyplinami):
i = ISlot(zwarte_z_dyscyplinami)
zwarte_z_dyscyplinami.punkty_kbn = 2.5
assert isinstance(i, SlotKalkulator_Wydawnictwo_Zwarte_Prog3)


@pytest.mark.django_db
def test_ISlot_tlumaczenie_tier2(zwarte_z_dyscyplinami, wydawca, rok):
wydawca.poziom_wydawcy_set.create(rok=rok, poziom=1)
zwarte_z_dyscyplinami.punkty_kbn = 40
i = ISlot(zwarte_z_dyscyplinami)
assert isinstance(i, SlotKalkulator_Wydawnictwo_Zwarte_Prog2)


@pytest.mark.django_db
def test_ISlot_tlumaczenie_tier1(zwarte_z_dyscyplinami, wydawca, rok):
wydawca.poziom_wydawcy_set.create(rok=rok, poziom=2)
zwarte_z_dyscyplinami.punkty_kbn = 100
i = ISlot(zwarte_z_dyscyplinami)
assert isinstance(i, SlotKalkulator_Wydawnictwo_Zwarte_Prog1)

0 comments on commit f23825b

Please sign in to comment.