Made the Notes thing more efficient

This commit is contained in:
Praneeth Bhandaru 2020-10-21 17:25:19 -04:00
parent 15372706e7
commit f37229e0e7
2 changed files with 10 additions and 5 deletions

View File

@ -2,6 +2,8 @@ from django.shortcuts import render
from .models import NotionPage
from django.conf import settings
import time
# Create your views here.
def meeting_overview(request):
@ -61,6 +63,8 @@ def getHtml(html_dict, meeting_dict, node):
def show_meeting(request, meeting_id):
now = time.time()
page = NotionPage.objects.get(url=settings.NOTION_URL).page
meeting = None
@ -77,7 +81,10 @@ def show_meeting(request, meeting_id):
q = [meeting]
while q and has_children(temp := q.pop(0)):
index = 0
while q and index < len(q) and has_children(temp := q[index]):
index += 1
for children in temp.children:
if children.parent in meeting_dict.keys():
@ -91,6 +98,4 @@ def show_meeting(request, meeting_id):
html_dict[children] = "<li class='" + block_type + "'>" + children.title.strip() + "<ul>{}</ul></li>"
html = getHtml(html_dict, meeting_dict, meeting)
print(html)
return render(request, "notes/meeting.html", {'html': html, 'title': title})

View File

@ -13,5 +13,5 @@ class Story(models.Model):
class Bar(models.Model):
name = models.CharField(max_length=50)
money_raised = models.FloatField()\
name = models.CharField(max_length=70)
money_raised = models.FloatField()