Procházet zdrojové kódy

randomly order resources when on regular view

joel
Simon Bowie před 1 rokem
rodič
revize
55671f78ac
3 změnil soubory, kde provedl 6 přidání a 3 odebrání
  1. +2
    -1
      web/app/book.py
  2. +2
    -1
      web/app/practice.py
  3. +2
    -1
      web/app/tool.py

+ 2
- 1
web/app/book.py Zobrazit soubor

@@ -13,6 +13,7 @@ from .resources import *
from .relationships import *
from . import db
import os
from sqlalchemy.sql import func

book = Blueprint('book', __name__)

@@ -21,7 +22,7 @@ book = Blueprint('book', __name__)
def get_books():
view = request.args.get('view')
resource_type = 'book'
books_query = Resource.query.filter_by(type=resource_type)
books_query = Resource.query.filter_by(type=resource_type).order_by(func.random())
for key in request.args.keys():
if key != 'view':
if (key == 'practice' and request.args.get(key) != ''):

+ 2
- 1
web/app/practice.py Zobrazit soubor

@@ -14,6 +14,7 @@ from .relationships import *
from . import db
import os
import markdown
from sqlalchemy.sql import func

practice = Blueprint('practice', __name__)

@@ -21,7 +22,7 @@ practice = Blueprint('practice', __name__)
@practice.route('/practices')
def get_practices():
view = request.args.get('view')
practices = Resource.query.filter_by(type='practice').all()
practices = Resource.query.filter_by(type='practice').order_by(func.random()).all()
# get number of practices
count = len(practices)
if view != 'list':

+ 2
- 1
web/app/tool.py Zobrazit soubor

@@ -13,6 +13,7 @@ from .resources import *
from .relationships import *
from . import db
import os
from sqlalchemy.sql import func

tool = Blueprint('tool', __name__)

@@ -21,7 +22,7 @@ tool = Blueprint('tool', __name__)
def get_tools():
view = request.args.get('view')
resource_type = 'tool'
tools_query = Resource.query.filter_by(type=resource_type)
tools_query = Resource.query.filter_by(type=resource_type).order_by(func.random())
for key in request.args.keys():
if key != 'view':
if (key == 'practice' and request.args.get(key) != ''):

Načítá se…
Zrušit
Uložit