Skip to content

Commit

Permalink
Merge pull request #38 from UNICEF01/testing
Browse files Browse the repository at this point in the history
Sprint #2 - 29/10 09/11
  • Loading branch information
manoelsouzaunicef committed Nov 12, 2018
2 parents c1d21a3 + fbd6331 commit 171698c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions app/Child.php
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ public function buildSearchDocument() : array {

if($this->currentCase) {
$data['case_status'] = $this->currentCase->case_status;
$data['cancel_reason'] = $this->currentCase->cancel_reason;

if($this->currentCase->case_cause_ids) { // TODO: refactor this
$data['cause_name'] = join(", ", array_map(function ($cause_id) {
Expand Down
13 changes: 11 additions & 2 deletions app/Http/Controllers/Resources/GroupsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,19 @@ public function store() {

public function update_settings(Group $group) {
$settings = $group->getSettings();

if( strtolower($group->name) == "secretaria municipal de educação" || strtolower($group->name) == "secretaria de educação" ){
$request = request('settings', []);
foreach ($request['alerts'] as $key => $alert){
if($key !== 500 AND $alert !== true){
return response()->json(['status' => 'error', 'message' => 'O grupo Secretaria Municipal de Educação, obrigatoriamente, deve estar selecionado para todos os motivos de evasão escolar.' ], 405);
}
}
}

$settings->update( request('settings', []) );
$group->setSettings($settings);

return response()->json(['status' => 'ok']);
return response()->json(['status' => 'ok']);
}

public function update(Group $group) {
Expand Down
2 changes: 2 additions & 0 deletions app/Transformers/ChildSearchResultsTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ public function transform($document) {
'deadline_status' => $document['_source']['deadline_status'] ?? null,
'alert_status' => $document['_source']['alert_status'] ?? null,

'cancel_reason' => $document['_source']['cancel_reason'] ?? null,

'created_at' => isset($document['_source']['created_at']) ? Carbon::createFromTimestamp(strtotime($document['_source']['created_at']))->toIso8601String() : null,
'updated_at' => isset($document['_source']['updated_at']) ? Carbon::createFromTimestamp(strtotime($document['_source']['updated_at']))->toIso8601String() : null,

Expand Down
3 changes: 1 addition & 2 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#!/usr/bin/env bash
git pull origin master
composer install --no-interaction --prefer-dist --optimize-autoloader
echo "" | sudo -S service php7.1-fpm reload

if [ -f artisan ]
then
php artisan migrate --force
php artisan cache:clear
php artisan queue:work --timeout=0
#php artisan queue:work --timeout=0
php artisan optimize
fi

0 comments on commit 171698c

Please sign in to comment.