Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
CCC-Assignment2-Team69
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Xinjie Lan
CCC-Assignment2-Team69
Commits
79310e54
Commit
79310e54
authored
May 12, 2019
by
Weiting Zhang
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
8799556c
9bb991e8
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
web_app_django/tweet/templates/index.html
+21
-10
21 additions, 10 deletions
web_app_django/tweet/templates/index.html
web_app_django/tweet/views.py
+33
-6
33 additions, 6 deletions
web_app_django/tweet/views.py
with
54 additions
and
16 deletions
web_app_django/tweet/templates/index.html
+
21
−
10
View file @
79310e54
...
...
@@ -12,19 +12,30 @@
<td>
{{city.value}}
</td>
{% endfor %}
{%else%}
<hr>
NO DATA
</hr>
{% endif %}
{% for city1 in cityTotal %}
<td>
{{city1.melbourne}}
</td>
<td>
{{city1.sydney}}
</td>
<td>
{{city1.adelaide}}
</td>
<td>
{{city1.perth}}
</td>
<td>
{{city1.brisbane}}
</td>
{% endfor %}
<td>
{{melbourne}}
</td>
<td>
{{sydney}}
</td>
<td>
{{adelaide}}
</td>
<td>
{{perth}}
</td>
<td>
{{brisbane}}
</td>
<td>
{{NswCount}}
</td>
<td>
{{VicCount}}
</td>
<td>
{{SacCount}}
</td>
<td>
{{SaCount}}
</td>
{% for cityOld in cityTotalOld %}
<td>
{{cityOld.melbourne}}
</td>
<td>
{{cityOld.sydney}}
</td>
<td>
{{cityOld.adelaide}}
</td>
{% endfor %}
{%else%}
<hr>
NO DATA
</hr>
{% endif %}
</body>
...
...
This diff is collapsed.
Click to expand it.
web_app_django/tweet/views.py
+
33
−
6
View file @
79310e54
...
...
@@ -12,6 +12,7 @@ except:
# Create your views here.
def
index
(
request
):
context
=
{}
if
error
==
"
no
"
:
...
...
@@ -29,6 +30,7 @@ def index(request):
print
(
doc
.
key
,
doc
.
value
)
cityInfo
.
append
(
doc
)
print
(
"
space
"
)
for
doc
in
docs
.
view
(
'
results/cityTweet-view
'
,
group
=
True
):
#print(doc.key,doc.value)
...
...
@@ -46,8 +48,9 @@ def index(request):
#print(cityInfo)
context
=
{
'
cityTotal
'
:
cityTotal
}
context
=
{
'
cityInfo
'
:
cityInfo
}
context
[
'
cityTotal
'
]
=
cityTotal
context
[
'
cityInfo
'
]
=
cityInfo
docsNsw
=
SERVER
[
'
aurin_nsw
'
]
#print(docs)
...
...
@@ -59,7 +62,7 @@ def index(request):
features
=
docsNsw
[
doc
][
'
features
'
]
for
feature
in
features
:
countId
.
append
(
feature
[
"
id
"
])
print
(
len
(
countId
))
#
print(len(countId))
docsNswDomestic
=
SERVER
[
'
aurin_nsw_domestic
'
]
for
doc
in
docsNswDomestic
.
view
(
'
domesitc/new-view
'
):
for
element
in
doc
.
value
:
...
...
@@ -67,7 +70,7 @@ def index(request):
countDomesitc
+=
doc
.
value
[
element
]
countDomesitc
+=
len
(
countId
)
print
(
countDomesitc
)
context
=
{
'
NswCount
'
:
countDomesitc
}
context
[
'
NswCount
'
]
=
countDomesitc
#print(docs[doc]['features'])
#GET /tweet_resutls/_design/city/_view/city-view HTTP/1.1
...
...
@@ -89,7 +92,7 @@ def index(request):
else
:
count
+=
properties
[
element
]
print
(
count
)
context
=
{
'
VicCount
'
:
count
}
context
[
'
VicCount
'
]
=
count
docsSa
=
SERVER
[
'
aurin_sa
'
]
countForSa
=
0
for
doc
in
docsSa
.
view
(
'
sa/new-view
'
):
...
...
@@ -102,7 +105,31 @@ def index(request):
#print(countForSa)
countForSa
+=
properties
[
element
]
print
(
countForSa
)
context
=
{
'
SaCount
'
:
countForSa
}
context
[
'
SaCount
'
]
=
countForSa
docs
=
SERVER
[
'
tweet_2014_raw
'
]
cityInfoOld
=
[]
cityTotalOld
=
[]
cityPercentageOld
=
{}
for
doc
in
docs
.
view
(
'
results/result-view
'
,
group
=
True
):
cityInfoOld
.
append
(
doc
)
print
(
doc
.
key
,
doc
.
value
)
print
(
"
total
"
)
for
doc
in
docs
.
view
(
'
results/cityTweet-view
'
,
group
=
True
):
for
data
in
cityInfoOld
:
if
data
.
key
==
doc
.
key
:
number
=
(
data
.
value
/
doc
.
value
)
*
100
percentage
=
str
(
round
(
number
,
2
))
+
"
%
"
#print(percentage)
cityPercentageOld
[
data
.
key
]
=
percentage
cityTotalOld
.
append
(
cityPercentageOld
)
context
[
'
cityTotalOld
'
]
=
cityTotalOld
print
(
cityTotalOld
)
#context = {'file':2}
else
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment