Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
GeoInt_SIDT
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mario Chirinos Colunga
GeoInt_SIDT
Commits
fff0e807
Commit
fff0e807
authored
Feb 27, 2019
by
Ulises Morales Ramírez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard
parent
887afe20
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
233 additions
and
201 deletions
+233
-201
dashboard.html
administration/templates/dashboard.html
+208
-196
views.py
administration/views.py
+22
-3
models.py
catalog/models.py
+1
-1
views.py
catalog/views.py
+2
-1
No files found.
administration/templates/dashboard.html
View file @
fff0e807
This diff is collapsed.
Click to expand it.
administration/views.py
View file @
fff0e807
import
calendar
import
os
from
django.contrib
import
messages
from
django.contrib.auth.models
import
User
from
django.db.models
import
Count
...
...
@@ -10,7 +11,9 @@ from PIL import Image
# Create your views here.
from
catalog.models
import
Purchase
,
Search
from
catalog.views
import
config
USERS_PATH
=
config
[
'PATHS'
][
'PATH_NAS'
]
def
Dashboard
(
request
):
total
=
Purchase
.
objects
.
filter
(
purchased
=
True
)
.
count
()
...
...
@@ -39,13 +42,29 @@ def Dashboard(request):
for
month
in
month_lst
:
if
month
[
'date'
]
==
date_name
:
month
[
'quantity'
]
=
date
[
1
]
Searches
=
Search
.
objects
.
values
(
'search_name'
)
.
exclude
(
search_name
=
'Drawn polygon'
)
.
annotate
(
search_names
=
[
''
]
Searches
=
Search
.
objects
.
values
(
'search_name'
)
.
exclude
(
search_name
__in
=
search_names
)
.
annotate
(
count
=
Count
(
'search_name'
))
.
order_by
(
'-count'
)[:
5
]
print
(
USERS_PATH
)
repsat
=
os
.
stat
(
USERS_PATH
+
"/repsat_test_dev"
)
.
st_size
if
repsat
>
1000
:
size2
=
repsat
/
1000
size_repsat
=
str
(
round
(
size2
,
2
))
+
" GB"
else
:
size_repsat
=
str
(
round
(
repsat
,
2
))
+
" MB"
sentinel
=
os
.
stat
(
USERS_PATH
+
"/repsat_test_dev"
)
.
st_size
if
sentinel
>
1000
:
size2
=
repsat
/
1000
size_sentinel
=
str
(
round
(
size2
,
2
))
+
" GB"
else
:
size_sentinel
=
str
(
round
(
sentinel
,
2
))
+
" MB"
return
render
(
request
,
'dashboard.html'
,
{
"Viewname"
:
"Dashboard"
,
"Usuarios"
:
usuarios
,
"Total_compras"
:
total
,
"Solicitud"
:
Request
,
"Descargando"
:
in_process
,
"dates"
:
month_lst
,
"search"
:
Searches
})
"Descargando"
:
in_process
,
"dates"
:
month_lst
,
"search"
:
Searches
,
"size_repsat"
:
size_repsat
,
"size_sentinel"
:
size_sentinel
})
# ----------------------------------------------------------
...
...
catalog/models.py
View file @
fff0e807
...
...
@@ -57,7 +57,7 @@ class Process(models.Model):
class
Search
(
models
.
Model
):
area
=
models
.
TextField
(
null
=
True
)
search_name
=
models
.
TextField
(
default
=
"Drawn polygon"
)
search_name
=
models
.
TextField
(
default
=
"Drawn polygon
"
)
user
=
models
.
ForeignKey
(
User
,
on_delete
=
models
.
CASCADE
)
aggreg_date
=
models
.
DateTimeField
(
auto_now
=
True
)
# date of product aggregation
startDate
=
models
.
DateTimeField
(
verbose_name
=
'Start Date'
)
...
...
catalog/views.py
View file @
fff0e807
...
...
@@ -86,7 +86,8 @@ def productList(request):
end_date
=
req
[
'end'
][
0
][:
10
]
clouds
=
req
[
'cloudPercentage'
][
0
]
search_name
=
req
[
'search_name'
][
0
]
print
(
search_name
)
if
search_name
==
''
:
search_name
=
'Drawn Polygon'
cloud_percentage
=
"[0 TO "
+
req
[
'cloudPercentage'
][
0
]
+
"]"
## ----- aqui llamada a api sentinel
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment