Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Albin Geraud Kouatcho Nkuigwa
PSE_Projekt
Commits
cd973b5c
Commit
cd973b5c
authored
Jun 26, 2018
by
Janik Münzenberger
Browse files
Edited caching strategy
parent
712a3c62
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/app/pages/analyse/analyse.component.css
View file @
cd973b5c
...
...
@@ -9,7 +9,7 @@
img
{
max-width
:
100%
;
margin
:
0
1rem
;
margin
:
0
auto
;
}
label
{
...
...
src/app/pages/garderner/listmap/listmap.component.html
View file @
cd973b5c
...
...
@@ -24,4 +24,4 @@
</p>
</a>
</div>
<div
class=
"list-group"
*ngIf=
"!mapservice.data.length"
>
{{"ERRORS.GARDENERS" | translate}}
</div>
\ No newline at end of file
<h5
class=
"mt-4"
*ngIf=
"!mapservice.data.length"
>
{{"ERRORS.GARDENERS" | translate}}
</h5>
\ No newline at end of file
src/app/pages/plantdetails/plantdetails.component.html
View file @
cd973b5c
...
...
@@ -34,7 +34,7 @@
</tr>
</tbody>
</table>
<section
class=
"my-5 mt-my-0"
>
<section
class=
"my-5 mt-my-0"
*ngIf=
"plant?.diseases"
>
<h3>
{{"PLANT.DISEASES" | translate}}
</h3>
<div
class=
"list-group"
>
<li
style=
"cursor:pointer;"
class=
"list-group-item list-group-item-action"
*ngFor=
"let d of plant?.diseases | sort"
[routerLink]=
"['/disease', d._id]"
>
...
...
src/app/services/disease.service.ts
View file @
cd973b5c
...
...
@@ -8,17 +8,30 @@ import { DataService } from './data.service';
*/
@
Injectable
()
export
class
DiseaseService
extends
DataService
{
private
diseases
:
IDisease
[]
=
[];
constructor
(
protected
apiService
:
ApiService
)
{
super
(
'
diseases/
'
,
apiService
,
[
'
created
'
,
'
modified
'
]);
}
getAllDiseases
():
Promise
<
IDisease
[]
>
{
return
this
.
readItems
<
IDisease
>
();
return
this
.
readItems
<
IDisease
>
()
.
then
(
diseases
=>
this
.
diseases
=
diseases
)
;
}
getSingleDisease
(
id
:
number
|
string
){
return
this
.
readSingleItem
<
IDisease
>
(
id
);
async
getSingleDisease
(
id
:
number
|
string
){
try
{
let
disease
=
await
this
.
getSingleDisease
(
id
);
return
disease
;
}
catch
(
err
){
try
{
if
(
!
this
.
diseases
.
length
)
await
this
.
getAllDiseases
();
let
disease
=
this
.
diseases
.
find
(
disease
=>
disease
.
_id
==
id
);
if
(
!
disease
)
throw
err
;
else
return
disease
;
}
catch
(
err
){
throw
err
;
}
}
}
}
src/backend/controller/disease.js
View file @
cd973b5c
...
...
@@ -3,7 +3,7 @@ const logger = require('winston');
/** Get all diseases with name and id */
function
getDiseases
(
req
,
res
){
Disease
.
find
({}
,
[
"
id
"
,
"
name
"
,
"
symptoms
"
])
Disease
.
find
({}
).
populate
(
'
crop_
id
'
,
[
'
name
'
])
.
then
(
diseases
=>
{
res
.
status
(
200
);
res
.
send
({
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment