mirror of
https://github.com/janeczku/calibre-web
synced 2025-04-20 17:53:16 +00:00
Update error handling book table edit
This commit is contained in:
parent
08527ae3ce
commit
24fdadbeb6
@ -214,7 +214,7 @@ def table_get_custom_enum(c_id):
|
||||
@login_required_if_no_ano
|
||||
@edit_required
|
||||
def edit_list_book(param):
|
||||
vals = request.get_json() # form.to_dict(flat=False)
|
||||
vals = request.get_json()
|
||||
return edit_book_param(param, vals)
|
||||
|
||||
@editbook.route("/ajax/editselectedbooks", methods=['POST'])
|
||||
@ -232,40 +232,40 @@ def edit_selected_books():
|
||||
languages = d.get('languages')
|
||||
publishers = d.get('publishers')
|
||||
comments = d.get('comments')
|
||||
checkA = d.get('checkA')
|
||||
|
||||
vals = {
|
||||
"pk": selections,
|
||||
"value": None,
|
||||
"checkA": checkA,
|
||||
"checkA": d.get('checkA'),
|
||||
"checkT": d.get('checkT'),
|
||||
}
|
||||
if title:
|
||||
vals['value'] = title
|
||||
edit_book_param('title', vals)
|
||||
res_title = edit_book_param('title', vals)
|
||||
if title_sort:
|
||||
vals['value'] = title_sort
|
||||
edit_book_param('sort', vals)
|
||||
res1_tit_sort = edit_book_param('sort', vals)
|
||||
if author_sort:
|
||||
vals['value'] = author_sort
|
||||
edit_book_param('author_sort', vals)
|
||||
res_author_sort = edit_book_param('author_sort', vals)
|
||||
if authors:
|
||||
vals['value'] = authors
|
||||
edit_book_param('authors', vals)
|
||||
res_author = edit_book_param('authors', vals)
|
||||
if categories:
|
||||
vals['value'] = categories
|
||||
edit_book_param('tags', vals)
|
||||
res_cat = edit_book_param('tags', vals)
|
||||
if series:
|
||||
vals['value'] = series
|
||||
edit_book_param('series', vals)
|
||||
res_series = edit_book_param('series', vals)
|
||||
if languages:
|
||||
vals['value'] = languages
|
||||
edit_book_param('languages', vals)
|
||||
res_lang = edit_book_param('languages', vals)
|
||||
if publishers:
|
||||
vals['value'] = publishers
|
||||
edit_book_param('publishers', vals)
|
||||
res_pup = edit_book_param('publishers', vals)
|
||||
if comments:
|
||||
vals['value'] = comments
|
||||
edit_book_param('comments', vals)
|
||||
res_comments = edit_book_param('comments', vals)
|
||||
return json.dumps({'success': True})
|
||||
|
||||
# Separated from /editbooks so that /editselectedbooks can also use this
|
||||
@ -283,9 +283,16 @@ def edit_selected_books():
|
||||
@edit_required
|
||||
def edit_book_param(param, vals):
|
||||
elements = vals.get('pk',[])
|
||||
if not vals.get('value'):
|
||||
return jsonify(success=False, msg=_("Value is missing on request"))
|
||||
if not elements :
|
||||
return jsonify(success=False, msg=_("Oops! Selected book is unavailable. File does not exist or is not accessible"))
|
||||
ret = {}
|
||||
for elem in elements:
|
||||
book = calibre_db.get_book(elem)
|
||||
if not book:
|
||||
ret = jsonify(success=False, msg=_("Oops! Selected book is unavailable. File does not exist or is not accessible"))
|
||||
continue
|
||||
calibre_db.create_functions(config)
|
||||
sort_param = ""
|
||||
try:
|
||||
@ -325,7 +332,7 @@ def edit_book_param(param, vals):
|
||||
ret = jsonify(success=False, msg=rename_error)
|
||||
elif param == 'sort':
|
||||
book.sort = vals['value']
|
||||
ret = jsonify(success=True,newValue=book.sort)
|
||||
ret = jsonify(success=True, newValue=book.sort)
|
||||
elif param == 'comments':
|
||||
edit_book_comments(vals['value'], book)
|
||||
ret = jsonify(success=True, newValue=book.comments[0].text)
|
||||
|
@ -37,20 +37,20 @@
|
||||
<div class="row">
|
||||
<div class="col-xs-6 col-md-6 col-sm-offset-3" style="margin-top:50px;">
|
||||
|
||||
<p class='text-justify attribute'><strong>Start Time: </strong>2024-12-12 21:32:32</p>
|
||||
<p class='text-justify attribute'><strong>Start Time: </strong>2024-12-13 18:37:11</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6 col-md-6 col-sm-offset-3">
|
||||
|
||||
<p class='text-justify attribute'><strong>Stop Time: </strong>2024-12-13 04:26:53</p>
|
||||
<p class='text-justify attribute'><strong>Stop Time: </strong>2024-12-14 01:56:41</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6 col-md-6 col-sm-offset-3">
|
||||
<p class='text-justify attribute'><strong>Duration: </strong>5h 49 min</p>
|
||||
<p class='text-justify attribute'><strong>Duration: </strong>6h 13 min</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -2030,13 +2030,13 @@
|
||||
|
||||
|
||||
|
||||
<tr id="su" class="errorClass">
|
||||
<tr id="su" class="failClass">
|
||||
<td>TestLoadMetadata</td>
|
||||
<td class="text-center">1</td>
|
||||
<td class="text-center">0</td>
|
||||
<td class="text-center">0</td>
|
||||
<td class="text-center">1</td>
|
||||
<td class="text-center">0</td>
|
||||
<td class="text-center">0</td>
|
||||
<td class="text-center">
|
||||
<a onclick="showClassDetail('c18', 1)">Detail</a>
|
||||
</td>
|
||||
@ -2044,26 +2044,26 @@
|
||||
|
||||
|
||||
|
||||
<tr id="et18.1" class="none bg-info">
|
||||
<tr id="ft18.1" class="none bg-danger">
|
||||
<td>
|
||||
<div class='testcase'>TestLoadMetadata - test_load_metadata</div>
|
||||
</td>
|
||||
<td colspan='6'>
|
||||
<div class="text-center">
|
||||
<a class="popup_link text-center" onfocus='blur()' onclick="showTestDetail('div_et18.1')">ERROR</a>
|
||||
<a class="popup_link text-center" onfocus='blur()' onclick="showTestDetail('div_ft18.1')">FAIL</a>
|
||||
</div>
|
||||
<!--css div popup start-->
|
||||
<div id="div_et18.1" class="popup_window test_output" style="display:block;">
|
||||
<div id="div_ft18.1" class="popup_window test_output" style="display:block;">
|
||||
<div class='close_button pull-right'>
|
||||
<button type="button" class="close" aria-label="Close" onfocus="this.blur();"
|
||||
onclick="document.getElementById('div_et18.1').style.display='none'"><span
|
||||
onclick="document.getElementById('div_ft18.1').style.display='none'"><span
|
||||
aria-hidden="true">×</span></button>
|
||||
</div>
|
||||
<div class="text-left pull-left">
|
||||
<pre class="text-left">Traceback (most recent call last):
|
||||
File "/home/ozzie/Development/calibre-web-test/test/test_edit_books_metadata.py", line 99, in test_load_metadata
|
||||
if results[cont]['source'] == 'https://comicvine.gamespot.com/':
|
||||
IndexError: list index out of range</pre>
|
||||
File "/home/ozzie/Development/calibre-web-test/test/test_edit_books_metadata.py", line 220, in test_load_metadata
|
||||
self.assertLessEqual(diff(BytesIO(cover), BytesIO(new_cover), delete_diff_file=True), 0.02)
|
||||
AssertionError: 0.02499824076612272 not less than or equal to 0.02</pre>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
@ -3539,11 +3539,11 @@ IndexError: list index out of range</pre>
|
||||
|
||||
|
||||
|
||||
<tr id="su" class="failClass">
|
||||
<tr id="su" class="passClass">
|
||||
<td>TestMergeBooksList</td>
|
||||
<td class="text-center">2</td>
|
||||
<td class="text-center">1</td>
|
||||
<td class="text-center">1</td>
|
||||
<td class="text-center">2</td>
|
||||
<td class="text-center">0</td>
|
||||
<td class="text-center">0</td>
|
||||
<td class="text-center">0</td>
|
||||
<td class="text-center">
|
||||
@ -3562,31 +3562,11 @@ IndexError: list index out of range</pre>
|
||||
|
||||
|
||||
|
||||
<tr id="ft37.2" class="none bg-danger">
|
||||
<tr id='pt37.2' class='hiddenRow bg-success'>
|
||||
<td>
|
||||
<div class='testcase'>TestMergeBooksList - test_delete_book</div>
|
||||
</td>
|
||||
<td colspan='6'>
|
||||
<div class="text-center">
|
||||
<a class="popup_link text-center" onfocus='blur()' onclick="showTestDetail('div_ft37.2')">FAIL</a>
|
||||
</div>
|
||||
<!--css div popup start-->
|
||||
<div id="div_ft37.2" class="popup_window test_output" style="display:block;">
|
||||
<div class='close_button pull-right'>
|
||||
<button type="button" class="close" aria-label="Close" onfocus="this.blur();"
|
||||
onclick="document.getElementById('div_ft37.2').style.display='none'"><span
|
||||
aria-hidden="true">×</span></button>
|
||||
</div>
|
||||
<div class="text-left pull-left">
|
||||
<pre class="text-left">Traceback (most recent call last):
|
||||
File "/home/ozzie/Development/calibre-web-test/test/test_merge_books_list.py", line 67, in test_delete_book
|
||||
self.assertTrue(self.check_element_on_page((By.ID, "flash_warning")))
|
||||
AssertionError: False is not true</pre>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<!--css div popup end-->
|
||||
</td>
|
||||
<td colspan='6' align='center'>PASS</td>
|
||||
</tr>
|
||||
|
||||
|
||||
@ -5821,9 +5801,9 @@ AssertionError: False is not true</pre>
|
||||
<tr id='total_row' class="text-center bg-grey">
|
||||
<td>Total</td>
|
||||
<td>523</td>
|
||||
<td>514</td>
|
||||
<td>1</td>
|
||||
<td>515</td>
|
||||
<td>1</td>
|
||||
<td>0</td>
|
||||
<td>7</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
@ -6368,7 +6348,7 @@ AssertionError: False is not true</pre>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
drawCircle(514, 1, 1, 7);
|
||||
drawCircle(515, 1, 0, 7);
|
||||
showCase(5);
|
||||
</script>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user