From 661d415e50e1f7bb00353f3bd721ee8bed517fa7 Mon Sep 17 00:00:00 2001 From: tlaloc911 <29415755+tlaloc911@users.noreply.github.com> Date: Wed, 15 Jun 2022 21:18:44 -0500 Subject: [PATCH 1/5] To retrieve the set number correctly when the app is mounted as a subfolder --- static/javascript/set-study.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/static/javascript/set-study.js b/static/javascript/set-study.js index 4be8c11..1712cff 100644 --- a/static/javascript/set-study.js +++ b/static/javascript/set-study.js @@ -52,7 +52,8 @@ function shuffleArray(array) { $(document).ready(function(){ let pathArray = window.location.pathname.split('/'); - let set_id = pathArray[2]; + let max_occur = pathArray.length; + let set_id = pathArray[Number(max_occur-2)]; let total_sides, total_cards, sides, cards, cards_shuffled; let side_order = {}; $.get("../../api/set_info?set=" + set_id, function(data, status){ From 30a21c11e4d0a1f4097995d1cce9765542517458 Mon Sep 17 00:00:00 2001 From: tlaloc911 <29415755+tlaloc911@users.noreply.github.com> Date: Wed, 15 Jun 2022 21:19:40 -0500 Subject: [PATCH 2/5] remove a blankspace in the address --- templates/base.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/base.html b/templates/base.html index 9885d29..cf050a7 100644 --- a/templates/base.html +++ b/templates/base.html @@ -11,7 +11,7 @@ Flexcards - + @@ -110,4 +110,4 @@

Create a set

Public sets are viewable by anyone, while private sets can only be seen by you. Regardless of whether a set is public or private, only you can edit and delete it.

You can play around with adding or removing sides and cards - these are flexible flashcards!

-{% endblock %} \ No newline at end of file +{% endblock %} From 0186abf54b551aaca72f3b149e17fdd8ec42259c Mon Sep 17 00:00:00 2001 From: tlaloc911 <29415755+tlaloc911@users.noreply.github.com> Date: Wed, 15 Jun 2022 21:22:24 -0500 Subject: [PATCH 4/5] Update set.html --- templates/set.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/set.html b/templates/set.html index c99fc44..2d0405c 100644 --- a/templates/set.html +++ b/templates/set.html @@ -1,7 +1,7 @@ {% extends "base.html" %} {% block head %} {{ super() }} - + {% endblock %} {% block body %}
@@ -46,4 +46,4 @@
Creator: {{ user.name }}
{% block modalContent %}

In this view, you can see a quick overview of a set.

From here, you can study the set. If you own it, you can also edit or delete it.

-{% endblock %} \ No newline at end of file +{% endblock %} From e55f09ae20de04995274cb2e16356a34762975d3 Mon Sep 17 00:00:00 2001 From: tlaloc911 <29415755+tlaloc911@users.noreply.github.com> Date: Thu, 16 Jun 2022 22:46:58 -0500 Subject: [PATCH 5/5] Fix card and side indexes to create more than 10 rows --- queries.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/queries.py b/queries.py index 9896add..a27d1da 100644 --- a/queries.py +++ b/queries.py @@ -106,8 +106,9 @@ def process_form(form, user): # creates a set owned by the given user using the cells = [] cell_fields = dict(filter(lambda elem: 'cell' in elem[0] and 'cell[0]' not in elem[0], form.items())) # non-"side name" cells for field in cell_fields: - card_index = int(field[5:6])-1 - side_index = int(field[-2:-1]) + card_index = int(field[5:-1:].split('][')[0]) - 1 + side_index = int(field[5:-1:].split('][')[1]) + cell = {'card_id': card_index+card_id, 'side_id': side_id+side_index, 'info': form[field]} cells.append(cell) cells_result = db.engine.execute(Cell_SQL.__table__.insert(), cells)