<commit_before># coding: utf-8

# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
#   cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
#   Mayor.create(name: 'Emanuel', city: cities.first)

# Division(部署)テーブルに初期値を投入(全件削除して再投入)
Division.delete_all
Division.create(id: 1, code: 'HdO-01', name: '本社')
Division.create(id: 2, code: 'OSK-01', name: '大阪第１')
Division.create(id: 3, code: 'OSK-02', name: '大阪第２')
Division.create(id: 4, code: 'NGY-01', name: '名古屋営業所')
Division.create(id: 5, code: 'TKY-01', name: '東京支社')

# Type(種類)テーブルに初期値を投入(全件削除して再投入)
Type.delete_all
Type.create(id: 1, name: '通常用')
Type.create(id: 2, name: '非常用')
Type.create(id: 3, name: '携帯用')

# Place(場所)テーブルに初期値を投入(全件削除して再投入)
Place.delete_all
Place.create(id: 1, name: '大阪ビル', address: '大阪市なんとか区どこそこ町１−２−３')
Place.create(id: 2, name: '名古屋タワー', address: '名古屋市なんとか区どこそこ町７−５−８')
Place.create(id: 3, name: '東京港ショッピングモール', address: '東京都なんとか区ベイサイドエリア１０９')

# Status(状況)テーブルに初期値を投入(全件削除して再投入)
Status.delete_all
Status.create(id: 1, name: '担当未割当')
Status.create(id: 2, name: '実施待ち')
Status.create(id: 3, name: '実施中')
Status.create(id: 4, name: '完了')

# Result(結果)テーブルに初期値を投入(全件削除して再投入)
Result.delete_all
Result.create(id: 1, name: '合格')
Result.create(id: 2, name: '不合格')
Result.create(id: 3, name: '状態不明')
Result.create(id: 4, name: '検査前')

# Weather(天気)テーブルに初期値を投入(全件削除して再投入)
Weather.delete_all
Weather.create(id: 1, name: '晴')
Weather.create(id: 2, name: '曇')
Weather.create(id: 3, name: '雨')
Weather.create(id: 4, name: '雪')

# Checkresult(チェック結果)テーブルに初期値を投入(全件削除して再投入)
Checkresult.delete_all
Checkresult.create(id: 1, name: '優')
Checkresult.create(id: 2, name: '良')
Checkresult.create(id: 3, name: '可')
Checkresult.create(id: 4, name: '不可')


##########################
### テスト用にデータを入れる（超暫定)
##########################<commit_msg>heroku/pg<commit_after># coding: utf-8

# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
#   cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
#   Mayor.create(name: 'Emanuel', city: cities.first)

# Division(部署)テーブルに初期値を投入(全件削除して再投入)
Division.delete_all
Division.create(id: 1, code: 'HdO-01', name: '本社')
Division.create(id: 2, code: 'OSK-01', name: '大阪第１')
Division.create(id: 3, code: 'OSK-02', name: '大阪第２')
Division.create(id: 4, code: 'NGY-01', name: '名古屋営業所')
Division.create(id: 5, code: 'TKY-01', name: '東京支社')
if Rails.env.development?
  Division.connection.execute("update sqlite_sequence set seq=5 where name='divisions'")
else
  Division.connection.execute("SELECT SETVAL('divisions_id_seq', 5, FALSE)")
end

# Type(種類)テーブルに初期値を投入(全件削除して再投入)
Type.delete_all
Type.create(id: 1, name: '通常用')
Type.create(id: 2, name: '非常用')
Type.create(id: 3, name: '携帯用')
if Rails.env.development?
  Type.connection.execute("update sqlite_sequence set seq=3 where name='types'")
else
  Type.connection.execute("SELECT SETVAL('types_id_seq', 3, FALSE)")
end

# Place(場所)テーブルに初期値を投入(全件削除して再投入)
Place.delete_all
Place.create(id: 1, name: '大阪ビル', address: '大阪市なんとか区どこそこ町１−２−３')
Place.create(id: 2, name: '名古屋タワー', address: '名古屋市なんとか区どこそこ町７−５−８')
Place.create(id: 3, name: '東京港ショッピングモール', address: '東京都なんとか区ベイサイドエリア１０９')
if Rails.env.development?
  Place.connection.execute("update sqlite_sequence set seq=3 where name='places'")
else
  Place.connection.execute("SELECT SETVAL('placess_id_seq', 3, FALSE)")
end

# Status(状況)テーブルに初期値を投入(全件削除して再投入)
Status.delete_all
Status.create(id: 1, name: '担当未割当')
Status.create(id: 2, name: '実施待ち')
Status.create(id: 3, name: '実施中')
Status.create(id: 4, name: '完了')
if Rails.env.development?
  Status.connection.execute("update sqlite_sequence set seq=4 where name='statuses'")
else
  Status.connection.execute("SELECT SETVAL('statuses_id_seq', 4, FALSE)")
end

# Result(結果)テーブルに初期値を投入(全件削除して再投入)
Result.delete_all
Result.create(id: 1, name: '合格')
Result.create(id: 2, name: '不合格')
Result.create(id: 3, name: '状態不明')
Result.create(id: 4, name: '検査前')
if Rails.env.development?
  Result.connection.execute("update sqlite_sequence set seq=4 where name='results'")
else
  Result.connection.execute("SELECT SETVAL('results_id_seq', 4, FALSE)")
end

# Weather(天気)テーブルに初期値を投入(全件削除して再投入)
Weather.delete_all
Weather.create(id: 1, name: '晴')
Weather.create(id: 2, name: '曇')
Weather.create(id: 3, name: '雨')
Weather.create(id: 4, name: '雪')
if Rails.env.development?
  Weather.connection.execute("update sqlite_sequence set seq=4 where name='weathers'")
else
  Weather.connection.execute("SELECT SETVAL('weathers_id_seq', 4, FALSE)")
end

# Checkresult(チェック結果)テーブルに初期値を投入(全件削除して再投入)
Checkresult.delete_all
Checkresult.create(id: 1, name: '優')
Checkresult.create(id: 2, name: '良')
Checkresult.create(id: 3, name: '可')
Checkresult.create(id: 4, name: '不可')
if Rails.env.development?
  Checkresult.connection.execute("update sqlite_sequence set seq=4 where name='checkresults'")
else
  Checkresult.connection.execute("SELECT SETVAL('checkresults_id_seq', 4, FALSE)")
end

##########################
### テスト用にデータを入れる（超暫定)
##########################
{'fraction_non_alphanumeric': 0.18396846254927726, 'fraction_numerical': 0.02102496714848883, 'mean_word_length': 6.600570613409415, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '854056', 'n_tokens_mistral': 2534, 'n_tokens_neox': 2503, 'n_words': 472}