Skip to content

Commit

Permalink
Merge branch 'master' of github:Nabla-NTNU/nablaweb
Browse files Browse the repository at this point in the history
automatic merge of divergent branches
  • Loading branch information
tncrdk committed Jan 6, 2025
2 parents de245dd + 8c36060 commit 44428a1
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
4 changes: 0 additions & 4 deletions nablapps/contact/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ def make_contact_context(request, spam_check, test_val):
("Ambassadør", "ambassador"),
("Bryggemester", "bryggemester"),
("Kjellersjef", "kjellersjef"),
("Leder av Gravitones", "leder.gravitones"),
("Leder av KontorKom", "leder.kontorkom"),
("Leder av Koreolis", "koreolis.kraften"),
("Leder av ProKom", "leder.prokom"),
Expand All @@ -171,9 +170,6 @@ def make_contact_context(request, spam_check, test_val):
("Arrkom", "arrkom"),
("BN - Bedriftkontakten Nabla", "bedkom"),
("Eurekakom", "eureka"),
("Educom", "educom"),
("Excom17", "ekskom2019"),
("Excom18", "excom18"),
("Kjellersamarbeidet (Nabla, HC, Janus)", "kjellern.hk18"),
("Kontorkom", "kontorkom"),
("Koreolis", "koreolis"),
Expand Down
2 changes: 1 addition & 1 deletion nablapps/core/templates/core/general_about.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ <h1>Linjeforeningen Nabla</h1>
<p class=>
Nabla er linjeforeningen for sivilingeniørprogrammet Fysikk og matematikk ved NTNU. Du kan lese mer om studiet på NTNU sine nettsider. På denne nettsiden finner du informasjon om studiet, linjeforeningen, og hva som foregår. Ta gjerne turen innom nablakontoret i kontortida for kaffe, vafler og en hyggelig prat. Vi selger også kompendier.
<br><br>
<b>Styremøter torsdager kl.10:15-12:00</b><br>
<b>Styremøter tirsdager kl.08:15-10:00 i R41</b><br>
Styret har ukentlige møter, og her har du som komponent møterett. Om du vil komme innom på et av møtene våre, ta kontakt med et av styremedlemmene, eller hele styret:
nabla@nabla.no
</p>
Expand Down
11 changes: 7 additions & 4 deletions nablapps/interactive/models/code_golf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import json

from django import template
from django.contrib.auth.models import AnonymousUser
from django.db import models
from django.db.models.functions import Concat
from django.utils import timezone
Expand Down Expand Up @@ -68,10 +69,12 @@ def best_by_user(self, task, prefetch_user=True):

def best_specific_user(self, task, user):
"""Gets the best result for a specific user. Returns result object"""

best_result = (
Result.objects.filter(user=user, task=task).order_by("length").first()
)
if user != AnonymousUser():
best_result = (
Result.objects.filter(user=user, task=task).order_by("length").first()
)
else:
best_result = None

return best_result

Expand Down
6 changes: 5 additions & 1 deletion nablapps/interactive/templates/interactive/code_golf.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,14 @@ <h3>{{ task }}</h3>
{% csrf_token %}
{{ form.as_p }}
<button class="btn btn-nabla-blue-dark mr-1" type="button" @click="runit">Kjør</button>
{% if logged_in %}
<input class="btn btn-secondary" type="submit" value="Send" :disabled="status!='correct'" />
{% endif %}
<br />
</form>

<pre v-if="errors" class="alert alert-warning" id="error">[[ errors ]]</pre>
<div v-if="status=='correct'" class="alert alert-success">Riktig output!</div>
<div v-if="status=='correct'" class="alert alert-success">Riktig output! Din skår: [[ outputLength ]] tegn!</div>
<div v-if="longerThanBest" class="alert alert-warning">Koden din er lengre enn den beste du har sendt inn. Du kan sende den inn, men skåren din vil ikke endres.</div>
<pre v-if="output" class="alert alert-primary">
<h4 class="alert-heading">Output:</h4>
Expand All @@ -82,6 +84,7 @@ <h4 class="alert-heading">Output:</h4>
status: null, // One of "correct", "incorrect", "spinning"
user_code: null,
output: null,
outputLength: null,
longerThanBest: false
}
},
Expand Down Expand Up @@ -115,6 +118,7 @@ <h4 class="alert-heading">Output:</h4>
this.status = "correct"
this.errors = null
this.longerThanBest = outputLength > shortestSolution
this.outputLength = outputLength
} else {
this.status = "incorrect"
this.errors = "Output does not match correct output."
Expand Down
5 changes: 3 additions & 2 deletions nablapps/interactive/views/code_golf.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def clean(self):
raise ValidationError("Output does not match correct output")


class CodeGolf(LoginRequiredMixin, CreateView):
class CodeGolf(CreateView):
"""View for writing and submitting solutions"""

model = Result
Expand Down Expand Up @@ -88,6 +88,7 @@ def get_context_data(self, **kwargs):
else:
best_result_length = best_result.length
context["best_attempt"] = best_result_length
context["logged_in"] = True if self.request.user.is_authenticated else False
return context

def form_valid(self, form):
Expand Down Expand Up @@ -142,7 +143,7 @@ def code_golf_score(request, task_id):
return render(request, "interactive/code_golf_score.html", context)


class CodeTaskListView(LoginRequiredMixin, ListView):
class CodeTaskListView(ListView):
model = CodeTask

def get_context_data(self, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion nablapps/podcast/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def get_context_data(self, **kwargs):
return data


class RssView(LoginRequiredMixin, ListView):
class RssView(ListView):
template_name = "podcast/podcast.rss"
content_type = "application/xml"
model = Podcast
Expand Down
10 changes: 3 additions & 7 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ <h5 class="modal-title" id="exampleModalLongTitle">Ny student?</h5>
<a class="dropdown-item" href="{% url "games_list" %}">Spill</a>
<a class="dropdown-item" href="{% url "news_list" %}">Nyheter</a>
<!-- <a class="dropdown-item" href="{% url "blog" %}">Blogg</a> -->
<a class="dropdown-item" href="{% url "advent_calendar" "2023" %}">Joulekalender 2023</a>
<a class="dropdown-item" href="{% url "advent_calendar" "2024" %}">Joulekalender 2024</a>

<li class="nav-item mr-1 dropdown ">
<a href="#ting" class="nav-link dropdown-toggle text-light" data-toggle="dropdown" id="navbarDropdown1" role="button" aria-haspopup="true" aria-expanded="false">
Expand Down Expand Up @@ -318,9 +318,9 @@ <h5 class="modal-title" id="exampleModalLongTitle">Ny student?</h5>

{# Kan aktiveres igjen ved neste undergruppe-valg #}
{# if user.is_authenticated #}
<li class="nav-item mr-1 ">
<!--<li class="nav-item mr-1 ">
<a class="nav-link text-light" href="/application/">Søk undergruppe</a>
</li>
</li>-->
{# endif #}

</ul>
Expand Down Expand Up @@ -489,10 +489,6 @@ <h2>Informasjon</h2>
<p>
Organisasjonsnr.: <span class="float-right">992168544</span><br />
Hovedkonto: <span class="float-right">1503.13.57338</span><br />
Bedriftskontakten-konto: <span class="float-right">1503.13.57311</span><br />
Arrkomkonto: <span class="float-right">1503.13.57400</span><br />
ProKom-konto: <span class="float-right">1503.13.57338</span><br />
Gravitoneskonto: <span class="float-right">1503.65.97965</span><br />
</p>


Expand Down

0 comments on commit 44428a1

Please sign in to comment.