Code clean-up (make fmt)
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
parent
974880401e
commit
8e15c1d6fd
18 changed files with 53 additions and 46 deletions
|
@ -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;
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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))
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package entity
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestCategory_TableName(t *testing.T) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package entity
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestEvent_TableName(t *testing.T) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package entity
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestNewKeyword(t *testing.T) {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
|
@ -251,4 +251,4 @@ var CountryNames = map[string]string{
|
|||
"ye": "Yemen",
|
||||
"zm": "Zambia",
|
||||
"zw": "Zimbabwe",
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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 ""
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
)
|
||||
|
||||
var labelTitles = map[string]string{
|
||||
"airport": "Airport",
|
||||
"airport": "Airport",
|
||||
"visitor center": "Visitor Center",
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -84,5 +84,5 @@ func (l Labels) Title(fallback string) string {
|
|||
return label.Name
|
||||
}
|
||||
|
||||
return fallback
|
||||
return fallback
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ type PhotoResult struct {
|
|||
LensMake string
|
||||
|
||||
// Country
|
||||
CountryID string
|
||||
CountryID string
|
||||
|
||||
// Location
|
||||
LocationID string
|
||||
|
|
Loading…
Reference in a new issue