回答編集履歴
5
追加
test
CHANGED
@@ -120,13 +120,17 @@
|
|
120
120
|
|
121
121
|
if($current[$day][$i]['action'] !== $content['action']) {continue;} //action違い、スキップ
|
122
122
|
|
123
|
-
$current[$day][$i]['time'] = array_slice(array_merge($current[$day][$i]['time'],[$content['time']]), 0, 20);
|
123
|
+
//$current[$day][$i]['time'] = array_slice(array_merge($current[$day][$i]['time'],[$content['time']]), 0, 20);
|
124
124
|
|
125
|
-
rsort($current[$day][$i]['time']);
|
125
|
+
//rsort($current[$day][$i]['time']);
|
126
126
|
|
127
|
-
$current[$day][$i]['
|
127
|
+
$current[$day][$i]['time'] = array_slice(array_merge([$content['time']], $current[$day][$i]['time']), 0, 20);
|
128
128
|
|
129
|
+
//$current[$day][$i]['actorID'] = array_slice(array_merge($current[$day][$i]['actorID'],[$content['actorID']]), 0, 4);
|
130
|
+
|
129
|
-
rsort($current[$day][$i]['actorID']);
|
131
|
+
//rsort($current[$day][$i]['actorID']);
|
132
|
+
|
133
|
+
$current[$day][$i]['actorID'] = array_slice(array_merge([$content['actorID']], $current[$day][$i]['actorID']), 0, 4);
|
130
134
|
|
131
135
|
$current[$day][$i]['allow'] = 'undone';
|
132
136
|
|
4
修正
test
CHANGED
@@ -110,8 +110,6 @@
|
|
110
110
|
|
111
111
|
|
112
112
|
|
113
|
-
|
114
|
-
|
115
113
|
foreach($new as $day => $contents) {
|
116
114
|
|
117
115
|
foreach($contents as $content) {
|
@@ -134,7 +132,9 @@
|
|
134
132
|
|
135
133
|
}
|
136
134
|
|
135
|
+
$sortkey = array_map(function($ar) { return $ar[0];}, array_column($current[$day], 'time'));
|
136
|
+
|
137
|
-
array_multisort(
|
137
|
+
array_multisort($sortkey, SORT_DESC,$current[$day]);
|
138
138
|
|
139
139
|
}
|
140
140
|
|
3
修正
test
CHANGED
@@ -1,4 +1,12 @@
|
|
1
|
+
独自解釈につきご容赦ください
|
2
|
+
|
3
|
+
|
4
|
+
|
1
|
-
|
5
|
+
* 20個まで付くやつ降順ソートで20個ではないのか?
|
6
|
+
|
7
|
+
* newのやつが上にくるとのことだが、actionだけでみたとき、$current側に、appleが複数いる可能性が否定されていない。またallowをundoneにするという意図からしても、newがついたやつが上にくるのではなく、undoneがうえからならんでいればいいのではないかと考え、そうコード化した。
|
8
|
+
|
9
|
+
(doneよりも下にundoneがいることは対処が必要だと思ったが、今回の例の1/2においてcurrentでundoneのorangeよりappleが上にくることに実用上の必然性を見出せなかった)
|
2
10
|
|
3
11
|
|
4
12
|
|
@@ -114,17 +122,19 @@
|
|
114
122
|
|
115
123
|
if($current[$day][$i]['action'] !== $content['action']) {continue;} //action違い、スキップ
|
116
124
|
|
117
|
-
$current[$day][$i]['time']
|
125
|
+
$current[$day][$i]['time'] = array_slice(array_merge($current[$day][$i]['time'],[$content['time']]), 0, 20);
|
118
126
|
|
119
|
-
|
127
|
+
rsort($current[$day][$i]['time']);
|
120
128
|
|
121
|
-
$current[$day][$i]['actorID']
|
129
|
+
$current[$day][$i]['actorID'] = array_slice(array_merge($current[$day][$i]['actorID'],[$content['actorID']]), 0, 4);
|
122
130
|
|
123
|
-
|
131
|
+
rsort($current[$day][$i]['actorID']);
|
124
132
|
|
125
133
|
$current[$day][$i]['allow'] = 'undone';
|
126
134
|
|
127
135
|
}
|
136
|
+
|
137
|
+
array_multisort(array_column($current[$day], 'allow'), SORT_DESC,$current[$day]);
|
128
138
|
|
129
139
|
}
|
130
140
|
|
2
修正
test
CHANGED
@@ -5,8 +5,6 @@
|
|
5
5
|
```php
|
6
6
|
|
7
7
|
<?php
|
8
|
-
|
9
|
-
// Your code here!
|
10
8
|
|
11
9
|
/*
|
12
10
|
|
1
修正
test
CHANGED
@@ -122,7 +122,7 @@
|
|
122
122
|
|
123
123
|
$current[$day][$i]['actorID'][] = $content['actorID'];
|
124
124
|
|
125
|
-
$current[$day][$i]['actorID'] = array_slice($current[$day][$i]['actorID'], 0,
|
125
|
+
$current[$day][$i]['actorID'] = array_slice($current[$day][$i]['actorID'], 0, 20);
|
126
126
|
|
127
127
|
$current[$day][$i]['allow'] = 'undone';
|
128
128
|
|