This commit is contained in:
parent
9a17d4ad24
commit
81f21a02c4
@ -1,6 +1,7 @@
|
||||
# v0.9.2
|
||||
- Add lot number to packs
|
||||
- Don't show price paid and lot number columns when displaying packs if not used
|
||||
- Fix additional shotgun fields not being exportable
|
||||
|
||||
# v0.9.1
|
||||
- Rename ammo type's "type" to "class" to avoid confusion
|
||||
|
@ -13,28 +13,38 @@ defmodule Cannery.Ammo.Type do
|
||||
|
||||
@derive {Jason.Encoder,
|
||||
only: [
|
||||
:id,
|
||||
:name,
|
||||
:desc,
|
||||
:class,
|
||||
:bullet_type,
|
||||
:bullet_core,
|
||||
:cartridge,
|
||||
:caliber,
|
||||
:case_material,
|
||||
:jacket_type,
|
||||
:muzzle_velocity,
|
||||
:powder_type,
|
||||
:powder_grains_per_charge,
|
||||
:grains,
|
||||
:pressure,
|
||||
:primer_type,
|
||||
:firing_type,
|
||||
:manufacturer,
|
||||
:upc,
|
||||
:tracer,
|
||||
:incendiary,
|
||||
:blank,
|
||||
:corrosive,
|
||||
:manufacturer,
|
||||
:upc
|
||||
:cartridge,
|
||||
:jacket_type,
|
||||
:powder_grains_per_charge,
|
||||
:muzzle_velocity,
|
||||
:wadding,
|
||||
:shot_type,
|
||||
:shot_material,
|
||||
:shot_size,
|
||||
:unfired_length,
|
||||
:brass_height,
|
||||
:chamber_size,
|
||||
:load_grains,
|
||||
:shot_charge_weight,
|
||||
:dram_equivalent
|
||||
]}
|
||||
@primary_key {:id, :binary_id, autogenerate: true}
|
||||
@foreign_key_type :binary_id
|
||||
@ -95,17 +105,23 @@ defmodule Cannery.Ammo.Type do
|
||||
class: class(),
|
||||
bullet_type: String.t() | nil,
|
||||
bullet_core: String.t() | nil,
|
||||
cartridge: String.t() | nil,
|
||||
caliber: String.t() | nil,
|
||||
case_material: String.t() | nil,
|
||||
jacket_type: String.t() | nil,
|
||||
muzzle_velocity: integer() | nil,
|
||||
powder_type: String.t() | nil,
|
||||
powder_grains_per_charge: integer() | nil,
|
||||
grains: integer() | nil,
|
||||
pressure: String.t() | nil,
|
||||
primer_type: String.t() | nil,
|
||||
firing_type: String.t() | nil,
|
||||
manufacturer: String.t() | nil,
|
||||
upc: String.t() | nil,
|
||||
tracer: boolean(),
|
||||
incendiary: boolean(),
|
||||
blank: boolean(),
|
||||
corrosive: boolean(),
|
||||
cartridge: String.t() | nil,
|
||||
jacket_type: String.t() | nil,
|
||||
powder_grains_per_charge: integer() | nil,
|
||||
muzzle_velocity: integer() | nil,
|
||||
wadding: String.t() | nil,
|
||||
shot_type: String.t() | nil,
|
||||
shot_material: String.t() | nil,
|
||||
@ -116,12 +132,6 @@ defmodule Cannery.Ammo.Type do
|
||||
load_grains: integer() | nil,
|
||||
shot_charge_weight: String.t() | nil,
|
||||
dram_equivalent: String.t() | nil,
|
||||
tracer: boolean(),
|
||||
incendiary: boolean(),
|
||||
blank: boolean(),
|
||||
corrosive: boolean(),
|
||||
manufacturer: String.t() | nil,
|
||||
upc: String.t() | nil,
|
||||
user_id: User.id(),
|
||||
packs: [Pack.t()] | nil,
|
||||
inserted_at: NaiveDateTime.t(),
|
||||
@ -140,17 +150,23 @@ defmodule Cannery.Ammo.Type do
|
||||
:class,
|
||||
:bullet_type,
|
||||
:bullet_core,
|
||||
:cartridge,
|
||||
:caliber,
|
||||
:case_material,
|
||||
:jacket_type,
|
||||
:muzzle_velocity,
|
||||
:powder_type,
|
||||
:powder_grains_per_charge,
|
||||
:grains,
|
||||
:pressure,
|
||||
:primer_type,
|
||||
:firing_type,
|
||||
:manufacturer,
|
||||
:upc,
|
||||
:tracer,
|
||||
:incendiary,
|
||||
:blank,
|
||||
:corrosive,
|
||||
:cartridge,
|
||||
:jacket_type,
|
||||
:powder_grains_per_charge,
|
||||
:muzzle_velocity,
|
||||
:wadding,
|
||||
:shot_type,
|
||||
:shot_material,
|
||||
@ -160,29 +176,26 @@ defmodule Cannery.Ammo.Type do
|
||||
:chamber_size,
|
||||
:load_grains,
|
||||
:shot_charge_weight,
|
||||
:dram_equivalent,
|
||||
:tracer,
|
||||
:incendiary,
|
||||
:blank,
|
||||
:corrosive,
|
||||
:manufacturer,
|
||||
:upc
|
||||
:dram_equivalent
|
||||
]
|
||||
|
||||
@spec string_fields() :: [atom()]
|
||||
defp string_fields,
|
||||
do: [
|
||||
:name,
|
||||
:desc,
|
||||
:bullet_type,
|
||||
:bullet_core,
|
||||
:cartridge,
|
||||
:caliber,
|
||||
:case_material,
|
||||
:jacket_type,
|
||||
:powder_type,
|
||||
:pressure,
|
||||
:primer_type,
|
||||
:firing_type,
|
||||
:manufacturer,
|
||||
:upc,
|
||||
:cartridge,
|
||||
:jacket_type,
|
||||
:wadding,
|
||||
:shot_type,
|
||||
:shot_material,
|
||||
@ -191,9 +204,7 @@ defmodule Cannery.Ammo.Type do
|
||||
:brass_height,
|
||||
:chamber_size,
|
||||
:shot_charge_weight,
|
||||
:dram_equivalent,
|
||||
:manufacturer,
|
||||
:upc
|
||||
:dram_equivalent
|
||||
]
|
||||
|
||||
@doc false
|
||||
|
@ -58,28 +58,38 @@ defmodule CanneryWeb.ExportControllerTest do
|
||||
}
|
||||
|
||||
ideal_type = %{
|
||||
"blank" => type.blank,
|
||||
"bullet_core" => type.bullet_core,
|
||||
"bullet_type" => type.bullet_type,
|
||||
"caliber" => type.caliber,
|
||||
"cartridge" => type.cartridge,
|
||||
"case_material" => type.case_material,
|
||||
"corrosive" => type.corrosive,
|
||||
"desc" => type.desc,
|
||||
"firing_type" => type.firing_type,
|
||||
"grains" => type.grains,
|
||||
"id" => type.id,
|
||||
"incendiary" => type.incendiary,
|
||||
"jacket_type" => type.jacket_type,
|
||||
"manufacturer" => type.manufacturer,
|
||||
"muzzle_velocity" => type.muzzle_velocity,
|
||||
"name" => type.name,
|
||||
"powder_grains_per_charge" => type.powder_grains_per_charge,
|
||||
"desc" => type.desc,
|
||||
"class" => to_string(type.class),
|
||||
"bullet_type" => type.bullet_type,
|
||||
"bullet_core" => type.bullet_core,
|
||||
"caliber" => type.caliber,
|
||||
"case_material" => type.case_material,
|
||||
"powder_type" => type.powder_type,
|
||||
"grains" => type.grains,
|
||||
"pressure" => type.pressure,
|
||||
"primer_type" => type.primer_type,
|
||||
"tracer" => type.tracer,
|
||||
"firing_type" => type.firing_type,
|
||||
"manufacturer" => type.manufacturer,
|
||||
"upc" => type.upc,
|
||||
"tracer" => type.tracer,
|
||||
"incendiary" => type.incendiary,
|
||||
"blank" => type.blank,
|
||||
"corrosive" => type.corrosive,
|
||||
"cartridge" => type.cartridge,
|
||||
"jacket_type" => type.jacket_type,
|
||||
"powder_grains_per_charge" => type.powder_grains_per_charge,
|
||||
"muzzle_velocity" => type.muzzle_velocity,
|
||||
"wadding" => type.wadding,
|
||||
"shot_type" => type.shot_type,
|
||||
"shot_material" => type.shot_material,
|
||||
"shot_size" => type.shot_size,
|
||||
"unfired_length" => type.unfired_length,
|
||||
"brass_height" => type.brass_height,
|
||||
"chamber_size" => type.chamber_size,
|
||||
"load_grains" => type.load_grains,
|
||||
"shot_charge_weight" => type.shot_charge_weight,
|
||||
"dram_equivalent" => type.dram_equivalent,
|
||||
"average_cost" => type |> Ammo.get_average_cost_for_type(current_user),
|
||||
"round_count" => type |> Ammo.get_round_count_for_type(current_user),
|
||||
"used_count" => type |> ActivityLog.get_used_count_for_type(current_user),
|
||||
|
Loading…
Reference in New Issue
Block a user