Skip to content

Commit

Permalink
trying to fix Vis informasjon so that it shows up
Browse files Browse the repository at this point in the history
  • Loading branch information
ellenyuX committed Oct 15, 2024
1 parent 3517e6f commit 1869579
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
18 changes: 10 additions & 8 deletions src/admin/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,16 @@ def admin_page(action):
return json.dumps(response), 200

elif action == "status":
new_blob_image_count = storage.image_count()
iteration = classifier.get_iteration()
current_app.logger.info(shared_models.get_games_played())
data = {
"CV_iteration_name": iteration.name,
"CV_time_created": str(iteration.created),
"BLOB_image_count": new_blob_image_count,
}
try:
new_blob_image_count = storage.image_count()
iteration = classifier.get_iteration()
data = {
"CV_iteration_name": iteration.name,
"CV_time_created": str(iteration.created),
"BLOB_image_count": new_blob_image_count,
}
except Exception as e:
current_app.logger.error("Something in admin/status failed: " + e)
return json.dumps(data), 200

elif action == "logging":
Expand Down
2 changes: 1 addition & 1 deletion src/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,7 @@ def get_scores_count_per_month(year):
extract("month", Scores.date).label("month"),
func.count(Scores.score).label("score_count"),
)
.filter(extract("year", Scores.date) == 2024)
.filter(extract("year", Scores.date) == year)
.group_by(extract("month", Scores.date))
.all()
)
Expand Down
7 changes: 4 additions & 3 deletions src/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,14 @@ def create_container():

def image_count():
"""
Returns number of images in 'newimgcontainer'.
Returns number of images in relevant container.
"""
container_client = blob_connection()
container_client = blob_connection(Keys.get("CONTAINER_NAME"))

return container_client.get_container_properties().metadata["image_count"]


def blob_connection(container_name=setup.CONTAINER_NAME_NEW):
def blob_connection(container_name):
"""
Helper method for connection to blob service.
"""
Expand Down

0 comments on commit 1869579

Please sign in to comment.