-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from edbourque0/auto-refresh
Auto refresh and UX improvements integration
- Loading branch information
Showing
10 changed files
with
93 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import requests | ||
import time | ||
|
||
while True: | ||
url = 'http://192.168.2.39:8000/clanrefresh/G9JVLC2C' | ||
try: | ||
response = requests.get(url) | ||
if response.status_code == 200: | ||
print("View called successfully.") | ||
else: | ||
print(f"Error calling view: {response.status_code}") | ||
except requests.exceptions.RequestException as e: | ||
print(f"Request failed: {e}") | ||
print(f"Waiting for 1 hour.") | ||
time.sleep(3600) |
19 changes: 19 additions & 0 deletions
19
clashstats/clanranking/migrations/0006_clans_lastupdated.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Generated by Django 5.0.4 on 2024-04-18 18:04 | ||
|
||
import django.utils.timezone | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("clanranking", "0005_delete_lastupdated"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="clans", | ||
name="lastUpdated", | ||
field=models.DateTimeField(default=django.utils.timezone.now), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,15 +8,8 @@ | |
{% progressive_web_app_meta %} | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous"> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@tabler/icons-webfont@latest/dist/tabler-icons.min.css" /> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.min.css"> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script> | ||
<script> | ||
document.addEventListener("DOMContentLoaded", function() { | ||
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')); | ||
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) { | ||
return new bootstrap.Tooltip(tooltipTriggerEl); | ||
}); | ||
}); | ||
</script> | ||
<style> | ||
.custom-badge { | ||
background-color: #d63384; | ||
|
@@ -44,9 +37,15 @@ | |
<div class='container py-5'> | ||
<div class='text-center'> | ||
<h1 class='fw-bold text-warning'>Clan ranking</h1> | ||
</div> | ||
<div class='text-center'> | ||
<h4 class='p-3 fw-bold'><span class="badge text-bg-primary">{{ clan.name }}</span></h4> | ||
{% if lastUpdatedMin == 0 %} | ||
<p class='text-muted'>Just updated</p> | ||
{% else %} | ||
<p class='text-muted'>Updated {{ lastUpdatedMin }} minutes ago</p> | ||
{% endif %} | ||
<h4 class="fw-bold d-inline-block my-auto"><span class="badge text-bg-primary">{{ clan.name }}</span></h4> | ||
<div class="mb-3 text-end"> | ||
<a id='refreshButton' href="/clanrefresh/{{ clan.tag|slice:"1:" }}" class="btn btn-outline-primary" role="button"><i class="bi bi-arrow-clockwise" style='-webkit-text-stroke: 1px;'></i></a> | ||
</div> | ||
</div> | ||
{% for member in members %} | ||
<div class='mb-3 border border-secondary border-3 rounded p-3'> | ||
|
@@ -117,5 +116,20 @@ <h4>Clanmates stats</h4> | |
</div> | ||
{% endfor %} | ||
</div> | ||
<script> | ||
document.addEventListener("DOMContentLoaded", function() { | ||
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')); | ||
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) { | ||
return new bootstrap.Tooltip(tooltipTriggerEl); | ||
}); | ||
|
||
var refreshButton = document.getElementById('refreshButton'); | ||
refreshButton.addEventListener('click', function(event) { | ||
this.innerHTML = '<span class="spinner-border spinner-border-sm" aria-hidden="true"></span>'; | ||
this.classList.add('disabled'); // Use Bootstrap's 'disabled' class to disable the button | ||
this.setAttribute('aria-disabled', 'true'); // Optionally set aria-disabled for accessibility | ||
}); | ||
}); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -156,3 +156,4 @@ | |
] | ||
PWA_APP_DIR = 'ltr' | ||
PWA_APP_LANG = 'en-US' | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,28 @@ | ||
amqp==5.2.0 | ||
asgiref==3.8.1 | ||
billiard==4.2.0 | ||
black==24.4.0 | ||
certifi==2024.2.2 | ||
charset-normalizer==3.3.2 | ||
click==8.1.7 | ||
click-didyoumean==0.3.1 | ||
click-plugins==1.1.1 | ||
click-repl==0.3.0 | ||
Django==5.0.4 | ||
django-pwa==1.1.0 | ||
idna==3.6 | ||
kombu==5.3.7 | ||
mypy-extensions==1.0.0 | ||
packaging==24.0 | ||
pathspec==0.12.1 | ||
platformdirs==4.2.0 | ||
prompt-toolkit==3.0.43 | ||
pyinstrument==4.6.2 | ||
python-dateutil==2.9.0.post0 | ||
requests==2.31.0 | ||
six==1.16.0 | ||
sqlparse==0.4.4 | ||
tzdata==2024.1 | ||
urllib3==2.2.1 | ||
vine==5.1.0 | ||
wcwidth==0.2.13 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from datetime import datetime | ||
|
||
print(datetime.now()) |