Code clean-up (make fmt)

Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
Michael Mayer 2019-12-21 17:24:29 +01:00
parent 974880401e
commit 8e15c1d6fd
18 changed files with 53 additions and 46 deletions

View file

@ -95,7 +95,7 @@ class Clipboard {
}
for (let i = rangeStart; i <= rangeEnd; i++) {
this.add(models[i])
this.add(models[i]);
}
return (rangeEnd - rangeStart) + 1;

View file

@ -1,6 +1,5 @@
import Abstract from "model/abstract";
import Api from "common/api";
import truncate from "truncate";
import { DateTime } from "luxon";
class Photo extends Abstract {
@ -106,10 +105,10 @@ class Photo extends Abstract {
getLocation() {
if (this.LocDescription) {
return this.LocDescription
return this.LocDescription;
}
return "Unknown"
return "Unknown";
}
getCamera() {

View file

@ -94,7 +94,7 @@ func CreateAlbum(router *gin.RouterGroup, conf *config.Config) {
event.Publish("count.albums", event.Data{
"count": 1,
})
*/
*/
event.Success(fmt.Sprintf("album \"%s\" created", m.AlbumName))
@ -401,7 +401,6 @@ func DownloadAlbum(router *gin.RouterGroup, conf *config.Config) {
})
}
// POST /api/v1/albums/:uuid/thumbnail/:type
//
// Parameters:

View file

@ -58,7 +58,6 @@ func TestDislikeAlbum(t *testing.T) {
})
}
func TestAlbumThumbnail(t *testing.T) {
t.Run("invalid type", func(t *testing.T) {
app, router, ctx := NewApiTest()

View file

@ -171,7 +171,7 @@ func LabelThumbnail(router *gin.RouterGroup, conf *config.Config) {
return
}
gc.Set(cacheKey, thumbData, time.Hour * 4)
gc.Set(cacheKey, thumbData, time.Hour*4)
log.Debugf("%s cached [%s]", cacheKey, time.Since(start))

View file

@ -1,8 +1,9 @@
package entity
import (
"github.com/stretchr/testify/assert"
"testing"
"github.com/stretchr/testify/assert"
)
func TestCategory_TableName(t *testing.T) {

View file

@ -13,8 +13,8 @@ type Event struct {
EventSlug string
EventName string
EventType string
EventDescription string `gorm:"type:text;"`
EventNotes string `gorm:"type:text;"`
EventDescription string `gorm:"type:text;"`
EventNotes string `gorm:"type:text;"`
EventBegin time.Time `gorm:"type:datetime;"`
EventEnd time.Time `gorm:"type:datetime;"`
EventLat float64

View file

@ -1,8 +1,9 @@
package entity
import (
"github.com/stretchr/testify/assert"
"testing"
"github.com/stretchr/testify/assert"
)
func TestEvent_TableName(t *testing.T) {

View file

@ -1,8 +1,9 @@
package entity
import (
"github.com/stretchr/testify/assert"
"testing"
"github.com/stretchr/testify/assert"
)
func TestNewKeyword(t *testing.T) {

View file

@ -12,10 +12,10 @@ import (
// Photo location
type Location struct {
maps.Location
LocNotes string `gorm:"type:text;"`
LocFavorite bool
CreatedAt time.Time
UpdatedAt time.Time
LocNotes string `gorm:"type:text;"`
LocFavorite bool
CreatedAt time.Time
UpdatedAt time.Time
}
func NewLocation(lat, lng float64) *Location {
@ -33,7 +33,7 @@ func (m *Location) Category() string {
}
func (m *Location) Find(db *gorm.DB) error {
if err := db.First(m, "id LIKE ?", m.ID + "%").Error; err == nil {
if err := db.First(m, "id LIKE ?", m.ID+"%").Error; err == nil {
return err
}

View file

@ -1,12 +1,13 @@
package entity
import (
"github.com/stretchr/testify/assert"
"testing"
"github.com/stretchr/testify/assert"
)
func TestLocation_Label(t *testing.T) {
l := NewLocation(1,1)
l := NewLocation(1, 1)
l.LocCategory = "restaurant"
result := l.Category()

View file

@ -251,4 +251,4 @@ var CountryNames = map[string]string{
"ye": "Yemen",
"zm": "Zambia",
"zw": "Zimbabwe",
}
}

View file

@ -34,11 +34,11 @@ type LocationSource interface {
Source() string
}
func NewLocation (lat, lng float64) *Location {
func NewLocation(lat, lng float64) *Location {
id := OlcEncode(lat, lng)
result := &Location{
ID: id,
ID: id,
LocLat: lat,
LocLng: lng,
}
@ -59,15 +59,21 @@ func (l *Location) Query() error {
func (l *Location) Assign(s LocationSource) error {
l.LocSource = s.Source()
if l.LocLat == 0 { l.LocLat = s.Latitude() }
if l.LocLng == 0 { l.LocLng = s.Longitude() }
if l.LocLat == 0 {
l.LocLat = s.Latitude()
}
if l.LocLng == 0 {
l.LocLng = s.Longitude()
}
if l.Unknown() {
l.LocCategory = "unknown"
return errors.New("maps: unknown location")
}
if l.ID == "" { l.ID = OlcEncode(l.LocLat, l.LocLng) }
if l.ID == "" {
l.ID = OlcEncode(l.LocLat, l.LocLng)
}
l.LocTitle = s.Title()
l.LocCity = s.City()

View file

@ -4,7 +4,7 @@ import olc "github.com/google/open-location-code/go"
var OlcLength = 8
func OlcEncode (lat, lng float64) string {
func OlcEncode(lat, lng float64) string {
if lat < -90 || lat > 90 {
log.Warnf("olc: latitude out of range (%f)", lat)
return ""

View file

@ -7,7 +7,7 @@ import (
)
var labelTitles = map[string]string{
"airport": "Airport",
"airport": "Airport",
"visitor center": "Visitor Center",
}

View file

@ -21,22 +21,22 @@ type Exif struct {
Artist string
CameraMake string
CameraModel string
Description string
LensMake string
LensModel string
Flash bool
FocalLength int
Exposure string
Aperture float64
FNumber float64
Iso int
Lat float64
Lng float64
Altitude int
Width int
Height int
Orientation int
All map[string]string
Description string
LensMake string
LensModel string
Flash bool
FocalLength int
Exposure string
Aperture float64
FNumber float64
Iso int
Lat float64
Lng float64
Altitude int
Width int
Height int
Orientation int
All map[string]string
}
var im *exif.IfdMapping

View file

@ -84,5 +84,5 @@ func (l Labels) Title(fallback string) string {
return label.Name
}
return fallback
return fallback
}

View file

@ -53,7 +53,7 @@ type PhotoResult struct {
LensMake string
// Country
CountryID string
CountryID string
// Location
LocationID string