Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
c5e93f9
Add percent completion property to Evaluation model and update versio…
rhoadesScholar Apr 28, 2025
921bc8f
Fix download results URL path and update link in version template
rhoadesScholar Apr 28, 2025
5170857
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 28, 2025
f41f154
Add GHA to build image on PR request
jnywong Jun 15, 2025
f1c986b
Add GHA to build image on PR request
jnywong Jun 16, 2025
98f0e5e
Merge branch 'main' into results_view_update
jnywong Jun 16, 2025
d36a562
Merge branch 'main' into results_view_update
jnywong Jun 16, 2025
864c23c
Update publish-chart.yaml
jnywong Jun 16, 2025
7b20dc1
Remove docker login action
jnywong Jun 16, 2025
743d351
Add login action back
jnywong Jun 16, 2025
efb3957
Regenerate robot account credentials
jnywong Jun 16, 2025
47be808
Fix typo
jnywong Jun 16, 2025
1044a23
Publish chart on PR and push to main
jnywong Jun 16, 2025
9a4dc98
Remove extra GHA
jnywong Jun 16, 2025
a4981ec
Add on pull_request
jnywong Jun 16, 2025
c9a947e
Update GHA
jnywong Jun 16, 2025
31ca558
Merge branch '2i2c-org:results_view_update' into results_view_update
rhoadesScholar Jun 16, 2025
83bf4c1
Refactor version template for improved readability and structure
rhoadesScholar Jun 16, 2025
afbeb9e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 16, 2025
439ca6f
Update version.html
rhoadesScholar Jun 17, 2025
3b5db7f
Fix 'is_collaborator' logic
jnywong Jun 18, 2025
15c7cab
Fix function input
jnywong Jun 18, 2025
d74a072
Add if condition
jnywong Jun 18, 2025
8b90cbf
Update frx_challenges/web/views/versions.py
jnywong Jun 18, 2025
e3e11b0
Merge pull request #1 from 2i2c-org/results_view_update
rhoadesScholar Jun 18, 2025
dbd7287
Remove percent_complete property from Evaluation model and clean up v…
rhoadesScholar Jun 18, 2025
b2d12ba
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 18, 2025
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
40 changes: 0 additions & 40 deletions .github/workflows/build-image.yaml

This file was deleted.

47 changes: 9 additions & 38 deletions .github/workflows/publish-chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,40 +41,20 @@ jobs:

- uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Decide to publish or not
id: publishing
shell: python
run: |
import os
repo = "${{ github.repository }}"
event = "${{ github.event_name }}"
ref = "${{ github.event.ref }}"
publishing = ""
if (
repo == "2i2c-org/frx-challenges"
and event == "push"
and (
ref.startswith("refs/tags/")
or ref == "refs/heads/main"
)
):
publishing = "true"
print("Publishing chart")
with open(os.environ["GITHUB_OUTPUT"], "a") as f:
f.write(f"publishing={publishing}\n")
python-version: "3.12"

- name: Set up QEMU (for docker buildx)
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx (for chartpress multi-arch builds)
uses: docker/setup-buildx-action@v3

- name: Setup push rights to Quay.io
if: steps.publishing.outputs.publishing
run: |
docker login -u "${{ secrets.QUAY_USERNAME }}" -p "${{ secrets.QUAY_PASSWORD }}" quay.io
- name: Login to Quay.io
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}

- name: Set up push rights to frx-challenges-helm-chart
# This was setup by...
Expand All @@ -86,7 +66,6 @@ jobs:
# 3. Registering the public key (gh-pages.pub) as a deploy key
# with push rights for the 2i2c-org/frx-challenges-helm-chart repo:
# https://github.com/2i2c-org/frx-challenges-helm-chart/settings/keys
if: steps.publishing.outputs.publishing
run: |
mkdir -p ~/.ssh
ssh-keyscan github.com >> ~/.ssh/known_hosts
Expand All @@ -104,21 +83,13 @@ jobs:
git config --global user.email "[email protected]"
git config --global user.name "github-actions"

- name: Build image, push if necessary
env:
PUBLISHING: ${{ steps.publishing.outputs.publishing }}
- name: Build image and push
run: |
CHARTPRESS_ARGS=""
if [[ "${PUBLISHING}" == "true" ]]; then
CHARTPRESS_ARGS="--push"
fi
chartpress \
--builder docker-buildx \
--platform linux/amd64 --platform linux/arm64 \
${CHARTPRESS_ARGS}
--platform linux/amd64 --platform linux/arm64

- name: Publish chart with chartpress
if: steps.publishing.outputs.publishing
run: |
set -eux

Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,7 @@ cython_debug/

# MyST
_build

# VS Code
.DS_Store
.vscode/
11 changes: 9 additions & 2 deletions frx_challenges/web/templates/version.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,26 @@ <h2>
</h2>
<div class="row">
<div class="col-sm-6">
Status: <strong>{{ evaluation.status }}</strong>
Status:
{% if evaluation.status != "EVALUATED" and evaluation.status != "FAILED" %}
<strong>{{ evaluation.status }}</strong>
<a href="#" onclick="window.location.reload(); return false;">
<img alt="Check for updates" src="{% static 'web/arrow-repeat.svg' %}">
</a>
{% else %}
<strong>{{ evaluation.status }}</strong>
{% endif %}
</div>
<div class="col-sm-6 text-end">
{{ version.user.username }} uploaded <code>{{ version.filename }}</code> {{ version.created_at|timesince }} ago
{{ version.user.username }} uploaded <code>{{ version.filename }}</code> {{ version.created_at|timesince }}
ago
</div>
</div>
<div class="row py-4">
<h4>Result</h4>
{% if is_collaborator and evaluation.status == 'EVALUATED' %}
<a href="{% url 'download-results' version.id %}">Download results</a>
{% endif %}
{% if evaluation.status == 'EVALUATED' %}
{% for result_item in results_display %}
<div class="col">
Expand Down
3 changes: 3 additions & 0 deletions frx_challenges/web/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

urlpatterns = [
path("upload/<int:id>", versions.upload, name="upload"),
path(
"download-results/<int:id>", versions.download_results, name="download-results"
),
path("page/<slug:slug>", pages.view, name="page-view"),
path("file/<slug:slug>", pages.content_file, name="content-file"),
path("leaderboard", default.leaderboard, name="leaderboard"),
Expand Down
25 changes: 25 additions & 0 deletions frx_challenges/web/views/versions.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import json
import os
import tempfile

Expand Down Expand Up @@ -51,9 +52,32 @@ def upload(request: HttpRequest, id: int) -> HttpResponse:
)


@login_required
def download_results(request: HttpRequest, id: int) -> HttpResponse:
version = Version.objects.get(id=id)
is_collaborator = _validate_collaborator(request, id)
if not is_collaborator:
raise Http404(
"Full results files are only available to submission collaborators."
)
evaluation = version.latest_evaluation
if not evaluation.result:
raise Http404("No results available for this version.")

# Create a JSON response from the evaluation results
response = HttpResponse(
content_type="application/json",
)
response["Content-Disposition"] = f'attachment; filename="results_{id}.json"'

response.write(json.dumps(evaluation.result, indent=4))
return response


def view(request: HttpRequest, id: int) -> HttpResponse:
version = Version.objects.get(id=id)
evaluation = version.latest_evaluation
is_collaborator = _validate_collaborator(request, id)

results_display = []
if evaluation.result:
Expand All @@ -72,6 +96,7 @@ def view(request: HttpRequest, id: int) -> HttpResponse:
"version": version,
"evaluation": evaluation,
"results_display": results_display,
"is_collaborator": is_collaborator,
},
)

Expand Down
Loading