Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wdv 472 protection bug #153

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion validator_checker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,14 @@
elsif status_hash["doctemplatetype"] == "rsuite" || status_hash["bypass_validate"] == "true"
# right now we are not running validation for rsuite-docs; fixed layout/paper_copyedit exceptions would otherwise be in validator_py or val_macro
# catching them here until we get rsuite_validate.py integrated into validate_py.
if Val::Hashes.status_hash['msword_copyedit'] == false || Val::Hashes.status_hash['epub_format'] == false
if !File.file?(Val::Files.bookinfo_file) || Val::Hashes.status_hash['msword_copyedit'] == false || Val::Hashes.status_hash['epub_format'] == false
status_hash['bookmaker_ready'] = false
else
status_hash['bookmaker_ready'] = true
end
end

logger.info {"bookmaker_ready value: #{status_hash['bookmaker_ready']}"}

#update status file with new news!
Vldtr::Tools.write_json(status_hash, Val::Files.status_file)
9 changes: 6 additions & 3 deletions validator_lookups.rb
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,10 @@ def get_good_isbns(isbns_from_file, alt_isbn_array, status_hash, styled_isbns, l
end

#try lookup on filename isbn
if Val::Doc.filename_normalized =~ /9(7(8|9)|-7(8|9)|7-(8|9)|-7-(8|9))[0-9-]{10,14}/ && Val::Doc.extension =~ /.doc($|x$)/ && status_hash['password_protected'].empty? && Val::Hashes.isbn_hash['completed'] == true
if Val::Doc.filename_normalized =~ /9(7(8|9)|-7(8|9)|7-(8|9)|-7-(8|9))[0-9-]{10,14}/ &&
Val::Doc.extension =~ /.doc($|x$)/ &&
(status_hash['password_protected'].empty? || status_hash['doctemplatetype'] == "rsuite") &&
Val::Hashes.isbn_hash['completed'] == true
filename_isbn = Val::Doc.filename_normalized.match(/9(78|-78|7-8|78-|-7-8)[0-9-]{10,14}/).to_s.tr('-','').slice(0..12)
status_hash['filename_isbn']["isbn"] = filename_isbn
testlog, testlookup = testisbn(filename_isbn, "filename_isbn", status_hash)
Expand All @@ -376,7 +379,7 @@ def get_good_isbns(isbns_from_file, alt_isbn_array, status_hash, styled_isbns, l
end

#get isbns from json, verify checkdigit, create array of good isbns
if Val::Hashes.isbn_hash['completed'] == true && status_hash['password_protected'].empty?
if Val::Hashes.isbn_hash['completed'] == true && (status_hash['password_protected'].empty? || status_hash['doctemplatetype'] == "rsuite")
isbn_hash = Mcmlln::Tools.readjson(Val::Files.isbn_file)
unstyled_isbns = isbn_hash['programatically_styled_isbns']
styled_isbns = isbn_hash['styled_isbns']
Expand All @@ -386,7 +389,7 @@ def get_good_isbns(isbns_from_file, alt_isbn_array, status_hash, styled_isbns, l
alt_isbn_array, status_hash = get_good_isbns(unstyled_isbns, alt_isbn_array, status_hash, styled_isbns, logger)
end
else
logger.info {"isbn_check.json not present or unavailable, isbn_check "}
logger.warning {"isbn_check.json not present or unavailable, or isbn_check failed to complete"}
end

if !status_hash['isbn_match_ok'] #fatal mismatch, delete bookinfo file!
Expand Down