Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add web UI last update date and time #339

Merged
merged 1 commit into from
Oct 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions home_page/implications/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -197,5 +197,9 @@ <h3>This equation is implied by (&lt;=):</h3>
<script src="find_equation_id.js"></script>
<script src="to_lean.js"></script>
<script src="script.js"></script>

<div>
<p>Last updated at: <span id="lastUpdated"></span> (local time), Git commit: <a id="commitLink" target="_blank"></a></p>
</div>
</body>
</html>
13 changes: 13 additions & 0 deletions home_page/implications/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,3 +418,16 @@ function handleUrlChange() {
}

window.addEventListener('popstate', handleUrlChange);


document.addEventListener('DOMContentLoaded', function() {
const timestamp = last_updated.timestamp * 1000; // Convert to milliseconds
const commitHash = last_updated.commit_hash;

const localDate = new Date(timestamp);
document.getElementById('lastUpdated').textContent = localDate.toLocaleString();

const commitLink = document.getElementById('commitLink');
commitLink.href = `https://github.com/teorth/equational_theories/tree/${commitHash}`;
commitLink.textContent = commitHash.substring(0, 7); // Display first 7 characters of the hash
});
26 changes: 26 additions & 0 deletions scripts/generate_equation_implication_js.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os
import sys


#"""
f = json.load(open(sys.argv[1]))

Expand Down Expand Up @@ -118,3 +119,28 @@ def find_equivalence_classes_fast(implications):

print("var duals = ", open("data/duals.json").read())



import time
import subprocess
import json

def get_git_commit_hash():
try:
return subprocess.check_output(['git', 'rev-parse', 'HEAD']).decode('ascii').strip()
except:
return "Unable to retrieve Git hash"

# Get current UTC time as a timestamp
utc_timestamp = int(time.time())

# Get the current Git commit hash
commit_hash = get_git_commit_hash()

# Create a dictionary with the information
update_info = {
"timestamp": utc_timestamp,
"commit_hash": commit_hash
}

print("var last_updated = ",json.dumps(update_info))