Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Marta Miranda
/
boletin_api
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Enzo Yair
2023-10-03 08:29:12 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e6a9b6b38e297bfda95d3accebe128987ea6e1a3
e6a9b6b3
1 parent
bba16158
correcion de funcion
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
8 deletions
project/apps/edicto/admin.py
project/apps/edicto/migrations/0004_alter_precio_usuario.py
project/apps/edicto/models.py
project/apps/edicto/precio.py
project/apps/edicto/tests/tests_edicto.py
project/apps/edicto/admin.py
View file @
e6a9b6b
...
...
@@ -4,7 +4,7 @@ from .models import Edicto, Precio
# Register your models here.
admin
.
site
.
register
(
Precio
)
admin
.
site
.
register
(
Precio
)
admin
.
site
.
register
(
Edicto
)
...
...
project/apps/edicto/migrations/0004_alter_precio_usuario.py
0 → 100644
View file @
e6a9b6b
# Generated by Django 4.1.9 on 2023-10-03 11:23
from
django.conf
import
settings
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
migrations
.
swappable_dependency
(
settings
.
AUTH_USER_MODEL
),
(
'edicto'
,
'0003_alter_comprobantepago_edicto'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'precio'
,
name
=
'usuario'
,
field
=
models
.
ForeignKey
(
editable
=
False
,
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
settings
.
AUTH_USER_MODEL
),
),
]
...
...
project/apps/edicto/models.py
View file @
e6a9b6b
...
...
@@ -13,7 +13,7 @@ class Precio(models.Model):
precio
=
models
.
FloatField
(
max_length
=
50
,
blank
=
False
,
null
=
False
)
vigencia_desde
=
models
.
DateField
()
vigencia_hasta
=
models
.
DateField
(
blank
=
True
,
null
=
True
)
usuario
=
models
.
ForeignKey
(
Usuario
,
on_delete
=
models
.
CASCADE
)
usuario
=
models
.
ForeignKey
(
Usuario
,
on_delete
=
models
.
CASCADE
,
editable
=
False
)
moneda
=
models
.
CharField
(
max_length
=
50
,
blank
=
False
,
null
=
False
,
choices
=
MONEDA
,
default
=
'peso_argentino'
)
precio_ejemplar
=
models
.
FloatField
(
max_length
=
50
,
blank
=
False
,
null
=
False
)
...
...
project/apps/edicto/precio.py
View file @
e6a9b6b
...
...
@@ -3,9 +3,7 @@ from .models import ComprobantePago
def
calculadora
(
edicto
,
precio
):
try
:
descuento
=
50
organismo
=
edicto
.
creado_por
.
organismo
es_publico
=
organismo
.
es_publico
if
organismo
else
False
descuento
=
edicto
.
tiene_descuento
sellos
=
edicto
.
cantidad_sellos
palabras
=
edicto
.
cantidad_palabras
copias
=
edicto
.
cantidad_copias
...
...
@@ -20,10 +18,10 @@ def calculadora(edicto, precio):
result_ejemplar
=
(
copias
*
precio_valores
[
'precio_ejemplar'
])
+
(
publicar
*
precio_valores
[
'precio_dia'
])
subtotal
=
result_ejemplar
+
result_palabra
if
es_publico
:
resultado
=
(
descuento
*
subtotal
)
/
100
if
descuento
:
resultado
=
(
50
*
subtotal
)
/
100
else
:
resultado
=
((
100
-
descuento
)
*
subtotal
)
/
100
resultado
=
((
100
-
50
)
*
subtotal
)
/
100
comprobante
=
ComprobantePago
(
monto_total
=
resultado
,
monto_subtotal
=
subtotal
,
...
...
project/apps/edicto/tests/tests_edicto.py
View file @
e6a9b6b
from
django.test
import
TestCase
from
edicto.utils
import
contador
from
edicto.models
import
Edicto
class
ContadorTestCase
(
TestCase
):
...
...
Please
register
or
login
to post a comment