Skip to content

Commit 063e80c

Browse files
authored
Revert "Release Mismatch Finder to Production (#884)"
This reverts commit cb76e3e.
1 parent cb76e3e commit 063e80c

File tree

90 files changed

+4698
-8280
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+4698
-8280
lines changed

.eslintrc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ module.exports = {
66
extends: [
77
'eslint:recommended',
88
'@vue/typescript/recommended',
9-
'plugin:vue/vue3-strongly-recommended',
9+
'plugin:vue/essential',
1010
],
1111
parser: 'vue-eslint-parser',
1212
rules: {
1313
'max-len': [ 'error', 120 ],
1414
'no-multiple-empty-lines' : ['error', { 'max': 1 }],
1515
'vue/multi-word-component-names' : [ 'off' ]
16-
},
16+
},
1717
};

.github/workflows/deploy-app-staging.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
steps:
1919
- uses: actions/checkout@v4
2020
- name: Set up node
21-
uses: actions/setup-node@v4.0.1
21+
uses: actions/setup-node@v3.8.1
2222
with:
2323
node-version: '18.x'
2424
- name: Install composer dependencies

.github/workflows/deploy-app.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
steps:
1717
- uses: actions/checkout@v4
1818
- name: Set up node
19-
uses: actions/setup-node@v4.0.1
19+
uses: actions/setup-node@v3.8.1
2020
with:
2121
node-version: '18.x'
2222
- name: Install composer dependencies

.github/workflows/lint.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,15 @@ jobs:
2525
- uses: actions/checkout@v4
2626

2727
- name: Setup Node.js
28-
uses: actions/setup-node@v4.0.1
28+
uses: actions/setup-node@v3.8.1
2929
with:
3030
node-version: '18.x'
3131

3232
- name: Install Dependencies
3333
run: npm ci
3434

35-
- name: Run ESlint and Stylelint
35+
- name: Run ESLint
3636
run: npm run lint
3737

3838
- name: Run i18 Validation
3939
run: npm run i18n:validate
40-

.github/workflows/schedule-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Checkout
14-
uses: actions/checkout@v4
14+
uses: actions/checkout@v3
1515
with:
1616
ref: development
1717
- name: Branch out Release

.github/workflows/test.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
- uses: actions/checkout@v4
3232

3333
- name: Setup Node.js
34-
uses: actions/setup-node@v4.0.1
34+
uses: actions/setup-node@v3.8.1
3535
with:
3636
node-version: '18.x'
3737

@@ -67,7 +67,7 @@ jobs:
6767
php-version: '7.3'
6868

6969
- name: Setup Node.js
70-
uses: actions/setup-node@v4.0.1
70+
uses: actions/setup-node@v3.8.1
7171
with:
7272
node-version: '18.x'
7373

@@ -110,21 +110,21 @@ jobs:
110110

111111
- name: Upload Laravel Logs
112112
if: failure()
113-
uses: actions/upload-artifact@v4
113+
uses: actions/upload-artifact@v3
114114
with:
115115
name: logs
116116
path: ./storage/logs
117117

118118
- name: Upload Screenshots
119119
if: failure()
120-
uses: actions/upload-artifact@v4
120+
uses: actions/upload-artifact@v3
121121
with:
122122
name: screenshots
123123
path: tests/Browser/screenshots
124124

125125
- name: Upload Console Logs
126126
if: failure()
127-
uses: actions/upload-artifact@v4
127+
uses: actions/upload-artifact@v3
128128
with:
129129
name: console
130130
path: tests/Browser/console

.stylelintrc.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

