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

Elizaveta Shved - 0 #38

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open

Conversation

elishved
Copy link

@elishved elishved commented Dec 9, 2018

Name

Elizaveta Shved

Homework#

0

Comment

Level 1, 2 and 3.

Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some files could not be reviewed due to errors:

Error: We found some problems with your configuration file: [/IrresponsibleMo...
Error: We found some problems with your configuration file: [/IrresponsibleModule] key 'IrresponsibleModule:' is undefined., [/DuplicateMethodCall] key 'DuplicateMethodCall:' is undefined., [/UtilityFunction] key 'UtilityFunction:' is undefined.
Warning: unrecognized cop Naming/UncommunicativeMethodArgName found in .ruboc...
Warning: unrecognized cop Naming/UncommunicativeMethodArgName found in .rubocop.yml
Warning: unrecognized cop Style/MethodMissingSuper found in .rubocop.yml
Warning: unrecognized cop Style/MissingRespondToMissing found in .rubocop.yml
incompatible character encodings: UTF-8 and ASCII-8BIT
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/result_cache.rb:135:in `file_checksum'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/result_cache.rb:85:in `initialize'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/runner.rb:117:in `new'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/runner.rb:117:in `file_offense_cache'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/runner.rb:109:in `file_offenses'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/runner.rb:100:in `process_file'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/runner.rb:78:in `block in each_inspected_file'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/runner.rb:75:in `each'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/runner.rb:75:in `reduce'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/runner.rb:75:in `each_inspected_file'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/runner.rb:67:in `inspect_files'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/runner.rb:39:in `run'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/cli.rb:156:in `execute_runner'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/cli.rb:84:in `execute_runners'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/cli.rb:41:in `run'
/home/linters/.bundle/gems/rubocop-0.54.0/bin/rubocop:13:in `block in '
/usr/lib/ruby/2.5.0/benchmark.rb:308:in `realtime'
/home/linters/.bundle/gems/rubocop-0.54.0/bin/rubocop:12:in `'
/home/linters/.bundle/bin/rubocop:23:in `load'
/home/linters/.bundle/bin/rubocop:23:in `'
Inspecting 1 file

0 files inspected, no offenses detected

Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some files could not be reviewed due to errors:

Error: We found some problems with your configuration file: [/IrresponsibleMo...
Error: We found some problems with your configuration file: [/IrresponsibleModule] key 'IrresponsibleModule:' is undefined., [/DuplicateMethodCall] key 'DuplicateMethodCall:' is undefined., [/UtilityFunction] key 'UtilityFunction:' is undefined.
Warning: unrecognized cop Naming/UncommunicativeMethodArgName found in .ruboc...
Warning: unrecognized cop Naming/UncommunicativeMethodArgName found in .rubocop.yml
Warning: unrecognized cop Style/MethodMissingSuper found in .rubocop.yml
Warning: unrecognized cop Style/MissingRespondToMissing found in .rubocop.yml
incompatible character encodings: UTF-8 and ASCII-8BIT
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/result_cache.rb:135:in `file_checksum'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/result_cache.rb:85:in `initialize'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/runner.rb:117:in `new'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/runner.rb:117:in `file_offense_cache'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/runner.rb:109:in `file_offenses'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/runner.rb:100:in `process_file'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/runner.rb:78:in `block in each_inspected_file'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/runner.rb:75:in `each'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/runner.rb:75:in `reduce'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/runner.rb:75:in `each_inspected_file'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/runner.rb:67:in `inspect_files'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/runner.rb:39:in `run'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/cli.rb:156:in `execute_runner'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/cli.rb:84:in `execute_runners'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/cli.rb:41:in `run'
/home/linters/.bundle/gems/rubocop-0.54.0/bin/rubocop:13:in `block in '
/usr/lib/ruby/2.5.0/benchmark.rb:308:in `realtime'
/home/linters/.bundle/gems/rubocop-0.54.0/bin/rubocop:12:in `'
/home/linters/.bundle/bin/rubocop:23:in `load'
/home/linters/.bundle/bin/rubocop:23:in `'
Inspecting 1 file

0 files inspected, no offenses detected

Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some files could not be reviewed due to errors:

Error: We found some problems with your configuration file: [/IrresponsibleMo...
Error: We found some problems with your configuration file: [/IrresponsibleModule] key 'IrresponsibleModule:' is undefined., [/DuplicateMethodCall] key 'DuplicateMethodCall:' is undefined., [/UtilityFunction] key 'UtilityFunction:' is undefined.

elizaveta_shved/elizaaveta_shved_0/run.rb Outdated Show resolved Hide resolved
elizaveta_shved/elizaaveta_shved_0/run.rb Outdated Show resolved Hide resolved
elizaveta_shved/elizaaveta_shved_0/download_sheets.rb Outdated Show resolved Hide resolved
elizaveta_shved/elizaaveta_shved_0/download_sheets.rb Outdated Show resolved Hide resolved
elizaveta_shved/elizaaveta_shved_0/download_sheets.rb Outdated Show resolved Hide resolved
elizaveta_shved/elizaaveta_shved_0/download_sheets.rb Outdated Show resolved Hide resolved
elizaveta_shved/elizaaveta_shved_0/download_sheets.rb Outdated Show resolved Hide resolved
elizaveta_shved/elizaaveta_shved_0/download_sheets.rb Outdated Show resolved Hide resolved
elizaveta_shved/elizaaveta_shved_0/download_sheets.rb Outdated Show resolved Hide resolved
elizaveta_shved/elizaaveta_shved_0/download_sheets.rb Outdated Show resolved Hide resolved
Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some files could not be reviewed due to errors:

Error: We found some problems with your configuration file: [/IrresponsibleMo...
Error: We found some problems with your configuration file: [/IrresponsibleModule] key 'IrresponsibleModule:' is undefined., [/DuplicateMethodCall] key 'DuplicateMethodCall:' is undefined., [/UtilityFunction] key 'UtilityFunction:' is undefined.

Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some files could not be reviewed due to errors:

Error: We found some problems with your configuration file: [/IrresponsibleMo...
Error: We found some problems with your configuration file: [/IrresponsibleModule] key 'IrresponsibleModule:' is undefined., [/DuplicateMethodCall] key 'DuplicateMethodCall:' is undefined., [/UtilityFunction] key 'UtilityFunction:' is undefined.
Warning: unrecognized cop Naming/UncommunicativeMethodArgName found in .ruboc...
Warning: unrecognized cop Naming/UncommunicativeMethodArgName found in .rubocop.yml
Warning: unrecognized cop Style/MethodMissingSuper found in .rubocop.yml
Warning: unrecognized cop Style/MissingRespondToMissing found in .rubocop.yml
incompatible character encodings: UTF-8 and ASCII-8BIT
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/result_cache.rb:135:in `file_checksum'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/result_cache.rb:85:in `initialize'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/runner.rb:117:in `new'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/runner.rb:117:in `file_offense_cache'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/runner.rb:109:in `file_offenses'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/runner.rb:100:in `process_file'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/runner.rb:78:in `block in each_inspected_file'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/runner.rb:75:in `each'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/runner.rb:75:in `reduce'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/runner.rb:75:in `each_inspected_file'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/runner.rb:67:in `inspect_files'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/runner.rb:39:in `run'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/cli.rb:156:in `execute_runner'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/cli.rb:84:in `execute_runners'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/cli.rb:41:in `run'
/home/linters/.bundle/gems/rubocop-0.54.0/bin/rubocop:13:in `block in '
/usr/lib/ruby/2.5.0/benchmark.rb:308:in `realtime'
/home/linters/.bundle/gems/rubocop-0.54.0/bin/rubocop:12:in `'
/home/linters/.bundle/bin/rubocop:23:in `load'
/home/linters/.bundle/bin/rubocop:23:in `'
Inspecting 1 file

0 files inspected, no offenses detected

Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some files could not be reviewed due to errors:

Error: We found some problems with your configuration file: [/IrresponsibleMo...
Error: We found some problems with your configuration file: [/IrresponsibleModule] key 'IrresponsibleModule:' is undefined., [/DuplicateMethodCall] key 'DuplicateMethodCall:' is undefined., [/UtilityFunction] key 'UtilityFunction:' is undefined.
Warning: unrecognized cop Naming/UncommunicativeMethodArgName found in .ruboc...
Warning: unrecognized cop Naming/UncommunicativeMethodArgName found in .rubocop.yml
Warning: unrecognized cop Style/MethodMissingSuper found in .rubocop.yml
Warning: unrecognized cop Style/MissingRespondToMissing found in .rubocop.yml
incompatible character encodings: UTF-8 and ASCII-8BIT
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/result_cache.rb:135:in `file_checksum'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/result_cache.rb:85:in `initialize'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/runner.rb:117:in `new'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/runner.rb:117:in `file_offense_cache'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/runner.rb:109:in `file_offenses'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/runner.rb:100:in `process_file'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/runner.rb:78:in `block in each_inspected_file'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/runner.rb:75:in `each'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/runner.rb:75:in `reduce'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/runner.rb:75:in `each_inspected_file'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/runner.rb:67:in `inspect_files'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/runner.rb:39:in `run'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/cli.rb:156:in `execute_runner'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/cli.rb:84:in `execute_runners'
/home/linters/.bundle/gems/rubocop-0.54.0/lib/rubocop/cli.rb:41:in `run'
/home/linters/.bundle/gems/rubocop-0.54.0/bin/rubocop:13:in `block in '
/usr/lib/ruby/2.5.0/benchmark.rb:308:in `realtime'
/home/linters/.bundle/gems/rubocop-0.54.0/bin/rubocop:12:in `'
/home/linters/.bundle/bin/rubocop:23:in `load'
/home/linters/.bundle/bin/rubocop:23:in `'
Inspecting 1 file

0 files inspected, no offenses detected

elizaveta_shved/elizaaveta_shved_0/data_parser.rb Outdated Show resolved Hide resolved
elizaveta_shved/elizaaveta_shved_0/data_parser.rb Outdated Show resolved Hide resolved
elizaveta_shved/elizaaveta_shved_0/data_parser.rb Outdated Show resolved Hide resolved
elizaveta_shved/elizaaveta_shved_0/data_parser.rb Outdated Show resolved Hide resolved
elizaveta_shved/elizaaveta_shved_0/data_parser.rb Outdated Show resolved Hide resolved
@RGBD RGBD self-assigned this Dec 10, 2018
Copy link
Collaborator

@RGBD RGBD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Решение использовать sqlite - супер 👏
Структура папок: Имя Фамилия/Номер/.

end
end

def generate_links_2009
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Упрости загрузку страниц. Есть Nokogiri, спомощью которого можно скачать и распарсить главную страницу белстата, получить все ссылки на файлы, а потом по скачанным файлам восстановить даты.
Плохо, что есть куча методов, которые возвращают список ссылок.
Также можно создать json файл информацией о ссылках на документы и датах, прочитать его, и скачать указанные там файлы.

def download_file(date, link, type)
response = Faraday.get(link)
begin
file = File.open("./data/#{date}.#{type}", "w")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Если можно избежать явного открытия файла, стоит так сделать
варианты:

File.open(...) do |file|
  file.write...
end

или

File.write(filename, response.body)


def check_data
File.new('test.db', 'a')
@db = SQLite3::Database.open 'test.db'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

раз создаётся test.rb он должен быть добавлен в .gitignore

class Waiter
def check_files
FileUtils.mkdir_p './data'
Dir['./data/*.*'].count < 100 ? DownloadSheets.new.perform_data : true
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

100 стоит вынести в константу, если это точное число файлов.
Поскольку perform_data возвращает 10, предполагаю что результат этого метода не важен.
Можно заменить на
DownloadSheets.new.perform_data if count < 100

mogilev_region = mogilev_region / AMOUNT_FOR_DENOMOZATION if !mogilev_region.nil?
end

@db.execute "INSERT INTO Items (name, region, price, date) VALUES('#{product_name}','Брестская область',#{brest_region}, #{date})"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Сделай цикл по именам областей, имена областей вынеси в константу.

mogilev_region = row[18]

if date < DATE_FOR_DENOMIZATION
brest_region = brest_region / AMOUNT_FOR_DENOMOZATION if !brest_region.nil?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Сделай цикл по именам областей.

@@ -0,0 +1,168 @@
require 'rubygems'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about gemfile?

next unless check_data
product_name = row[0].downcase
brest_region = row[6]
vitebsk_region = row[8]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add indexes to constants.

Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some files could not be reviewed due to errors:

Error: We found some problems with your configuration file: [/IrresponsibleMo...
Error: We found some problems with your configuration file: [/IrresponsibleModule] key 'IrresponsibleModule:' is undefined., [/DuplicateMethodCall] key 'DuplicateMethodCall:' is undefined., [/UtilityFunction] key 'UtilityFunction:' is undefined.

Elizaveta_Shved/Elizaveta Shved : 0 :/download_sheets.rb Outdated Show resolved Hide resolved
Elizaveta_Shved/Elizaveta Shved : 0 :/download_sheets.rb Outdated Show resolved Hide resolved
Elizaveta_Shved/Elizaveta Shved : 0 :/download_sheets.rb Outdated Show resolved Hide resolved
Elizaveta_Shved/Elizaveta Shved : 0 :/download_sheets.rb Outdated Show resolved Hide resolved
Elizaveta_Shved/Elizaveta Shved : 0 :/download_sheets.rb Outdated Show resolved Hide resolved
Elizaveta_Shved/Elizaveta Shved : 0 :/db_requester.rb Outdated Show resolved Hide resolved
Elizaveta_Shved/Elizaveta Shved : 0 :/db_requester.rb Outdated Show resolved Hide resolved
Elizaveta_Shved/Elizaveta Shved : 0 :/db_requester.rb Outdated Show resolved Hide resolved
Elizaveta_Shved/Elizaveta Shved : 0 :/db_requester.rb Outdated Show resolved Hide resolved
Elizaveta_Shved/Elizaveta Shved : 0 :/db_requester.rb Outdated Show resolved Hide resolved
Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some files could not be reviewed due to errors:

Error: We found some problems with your configuration file: [/IrresponsibleMo...
Error: We found some problems with your configuration file: [/IrresponsibleModule] key 'IrresponsibleModule:' is undefined., [/DuplicateMethodCall] key 'DuplicateMethodCall:' is undefined., [/UtilityFunction] key 'UtilityFunction:' is undefined.

Elizaveta_Shved/Elizaveta Shved : 0 :/data_parser.rb Outdated Show resolved Hide resolved
Elizaveta_Shved/Elizaveta Shved : 0 :/data_parser.rb Outdated Show resolved Hide resolved
Elizaveta_Shved/Elizaveta Shved : 0 :/data_parser.rb Outdated Show resolved Hide resolved
Elizaveta_Shved/Elizaveta Shved : 0 :/data_parser.rb Outdated Show resolved Hide resolved
Elizaveta_Shved/Elizaveta Shved : 0 :/data_parser.rb Outdated Show resolved Hide resolved
Elizaveta_Shved/Elizaveta Shved : 0 :/data_parser.rb Outdated Show resolved Hide resolved
Elizaveta_Shved/Elizaveta Shved : 0 :/data_parser.rb Outdated Show resolved Hide resolved
Elizaveta_Shved/Elizaveta Shved : 0 :/data_parser.rb Outdated Show resolved Hide resolved
Elizaveta_Shved/Elizaveta Shved : 0 :/data_parser.rb Outdated Show resolved Hide resolved
Elizaveta_Shved/Elizaveta Shved : 0 :/data_parser.rb Outdated Show resolved Hide resolved
@RGBD
Copy link
Collaborator

RGBD commented Dec 28, 2018

Please, fix rubocop issues

Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some files could not be reviewed due to errors:

Error: We found some problems with your configuration file: [/IrresponsibleMo...
Error: We found some problems with your configuration file: [/IrresponsibleModule] key 'IrresponsibleModule:' is undefined., [/DuplicateMethodCall] key 'DuplicateMethodCall:' is undefined., [/UtilityFunction] key 'UtilityFunction:' is undefined.

Elizaveta_Shved/Elizaveta Shved : 0 :/download_sheets.rb Outdated Show resolved Hide resolved
Elizaveta_Shved/Elizaveta Shved : 0 :/download_sheets.rb Outdated Show resolved Hide resolved
URI.encode(link)
end

def get_data

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/MethodLength: Method has too many lines. [11/10]
Naming/AccessorMethodName: Do not prefix reader method names with get_.

Elizaveta_Shved/Elizaveta Shved : 0 :/download_sheets.rb Outdated Show resolved Hide resolved
Elizaveta_Shved/Elizaveta Shved : 0 :/data_parser.rb Outdated Show resolved Hide resolved
Elizaveta_Shved/Elizaveta Shved : 0 :/data_parser.rb Outdated Show resolved Hide resolved
Elizaveta_Shved/Elizaveta Shved : 0 :/data_parser.rb Outdated Show resolved Hide resolved
Elizaveta_Shved/Elizaveta Shved : 0 :/data_parser.rb Outdated Show resolved Hide resolved
Elizaveta_Shved/Elizaveta Shved : 0 :/data_parser.rb Outdated Show resolved Hide resolved
Elizaveta_Shved/Elizaveta Shved : 0 :/data_parser.rb Outdated Show resolved Hide resolved
@RGBD
Copy link
Collaborator

RGBD commented Jan 7, 2019

Please fix rubocop issues

Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some files could not be reviewed due to errors:

Error: We found some problems with your configuration file: [/IrresponsibleMo...
Error: We found some problems with your configuration file: [/IrresponsibleModule] key 'IrresponsibleModule:' is undefined., [/DuplicateMethodCall] key 'DuplicateMethodCall:' is undefined., [/UtilityFunction] key 'UtilityFunction:' is undefined.

Elizaveta_Shved/Elizaveta Shved : 0 :/data_parser.rb Outdated Show resolved Hide resolved
Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some files could not be reviewed due to errors:

Error: We found some problems with your configuration file: [/IrresponsibleMo...
Error: We found some problems with your configuration file: [/IrresponsibleModule] key 'IrresponsibleModule:' is undefined., [/DuplicateMethodCall] key 'DuplicateMethodCall:' is undefined., [/UtilityFunction] key 'UtilityFunction:' is undefined.

Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some files could not be reviewed due to errors:

Error: We found some problems with your configuration file: [/IrresponsibleMo...
Error: We found some problems with your configuration file: [/IrresponsibleModule] key 'IrresponsibleModule:' is undefined., [/DuplicateMethodCall] key 'DuplicateMethodCall:' is undefined., [/UtilityFunction] key 'UtilityFunction:' is undefined.

Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some files could not be reviewed due to errors:

Error: We found some problems with your configuration file: [/IrresponsibleMo...
Error: We found some problems with your configuration file: [/IrresponsibleModule] key 'IrresponsibleModule:' is undefined., [/DuplicateMethodCall] key 'DuplicateMethodCall:' is undefined., [/UtilityFunction] key 'UtilityFunction:' is undefined.

Elizaveta_Shved/Elizaveta Shved : 0 :/db_requester.rb Outdated Show resolved Hide resolved
Elizaveta_Shved/Elizaveta Shved : 0 :/data_parser.rb Outdated Show resolved Hide resolved
Elizaveta_Shved/Elizaveta Shved : 0 :/data_parser.rb Outdated Show resolved Hide resolved
Elizaveta_Shved/Elizaveta Shved : 0 :/data_parser.rb Outdated Show resolved Hide resolved
@elishved
Copy link
Author

elishved commented Jan 9, 2019

@RGBD, please review my pr

(9..table.last_row).each do |number|
row = table.row(number)
check_data = (row[0].is_a?(String) && row[6].is_a?(Numeric) && row[8].is_a?(Numeric)) &&
(row[12].is_a?(Numeric) && row[14].is_a?(Numeric) && row[16].is_a?(Numeric) && row[18].is_a?(Numeric))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make 6..18 constant array

@@ -0,0 +1,13 @@
# Logfile created on 2019-01-10 00:05:53 +0300 by logger.rb/61378
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add log to .gitignore

(9..table.last_row).each do |number|
row = table.row(number)
check_data = (row[0].is_a?(String) && row[6].is_a?(Numeric) && row[8].is_a?(Numeric)) &&
(row[12].is_a?(Numeric) && row[14].is_a?(Numeric) && row[16].is_a?(Numeric) && row[18].is_a?(Numeric))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use constants instead of literal 8..18

end

def perform_data
File.new('test.db', 'a')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove line. If you really need this file to exist, touch it: FileUtils.touch

end

def request
check_record
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove line

class DbRequester
def initialize(product_name)
@product_name = product_name
@db = SQLite3::Database.open 'test.db'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make filename common constant for all files (this and data_parser).

end

def similar_price
str = @product_name.downcase
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove line

def similar_price
str = @product_name.downcase
response = @db.execute "SELECT DISTINCT Name FROM Items WHERE Price < '#{@last_time_cost + 0.5}' AND Price > '#{@last_time_cost - 0.5}' LIMIT(2)"
record = response.last
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useless assignment, remove line

str = @product_name.downcase
response = @db.execute "SELECT * FROM Items WHERE Name LIKE '#{str} %' ORDER BY Date DESC LIMIT(1)"
record = response.last
date = revert_unix_date(record.last)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useless assignment

Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some files could not be reviewed due to errors:

Error: We found some problems with your configuration file: [/IrresponsibleMo...
Error: We found some problems with your configuration file: [/IrresponsibleModule] key 'IrresponsibleModule:' is undefined., [/DuplicateMethodCall] key 'DuplicateMethodCall:' is undefined., [/UtilityFunction] key 'UtilityFunction:' is undefined.

Elizaveta_Shved/Elizaveta Shved : 0 :/db_requester.rb Outdated Show resolved Hide resolved
Elizaveta_Shved/Elizaveta Shved : 0 :/db_requester.rb Outdated Show resolved Hide resolved
Elizaveta_Shved/Elizaveta Shved : 0 :/data_parser.rb Outdated Show resolved Hide resolved
Elizaveta_Shved/Elizaveta Shved : 0 :/data_parser.rb Outdated Show resolved Hide resolved
Elizaveta_Shved/Elizaveta Shved : 0 :/data_parser.rb Outdated Show resolved Hide resolved
Elizaveta_Shved/Elizaveta Shved : 0 :/data_parser.rb Outdated Show resolved Hide resolved
Elizaveta_Shved/Elizaveta Shved : 0 :/data_parser.rb Outdated Show resolved Hide resolved
Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some files could not be reviewed due to errors:

Error: We found some problems with your configuration file: [/IrresponsibleMo...
Error: We found some problems with your configuration file: [/IrresponsibleModule] key 'IrresponsibleModule:' is undefined., [/DuplicateMethodCall] key 'DuplicateMethodCall:' is undefined., [/UtilityFunction] key 'UtilityFunction:' is undefined.

Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some files could not be reviewed due to errors:

Error: We found some problems with your configuration file: [/IrresponsibleMo...
Error: We found some problems with your configuration file: [/IrresponsibleModule] key 'IrresponsibleModule:' is undefined., [/DuplicateMethodCall] key 'DuplicateMethodCall:' is undefined., [/UtilityFunction] key 'UtilityFunction:' is undefined.

Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some files could not be reviewed due to errors:

Error: We found some problems with your configuration file: [/IrresponsibleMo...
Error: We found some problems with your configuration file: [/IrresponsibleModule] key 'IrresponsibleModule:' is undefined., [/DuplicateMethodCall] key 'DuplicateMethodCall:' is undefined., [/UtilityFunction] key 'UtilityFunction:' is undefined.

@elishved
Copy link
Author

@RGBD, please review my pr

@RGBD
Copy link
Collaborator

RGBD commented Jan 22, 2019

👍 well done! Now few more fixes:
remove xls, xlsx files from pull request (git rm --cached data/*)
Rename directories so that your homework is located under "Elizaveta Shved/0/"

@RGBD RGBD added the merge ready approved by mentor label Jan 22, 2019
Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some files could not be reviewed due to errors:

Error: We found some problems with your configuration file: [/IrresponsibleMo...
Error: We found some problems with your configuration file: [/IrresponsibleModule] key 'IrresponsibleModule:' is undefined., [/DuplicateMethodCall] key 'DuplicateMethodCall:' is undefined., [/UtilityFunction] key 'UtilityFunction:' is undefined.

Elizaveta Shved/0/download_sheets.rb Show resolved Hide resolved
Elizaveta Shved/0/download_sheets.rb Show resolved Hide resolved
Elizaveta Shved/0/download_sheets.rb Show resolved Hide resolved
Elizaveta Shved/0/db_requester.rb Show resolved Hide resolved
Elizaveta Shved/0/db_requester.rb Show resolved Hide resolved
Elizaveta Shved/0/data_parser.rb Show resolved Hide resolved
Elizaveta Shved/0/data_parser.rb Show resolved Hide resolved
Elizaveta Shved/0/data_parser.rb Show resolved Hide resolved
@elishved
Copy link
Author

@RGBD, please review my pr

.gitignore Outdated
@@ -1,3 +1,7 @@
.DS_Store
*.mov
.idea
test.db
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do NOT touch global gitignore

Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some files could not be reviewed due to errors:

Error: We found some problems with your configuration file: [/IrresponsibleMo...
Error: We found some problems with your configuration file: [/IrresponsibleModule] key 'IrresponsibleModule:' is undefined., [/DuplicateMethodCall] key 'DuplicateMethodCall:' is undefined., [/UtilityFunction] key 'UtilityFunction:' is undefined.

Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some files could not be reviewed due to errors:

Error: We found some problems with your configuration file: [/IrresponsibleMo...
Error: We found some problems with your configuration file: [/IrresponsibleModule] key 'IrresponsibleModule:' is undefined., [/DuplicateMethodCall] key 'DuplicateMethodCall:' is undefined., [/UtilityFunction] key 'UtilityFunction:' is undefined.

Copy link
Collaborator

@RGBD RGBD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You pull request deletes global readme.md. Please, revert that change

@@ -1,3 +1,4 @@
.DS_Store
*.mov
.idea

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your pull request MUST NOT change global gitignore

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This

Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some files could not be reviewed due to errors:

Error: We found some problems with your configuration file: [/IrresponsibleMo...
Error: We found some problems with your configuration file: [/IrresponsibleModule] key 'IrresponsibleModule:' is undefined., [/DuplicateMethodCall] key 'DuplicateMethodCall:' is undefined., [/UtilityFunction] key 'UtilityFunction:' is undefined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge ready approved by mentor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants