Просмотр исходного кода

분류 중복 관련 버그 수정

https://github.com/openNAMU/openNAMU/issues/1944
잉여개발기 (SPDV) 2 лет назад
Родитель
Сommit
a013ed64e3
2 измененных файлов с 2 добавлено и 10 удалено
  1. 1 1
      route/view_read.py
  2. 1 9
      route/view_xref.py

+ 1 - 1
route/view_read.py

@@ -32,7 +32,7 @@ def view_read(name = 'Test', doc_rev = '', doc_from = '', do_type = ''):
             count_sub_category = 0
             count_category = 0
 
-            curs.execute(db_change("select link from back where title = ? and type = 'cat' order by link asc"), [name])
+            curs.execute(db_change("select distinct link from back where title = ? and type = 'cat' order by link asc"), [name])
             category_sql = curs.fetchall()
             for data in category_sql:
                 link_view = data[0]

+ 1 - 9
route/view_xref.py

@@ -26,15 +26,7 @@ def view_xref(name = 'Test', xref_type = 1):
         link_case_insensitive = ' collate nocase' if db_data and db_data[0][0] != '' else ''
 
         sql_insert = ['link', 'title'] if xref_type == 1 else ['title', 'link']
-        curs.execute(db_change("" + \
-            "select distinct " + sql_insert[0] + ", type from back " + \
-            "where " + sql_insert[1] + " = ?" + link_case_insensitive + " and not type = 'no' and not type = 'nothing' " + \
-            "order by type asc, " + sql_insert[0] + " asc limit ?, 50" + \
-        ""), [
-            name,
-            sql_num
-        ])
-
+        curs.execute(db_change("select distinct " + sql_insert[0] + ", type from back where " + sql_insert[1] + " = ?" + link_case_insensitive + " and not type = 'no' and not type = 'nothing' order by type asc, " + sql_insert[0] + " asc limit ?, 50"), [name, sql_num])
         data_list = curs.fetchall()
         for data in data_list:
             div += '<li><a href="/w/' + url_pas(data[0]) + '">' + html.escape(data[0]) + '</a>'