diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..ef70894a --- /dev/null +++ b/.editorconfig @@ -0,0 +1,5 @@ +root = true + +[*.{js,css}] +indent_style = space +indent_size = 2 diff --git a/reValuate/api/__pycache__/__init__.cpython-36.pyc b/reValuate/api/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index df580b04..00000000 Binary files a/reValuate/api/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/reValuate/api/__pycache__/__init__.cpython-38.pyc b/reValuate/api/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index 45f4424a..00000000 Binary files a/reValuate/api/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/reValuate/api/__pycache__/__init__.cpython-39.pyc b/reValuate/api/__pycache__/__init__.cpython-39.pyc deleted file mode 100644 index afe895aa..00000000 Binary files a/reValuate/api/__pycache__/__init__.cpython-39.pyc and /dev/null differ diff --git a/reValuate/api/__pycache__/models.cpython-38.pyc b/reValuate/api/__pycache__/models.cpython-38.pyc deleted file mode 100644 index 8533f700..00000000 Binary files a/reValuate/api/__pycache__/models.cpython-38.pyc and /dev/null differ diff --git a/reValuate/api/__pycache__/serializers.cpython-36.pyc b/reValuate/api/__pycache__/serializers.cpython-36.pyc deleted file mode 100644 index 365b6a44..00000000 Binary files a/reValuate/api/__pycache__/serializers.cpython-36.pyc and /dev/null differ diff --git a/reValuate/api/__pycache__/serializers.cpython-38.pyc b/reValuate/api/__pycache__/serializers.cpython-38.pyc deleted file mode 100644 index 80786958..00000000 Binary files a/reValuate/api/__pycache__/serializers.cpython-38.pyc and /dev/null differ diff --git a/reValuate/api/__pycache__/serializers.cpython-39.pyc b/reValuate/api/__pycache__/serializers.cpython-39.pyc deleted file mode 100644 index f6c80628..00000000 Binary files a/reValuate/api/__pycache__/serializers.cpython-39.pyc and /dev/null differ diff --git a/reValuate/api/__pycache__/validators.cpython-38.pyc b/reValuate/api/__pycache__/validators.cpython-38.pyc deleted file mode 100644 index cb87410b..00000000 Binary files a/reValuate/api/__pycache__/validators.cpython-38.pyc and /dev/null differ diff --git a/reValuate/api/__pycache__/views.cpython-36.pyc b/reValuate/api/__pycache__/views.cpython-36.pyc deleted file mode 100644 index 590d34fa..00000000 Binary files a/reValuate/api/__pycache__/views.cpython-36.pyc and /dev/null differ diff --git a/reValuate/api/__pycache__/views.cpython-38.pyc b/reValuate/api/__pycache__/views.cpython-38.pyc deleted file mode 100644 index 0b65f465..00000000 Binary files a/reValuate/api/__pycache__/views.cpython-38.pyc and /dev/null differ diff --git a/reValuate/api/__pycache__/views.cpython-39.pyc b/reValuate/api/__pycache__/views.cpython-39.pyc deleted file mode 100644 index 14ff1ec2..00000000 Binary files a/reValuate/api/__pycache__/views.cpython-39.pyc and /dev/null differ diff --git a/reValuate/home/__pycache__/admin.cpython-36.pyc b/reValuate/home/__pycache__/admin.cpython-36.pyc deleted file mode 100644 index 9225c2e2..00000000 Binary files a/reValuate/home/__pycache__/admin.cpython-36.pyc and /dev/null differ diff --git a/reValuate/home/__pycache__/admin.cpython-38.pyc b/reValuate/home/__pycache__/admin.cpython-38.pyc deleted file mode 100644 index c30b3a44..00000000 Binary files a/reValuate/home/__pycache__/admin.cpython-38.pyc and /dev/null differ diff --git a/reValuate/home/__pycache__/admin.cpython-39.pyc b/reValuate/home/__pycache__/admin.cpython-39.pyc deleted file mode 100644 index f7fad708..00000000 Binary files a/reValuate/home/__pycache__/admin.cpython-39.pyc and /dev/null differ diff --git a/reValuate/home/__pycache__/models.cpython-36.pyc b/reValuate/home/__pycache__/models.cpython-36.pyc deleted file mode 100644 index 91a5d5e2..00000000 Binary files a/reValuate/home/__pycache__/models.cpython-36.pyc and /dev/null differ diff --git a/reValuate/home/__pycache__/models.cpython-38.pyc b/reValuate/home/__pycache__/models.cpython-38.pyc deleted file mode 100644 index 113bce38..00000000 Binary files a/reValuate/home/__pycache__/models.cpython-38.pyc and /dev/null differ diff --git a/reValuate/home/__pycache__/models.cpython-39.pyc b/reValuate/home/__pycache__/models.cpython-39.pyc deleted file mode 100644 index feb3a55f..00000000 Binary files a/reValuate/home/__pycache__/models.cpython-39.pyc and /dev/null differ diff --git a/reValuate/home/__pycache__/views.cpython-36.pyc b/reValuate/home/__pycache__/views.cpython-36.pyc deleted file mode 100644 index e833efe9..00000000 Binary files a/reValuate/home/__pycache__/views.cpython-36.pyc and /dev/null differ diff --git a/reValuate/home/__pycache__/views.cpython-38.pyc b/reValuate/home/__pycache__/views.cpython-38.pyc deleted file mode 100644 index 2eed5a60..00000000 Binary files a/reValuate/home/__pycache__/views.cpython-38.pyc and /dev/null differ diff --git a/reValuate/home/__pycache__/views.cpython-39.pyc b/reValuate/home/__pycache__/views.cpython-39.pyc deleted file mode 100644 index 229d798c..00000000 Binary files a/reValuate/home/__pycache__/views.cpython-39.pyc and /dev/null differ diff --git a/reValuate/home/static/home/css/gallery.css b/reValuate/home/static/home/css/gallery.css index 6949c614..51a4b050 100644 --- a/reValuate/home/static/home/css/gallery.css +++ b/reValuate/home/static/home/css/gallery.css @@ -1,134 +1,127 @@ -.popup{ - width: 900px; - margin: auto; - text-align: center +.popup { + width: 900px; + margin: auto; + text-align: center; } -.popup img{ - width: 200px; - height: 200px; - cursor: pointer + +.popup img { + width: 200px; + height: 200px; + cursor: pointer; } -.show{ - z-index: 999; - display: none; + +.show { + z-index: 999; + display: none; } -.show .overlay{ - width: 100%; - height: 100%; - background: rgba(0,0,0,.66); - position: absolute; - top: 0; - left: 0; + +.show .overlay { + width: 100%; + height: 100%; + background: rgba(0,0,0,.66); + position: absolute; + top: 0; + left: 0; } -.show .img-show{ - width: 600px; - height: 400px; - background: #FFF; - position: absolute; - top: 50%; - left: 50%; - transform: translate(-50%,-50%); - overflow: hidden + +.show .img-show { + width: 600px; + height: 400px; + background: #FFF; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%,-50%); + overflow: hidden; } -.img-show span{ - position: absolute; - top: 10px; - right: 10px; - z-index: 99; - cursor: pointer; + +.img-show span { + position: absolute; + top: 10px; + right: 10px; + z-index: 99; + cursor: pointer; } -.img-show img{ - width: 100%; - height: 100%; - position: absolute; - top: 0; - left: 0; + +.img-show img { + width: 100%; + height: 100%; + position: absolute; + top: 0; + left: 0; } * { - box-sizing: border-box; - margin: 0; - padding: 0; - } - - body { - font-family: Raleway; - background-color: #202125; - } - - .heading { - text-align: center; - font-size: 2.0em; - letter-spacing: 1px; - padding: 40px; - color: white; - } - - .gallery-image { - padding: 20px; - display: flex; - flex-wrap: wrap; - justify-content: center; - } - - .gallery-image img { - height: 250px; - width: 350px; - transform: scale(1.0); - transition: transform 0.4s ease; - } - - .img-box { - box-sizing: content-box; - margin: 10px; - height: 250px; - width: 350px; - overflow: hidden; - display: inline-block; - color: white; - position: relative; - background-color: white; - } - - .caption { - position: absolute; - bottom: 5px; - left: 20px; - opacity: 0.0; - transition: transform 0.3s ease, opacity 0.3s ease; - } - - .transparent-box { - height: 250px; - width: 350px; - background-color:rgba(0, 0, 0, 0); - position: absolute; - top: 0; - left: 0; - transition: background-color 0.3s ease; - } - - .img-box:hover img { - transform: scale(1.1); - } - - .img-box:hover .transparent-box { - background-color:rgba(0, 0, 0, 0.5); - } - - .img-box:hover .caption { - transform: translateY(-20px); - opacity: 1.0; - } - - .img-box:hover { - cursor: pointer; - } - - .caption > p:nth-child(2) { - font-size: 0.8em; - } - - .opacity-low { - opacity: 0.5; - } + box-sizing: border-box; + margin: 0; + padding: 0; +} + +body { + font-family: Raleway; + background-color: #202125; +} + +.heading { + text-align: center; + font-size: 2.0em; + letter-spacing: 1px; + padding: 40px; + color: white; +} + +.gallery-image { + padding: 20px; + display: flex; + flex-wrap: wrap; + justify-content: center; +} + +.gallery-image img { + height: 250px; + width: 350px; + transform: scale(1.0); + transition: transform 0.4s ease; +} + +.img-box { + box-sizing: content-box; + margin: 10px; + height: 250px; + width: 350px; + overflow: hidden; + display: inline-block; + color: white; + position: relative; + background-color: white; +} + +.caption { + position: absolute; + bottom: 5px; + left: 20px; + opacity: 0.0; + transition: transform 0.3s ease, opacity 0.3s ease; +} + +.transparent-box { + height: 250px; + width: 350px; + background-color: rgba(0, 0, 0, 0); + position: absolute; + top: 0; + left: 0; + transition: background-color 0.3s ease; +} + +.img-box:hover img { transform: scale(1.1); } +.img-box:hover .transparent-box { background-color: rgba(0, 0, 0, 0.5); } + +.img-box:hover .caption { + transform: translateY(-20px); + opacity: 1.0; +} + +.img-box:hover { cursor: pointer; } +.caption > p:nth-child(2) { font-size: 0.8em; } +.opacity-low { opacity: 0.5; } diff --git a/reValuate/home/static/home/css/style.css b/reValuate/home/static/home/css/style.css index a99b3333..13f700f5 100644 --- a/reValuate/home/static/home/css/style.css +++ b/reValuate/home/static/home/css/style.css @@ -11,10 +11,10 @@ background: white; -moz-box-shadow: 0 0 20px #469330; -webkit-box-shadow: 0 0 20px #469330; - box-shadow: 0 0 20px #469330; + box-shadow: 0 0 20px #469330; text-align: center; border-radius: 25px; -} +} header { display: flex; justify-content: space-between; @@ -138,21 +138,16 @@ header { .menu { display: initial; } - } html{ font-family: Arial, Helvetica, sans-serif; - } - - - p { font-family: Arial, Helvetica, sans-serif; - margin: 0 0 30px 0; + margin: 0 0 30px 0; } h1.heading{ @@ -167,7 +162,7 @@ ul.emoji{ .question{ color: gray; - font-size:20px; + font-size: 20px; } ul.nothing{ @@ -178,7 +173,7 @@ a.footer{ /* background:radial-gradient(circle, rgba(0,159,12,1) 0%, rgba(8,96,0,1) 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; */ - color:lightgreen; + color: lightgreen; } footer{ font-size: small; diff --git a/reValuate/home/views.py b/reValuate/home/views.py index e0eaefd9..8e2c33f8 100644 --- a/reValuate/home/views.py +++ b/reValuate/home/views.py @@ -6,18 +6,20 @@ from users.models import User import operator from upload.models import Media import requests +from django.db.models import Sum + def homePage(request): iter_var = 0 - all_balance = [] + all_balance = 0 Cashier = False Processor = False - + balObject = Balance.objects.filter(user=request.user.id) userBalance = balObject.values("balanceValue") try: - userBalance = userBalance[0]['balanceValue'] + userBalance = userBalance[0]['balanceValue'] except IndexError: userBalance = None if request.user.groups.filter(name='Cashier').exists(): @@ -30,7 +32,6 @@ def homePage(request): userQR = f"Name = {request.user.username}, Date Joined = {request.user.date_joined.date()}, ID = {request.user.id}, isCashier={Cashier}, isProcessor={Processor}, Balance = {userBalance}" else: userQR=None - a = Balance.objects.all() for user in a: all_balance.append(user.balanceValue) @@ -49,9 +50,9 @@ def homePage(request): "github": f"https://github.com/{github['login']}", } - + return render(request, "home.html", context) - + def leaderboard(request): users = User.objects.all() @@ -60,22 +61,22 @@ def leaderboard(request): try: username = i.username balance = i.balance.balanceValue - # add media counter and other stuff + # add media counter and other stuff if f"{username}" in leaderboard.keys(): leaderboard[username] = balance + leaderboard[username] else: - leaderboard[username] = balance + leaderboard[username] = balance except Exception as e: pass - + leaderboard = dict(sorted(leaderboard.items(), key=operator.itemgetter(0))) leaderboard = dict(reversed(list(leaderboard.items()))) while len(leaderboard) > 5: leaderboard.pop() - - media = Media.objects.all() + + media = Media.objects.all() user_media = {} for i in media: username = i.user.username @@ -83,7 +84,7 @@ def leaderboard(request): user_media[username] += 1 else: user_media[username] = 1 - + user_media = dict(sorted(user_media.items(), key=operator.itemgetter(0))) user_media = dict(reversed(list(user_media.items()))) print(user_media) @@ -97,7 +98,7 @@ def leaderboard(request): else: user_data = {i:{"Images":len(iter_user_media.filter(is_video=False))}} print(user_data) - + while len(user_media) > 5: user_media.pop() @@ -108,8 +109,8 @@ def leaderboard(request): # if f"{username}" in media_count.values(): # media_count[username] = image + media_count[username].value # else: - # media_count[username] = image - + # media_count[username] = image + # print(media_count) context = { @@ -118,4 +119,4 @@ def leaderboard(request): } return render(request, 'leaderboard.html', context) - + diff --git a/reValuate/templates/base.html b/reValuate/templates/base.html index 6eb5bbdc..39cec7e1 100644 --- a/reValuate/templates/base.html +++ b/reValuate/templates/base.html @@ -1,9 +1,8 @@ - +{% load static %} +{% load qr_code %} +
- - {% load static %} - {% load qr_code %}