Skip to content

Commit

Permalink
added number of tagged photos out of total
Browse files Browse the repository at this point in the history
  • Loading branch information
ToMaarton committed Oct 14, 2024
1 parent fc1500a commit 18ffadc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/components/cards/photo-album-card.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
{{#if album.amountOfTags}}
<span class='album-tag-counter badge bg-info bottom-0 end-0'>

Check failure on line 15 in app/components/cards/photo-album-card.hbs

View workflow job for this annotation

GitHub Actions / Lint

Incorrect indentation for `<span>` beginning at L15:C10. Expected `<span>` to be at an indentation of 8 but was found at 10.
<FaIcon @icon='tag' />
{{album.amountOfTags}}
{{album.amountOfTags}}, {{album.amountOfTaggedPhotos}}/{{album.amountOfPhotos}}
</span>
{{/if}}
</div>
Expand Down
21 changes: 14 additions & 7 deletions app/models/photo-album.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,21 @@ export default class PhotoAlbum extends Model {
}

get amountOfTags() {
var c = 0
for(var p of this.photos._objects){
c += p.amountOfTags
console.log(c)
var counter = 0

Check failure on line 39 in app/models/photo-album.js

View workflow job for this annotation

GitHub Actions / Lint

Insert `;`
for(var photo of this.photos._objects){

Check failure on line 40 in app/models/photo-album.js

View workflow job for this annotation

GitHub Actions / Lint

Replace `(var·photo·of·this.photos._objects)` with `·(var·photo·of·this.photos._objects)·`
counter += photo.amountOfTags

Check failure on line 41 in app/models/photo-album.js

View workflow job for this annotation

GitHub Actions / Lint

Insert `;`

Check warning on line 41 in app/models/photo-album.js

View check run for this annotation

Codecov / codecov/patch

app/models/photo-album.js#L39-L41

Added lines #L39 - L41 were not covered by tests
}

Check failure on line 42 in app/models/photo-album.js

View workflow job for this annotation

GitHub Actions / Lint

Delete `·`

//console.log(this.photos?._objects[1]?.amountOfTags)
return c
return counter

Check failure on line 43 in app/models/photo-album.js

View workflow job for this annotation

GitHub Actions / Lint

Insert `;`

Check warning on line 43 in app/models/photo-album.js

View check run for this annotation

Codecov / codecov/patch

app/models/photo-album.js#L43

Added line #L43 was not covered by tests
}
get amountOfTaggedPhotos() {

Check failure on line 45 in app/models/photo-album.js

View workflow job for this annotation

GitHub Actions / Lint

Expected blank line between class members
var counter = 0

Check failure on line 46 in app/models/photo-album.js

View workflow job for this annotation

GitHub Actions / Lint

Insert `;`
for(var photo of this.photos._objects){

Check failure on line 47 in app/models/photo-album.js

View workflow job for this annotation

GitHub Actions / Lint

Replace `(var·photo·of·this.photos._objects)` with `·(var·photo·of·this.photos._objects)·`
counter += photo.amountOfTags>0? 1 : 0

Check failure on line 48 in app/models/photo-album.js

View workflow job for this annotation

GitHub Actions / Lint

Replace `>0?·1·:·0` with `·>·0·?·1·:·0;`

Check warning on line 48 in app/models/photo-album.js

View check run for this annotation

Codecov / codecov/patch

app/models/photo-album.js#L46-L48

Added lines #L46 - L48 were not covered by tests
}
return counter

Check warning on line 50 in app/models/photo-album.js

View check run for this annotation

Codecov / codecov/patch

app/models/photo-album.js#L50

Added line #L50 was not covered by tests
}
get amountOfPhotos() {
return this.photos.length

Check warning on line 53 in app/models/photo-album.js

View check run for this annotation

Codecov / codecov/patch

app/models/photo-album.js#L53

Added line #L53 was not covered by tests
}

// Methods
Expand Down

0 comments on commit 18ffadc

Please sign in to comment.