app/Http/Controllers/ResultsController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ public function index(MismatchGetRequest $request, WikibaseAPIClient $wikidata):
6565
$props = array_merge(
6666
[
6767
'user' => $user,
68-
'itemIds' => $requestedItemIds,
68+
'item_ids' => $requestedItemIds,
6969
// Use wikidata to fetch labels for found entity ids
7070
'labels' => $wikidata->getLabels($entityIds, $lang),
71-
'formattedValues' => $formattedTimeValues,
71+
'formatted_values' => $formattedTimeValues,
7272
],
7373
// only add 'results' prop if mismatches have been found
7474
$mismatches->isNotEmpty() ? [ 'results' => $mismatches->groupBy('item_id') ] : []

app/Jobs/ImportCSV.php

Lines changed: 8 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -46,58 +46,16 @@ public function handle(CSVImportReader $reader)
4646
$filepath = Storage::disk('local')
4747
->path('mismatch-files/' . $this->meta->filename);
4848

49-
$mismatch_attrs = (new Mismatch())->getFillable();
50-
51-
DB::transaction(function () use ($reader, $filepath, $mismatch_attrs) {
52-
$new_mismatches = [];
53-
$where_clauses = [];
54-
55-
$mismatches_per_upload_user = DB::table('mismatches')
56-
->select($mismatch_attrs)
57-
->join('import_meta', 'mismatches.import_id', '=', 'import_meta.id')
58-
->where('import_meta.user_id', '=', $this->meta->user->id);
59-
60-
$reader->lines($filepath)->each(function ($mismatchLine) use (
61-
&$new_mismatches,
62-
&$where_clauses
63-
) {
64-
65-
$new_mismatch = $this->createMismatch($mismatchLine);
66-
$new_mismatches[] = $new_mismatch;
67-
$where_clause = [['review_status', '!=', 'pending']];
68-
foreach ($new_mismatch->getAttributes() as $key => $attribute) {
69-
if ($key == 'review_status') {
70-
continue;
71-
}
72-
$where_clause[] = [$key, $attribute];
73-
}
74-
$where_clauses[] = $where_clause;
75-
});
76-
77-
$mismatches_per_upload_user->where(function ($query) use ($where_clauses) {
78-
foreach ($where_clauses as $where_clause) {
79-
$query->orWhere(function ($query) use ($where_clause) {
80-
$query->where($where_clause);
81-
});
49+
DB::transaction(function () use ($reader, $filepath) {
50+
$reader->lines($filepath)->each(function ($mismatchLine) {
51+
$mismatch = Mismatch::make($mismatchLine);
52+
if ($mismatch->type == null) {
53+
$mismatch->type = 'statement';
8254
}
55+
$mismatch->importMeta()->associate($this->meta);
56+
$mismatch->save();
8357
});
8458

85-
$existing_mismatches = $mismatches_per_upload_user->get();
86-
87-
foreach ($new_mismatches as $new_mismatch) {
88-
if ($existing_mismatches->doesntContain(function ($value) use ($new_mismatch) {
89-
$metaAttrs = $new_mismatch->getAttributes();
90-
foreach ($metaAttrs as $attrKey => $attr) {
91-
if ($attrKey != 'review_status' && $value->{$attrKey} != $attr) {
92-
return false;
93-
}
94-
}
95-
return true;
96-
})) {
97-
$this->saveMismatch($new_mismatch);
98-
}
99-
}
100-
10159
$this->meta->status = 'completed';
10260
$this->meta->save();
10361
});
@@ -106,7 +64,7 @@ public function handle(CSVImportReader $reader)
10664
/**
10765
* Handle a job failure.
10866
*
109-
* @param \Throwable $exception
67+
* @param \Throwable $exception
11068
* @return void
11169
*/
11270
public function failed(Throwable $exception)
@@ -120,29 +78,4 @@ public function failed(Throwable $exception)
12078
$this->meta->status = 'failed';
12179
$this->meta->save();
12280
}
123-
124-
125-
private function createMismatch($mismatch_data)
126-
{
127-
$new_mismatch = Mismatch::make($mismatch_data);
128-
129-
if ($new_mismatch->type == null) {
130-
$new_mismatch->type = 'statement';
131-
}
132-
133-
return $new_mismatch;
134-
}
135-
136-
/**
137-
* Save mismatch to database
138-
*
139-
* @param \Mismatch $new_mismatch
140-
* @return void
141-
*/
142-
private function saveMismatch($new_mismatch)
143-
{
144-
// if review_status == pending -> save
145-
$new_mismatch->importMeta()->associate($this->meta);
146-
$new_mismatch->save();
147-
}
14881
}

app/Providers/RouteServiceProvider.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Illuminate\Http\Request;
88
use Illuminate\Support\Facades\RateLimiter;
99
use Illuminate\Support\Facades\Route;
10+
use Illuminate\Support\Facades\App;
1011

1112
class RouteServiceProvider extends ServiceProvider
1213
{
@@ -48,6 +49,13 @@ public function boot()
4849
->namespace($this->namespace)
4950
->group(base_path('routes/auth.php'));
5051

52+
if (App::environment('local')) {
53+
Route::prefix('dev')
54+
->middleware('web')
55+
->namespace($this->namespace)
56+
->group(base_path('routes/dev.php'));
57+
}
58+
5159
Route::middleware('web')
5260
->namespace($this->namespace)
5361
->group(base_path('routes/web.php'));

0 commit comments

Comments
 (0)