Conversation
|
Nice, thanks, lemme test this out. |
elekto/templates/layouts/app.html
Outdated
| } | ||
| document.addEventListener('DOMContentLoaded', function () { | ||
| // Fetch the version from the Flask API | ||
| fetch('https://api.github.com/repos/elekto-io/elekto/releases/latest') |
There was a problem hiding this comment.
Am I reading this right? It seems to be pulling the latest version number from GitHub, rather than the version the user is actually running. Or did I miss something?
There was a problem hiding this comment.
my bad , i haven't thought through this
There was a problem hiding this comment.
should i run the bash script ' git describe --tags from the flask ' to get the current version?
now the current app version is fetched instead of latest version
|
@jberkus i made new approach to fetch the current version of the app use |
palnabarun
left a comment
There was a problem hiding this comment.
The canonical way to get version of a package is through importlib. Not sure how Elekto is deployed but the version needs to be embedded statically rather than computing on every page load.
Also, the PR has unrelated changes. What are those for?
| res.sort(key=lambda e: e["start_datetime"], reverse=True) | ||
|
|
||
| return F.render_template("views/elections/index.html", elections=res, status=status) | ||
| version = get_version(); |
There was a problem hiding this comment.
| version = get_version(); | |
| version = get_version() |
| res.sort(key=lambda e: e["start_datetime"], reverse=True) | ||
|
|
||
| return F.render_template("views/elections/index.html", elections=res, status=status) | ||
| version = get_version(); |
| def get_version(): | ||
| """Retrieve the app version using `git describe --tags`.""" | ||
| try: | ||
| process = subprocess.Popen(['git', 'describe', '--tags'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) |
There was a problem hiding this comment.
This will run the subprocess everytime rendering happens. This is not good.
There was a problem hiding this comment.
thank you so much for the feedback ,iam new to open source contributions i should implement new static way to fetch the app version
|
So, this feature has a prerequisite, which is to do proper pip packaging so that an accurate version number is available. |
fixes #96
now the elekto version is displayed in the visible place