Fixed: Allow subactivity of membership to be null
This commit is contained in:
parent
a73784e554
commit
99cc0b60bf
|
@ -25,8 +25,13 @@ class Membership extends Model {
|
||||||
|
|
||||||
protected $guarded = [];
|
protected $guarded = [];
|
||||||
|
|
||||||
|
public static $default = [
|
||||||
|
'untergliederungId' => null,
|
||||||
|
'untergliederung' => null
|
||||||
|
];
|
||||||
|
|
||||||
public static function fromNami($item) {
|
public static function fromNami($item) {
|
||||||
$item = collect($item)
|
$item = collect(static::$default)->merge(collect($item))
|
||||||
->only(array_keys(static::$overviewAttributes))
|
->only(array_keys(static::$overviewAttributes))
|
||||||
->mapWithKeys(function($item, $key) {
|
->mapWithKeys(function($item, $key) {
|
||||||
return [ data_get(static::$overviewAttributes, $key, $key) => $item ];
|
return [ data_get(static::$overviewAttributes, $key, $key) => $item ];
|
||||||
|
|
|
@ -17,11 +17,11 @@ class PullMembershipsTest extends TestCase
|
||||||
'id' => ['id', [68, 69]],
|
'id' => ['id', [68, 69]],
|
||||||
'group_id' => ['group_id', [103,104]],
|
'group_id' => ['group_id', [103,104]],
|
||||||
'activity_id' => ['activity_id', [33, 34]],
|
'activity_id' => ['activity_id', [33, 34]],
|
||||||
'subactivity_id' => ['subactivity_id', [55, 56]],
|
'subactivity_id' => ['subactivity_id', [55, null]],
|
||||||
'starts_at' => ['starts_at', ['2017-02-11', '2017-11-12']],
|
'starts_at' => ['starts_at', ['2017-02-11', '2017-11-12']],
|
||||||
'ends_at' => ['ends_at', ['2017-03-11', null]],
|
'ends_at' => ['ends_at', ['2017-03-11', null]],
|
||||||
'activity_name' => ['activity_name', ['ReferentIn', 'Wö']],
|
'activity_name' => ['activity_name', ['ReferentIn', 'Wö']],
|
||||||
'subactivity_name' => ['subactivity_name', ['Pfadfinder', 'AAA']],
|
'subactivity_name' => ['subactivity_name', ['Pfadfinder', null]],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,6 @@
|
||||||
"gruppierungId": 104,
|
"gruppierungId": 104,
|
||||||
"taetigkeit": "Wö",
|
"taetigkeit": "Wö",
|
||||||
"taetigkeitId": 34,
|
"taetigkeitId": 34,
|
||||||
"untergliederung": "AAA",
|
|
||||||
"untergliederungId": 56,
|
|
||||||
"aktivVon": "2017-11-12 00:00:00",
|
"aktivVon": "2017-11-12 00:00:00",
|
||||||
"aktivBis": ""
|
"aktivBis": ""
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue