Skip to content

Commit

Permalink
Update Cache Script
Browse files Browse the repository at this point in the history
  • Loading branch information
no1mann committed Nov 2, 2024
1 parent 2492d09 commit 4f77d50
Show file tree
Hide file tree
Showing 15 changed files with 501 additions and 364 deletions.
58 changes: 43 additions & 15 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,59 @@
"version": "0.2.0",
"configurations": [
{
"name": "Run Cache Service",
"name": "Add Local KV's",
"type": "f5anything",
"request": "launch",
"command": "cd ${workspaceFolder}/workers/tiltify-cache/ ; npm run dev",
"terminalName": "cache",
"terminalIndex": 2,
"command": "cd ${workspaceFolder}/workers/tiltify-cache/ ; npm run kv-causes:local ; npm run kv-summary:local ; npm run kv-trends-previous:local",
"terminalName": "Other",
"terminalIndex": 0,
"showTerminal": true
},
{
"name": "Run Website & API",
"type": "f5anything",
"type": "node",
"request": "launch",
"command": "cd ${workspaceFolder} ; npm run dev",
"terminalName": "Website",
"terminalIndex": 1,
"showTerminal": true
"runtimeExecutable": "npm",
"runtimeArgs": [
"run",
"dev"
],
"cwd": "${workspaceFolder}",
"console": "integratedTerminal",
"outputCapture": "std"
},
{
"name": "Add Local KV's",
"type": "f5anything",
"name": "Run Cache Service",
"type": "node",
"request": "launch",
"command": "cd ${workspaceFolder}/workers/tiltify-cache/ ; npm run kv-causes:local ; npm run kv-summary:local ; npm run kv-trends-previous:local",
"terminalName": "Other",
"terminalIndex": 0,
"showTerminal": true
"runtimeExecutable": "npm",
"runtimeArgs": [
"run",
"dev"
],
"cwd": "${workspaceFolder}/workers/tiltify-cache",
"console": "integratedTerminal",
"outputCapture": "std"
},
{
"name": "Attach Debugger to Cache Service",
"type": "node",
"request": "attach",
"port": 9229,
"cwd": "${workspaceFolder}/workers/tiltify-cache",
"resolveSourceMapLocations": null,
"attachExistingChildren": false,
"autoAttachChildProcesses": false,

}
],
"compounds": [
{
"name": "Debug Cache Service",
"configurations": [
"Run Cache Service",
"Attach Debugger to Cache Service"
]
}
]
}
20 changes: 15 additions & 5 deletions website/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
</div>
<p></p>
</div>
<div class="ui segment" id="error" style="display: none;">
<div class="ui active inverted dimmer" style="background-color: #1b1c1d00">
<div><i class="times icon huge"></i></div>
<span class="ui big text">Error Loading Tracker</span>
</div>
</div>
<div id="content" style="display: none;">
<div class="ui compact huge segment" id="currencySelectorObj" style="right: 20px;">
<label style="margin-right: 11px;">$</label>
Expand Down Expand Up @@ -76,10 +82,12 @@ <h3>Raised Since <span class="jj-start-year"></span></h3>
<h3>Previous Years</h3>
</div>
<div class="body">
<table class="ui large celled striped table unstackable" style="min-width: 250px !important;" id="yearsTable">
<table class="ui large celled striped table unstackable" style="min-width: 250px !important;"
id="yearsTable">
<thead>
<tr>
<th class="center aligned six wide" style="min-width: 60px; border-left: 1px solid rgba(34,36,38,.1);">Year
<th class="center aligned six wide"
style="min-width: 60px; border-left: 1px solid rgba(34,36,38,.1);">Year
</th>
<th class="center aligned ten wide" style="min-width: 60px;">Raised</th>
</tr>
Expand All @@ -89,14 +97,16 @@ <h3>Previous Years</h3>
</div>
</div>
<div class="flexable" style="flex: 50%; align-self: start;" id="rightGrid">
<div class="ui segment jj-pink-border-top fit-content centered full-width" style="min-height: 1305px;">
<div class="ui segment jj-pink-border-top fit-content centered full-width">
<div class="header">
<h2>Charities</h2>
</div>
<div class="body">
<p style="text-align: center; margin-top: 5px; margin-bottom: 25px;">
The <span class="jj-year"></span> Jingle Jam is raising money to support <span class="jj-cause-count"></span> important causes,
ranging from physical and mental health, diversity and inclusion, global crisis relief, and safeguarding the
The <span class="jj-year"></span> Jingle Jam is raising money to support <span
class="jj-cause-count"></span> important causes,
ranging from physical and mental health, diversity and inclusion, global crisis relief, and
safeguarding the
planet. Here's how your donations will make a difference.
</p>
<div class="ui horizontal raised doubling cards" id="charityCards">
Expand Down
43 changes: 30 additions & 13 deletions website/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,19 @@
//Start loops
await tiltifyLoop();

afterLoadSetup();

await getPrevious();
await graphLoop(true);
hideLoader();

//Start the timed loop
timedLoop();
if(JingleJam.model){
afterLoadSetup();

await getPrevious();
await graphLoop(true);
hideLoader();

//Start the timed loop
timedLoop();
}
else {
$('#loader').hide();
}
};

//Runs before the initial data is loaded
Expand Down Expand Up @@ -527,13 +532,21 @@
//Also check if the next update time is less than 0 because of the browser tab check
if (!JingleJam.model || (JingleJam.pageIsVisible && JingleJam.isLive() && getNextUpdateTime() <= 0)) {
JingleJam.oldModel = JingleJam.model;
JingleJam.model = await getTiltify();
try {
JingleJam.model = await getTiltify();

$('#embedContainer #error').hide();
} catch {
$('#embedContainer #error').show();
}

JingleJam.model.history.reverse();
if(JingleJam.model){
JingleJam.model.history.reverse();

if (JingleJam.isLive()){
await updateCounts();
await createGraph();
if (JingleJam.isLive()){
await updateCounts();
await createGraph();
}
}
}
}
Expand All @@ -548,6 +561,10 @@

//Gets the next update time based on the model update date
function getNextUpdateTime() {
if(!JingleJam.model){
return 0;
}

let now = new Date();
let modelUpdateTime = JingleJam.model.date ? new Date(JingleJam.model.date) : new Date();

Expand Down
7 changes: 7 additions & 0 deletions website/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@
background-color: #fafafa;
}

#embedContainer #error {
height: calc(100vh - 145px);
box-shadow: none;
border: 0;
background-color: #fafafa;
}

#embedContainer .ui.slider .inner .track-fill {
background-color: #e21251 !important;
}
Expand Down
Loading

0 comments on commit 4f77d50

Please sign in to comment.