Skip to content

Commit

Permalink
107 bug laundry appliance status is reported incorrectly (#108)
Browse files Browse the repository at this point in the history
* add unknown status from laundryview

* update change log for laundryview change
  • Loading branch information
clint156 authored Aug 26, 2024
1 parent 24951a6 commit dffd53f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unpublished] - 2024-08-26
### Changed
- Based on data coming back from LaundryView, uiuc laundry adapter now reutrns unknown as a status when the machine is offline and the out for service flag is 0. [#107]https://github.com/rokwire/gateway-building-block/issues/107

## [2.10.3] - 2024-06-28
### Changed
- Added markers and highlites parameters to floor plans endpoint to allow client to set default state. [#103](https://github.com/rokwire/gateway-building-block/issues/103)
Expand Down
12 changes: 9 additions & 3 deletions core/model/uiuc/laundryview.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,25 @@ func NewLaundryRoom(id int, name string, status string, location *model.LaundryD
}

// NewAppliance returns an app formatted appliance ojbect from campus data
func NewAppliance(id string, appliancetype string, cycletime int, status string, timeremaining string, label string) *model.Appliance {
func NewAppliance(id string, appliancetype string, cycletime int, status string, timeremaining string, label string, outofserviceflag string) *model.Appliance {

var finalStatus string
switch status {
case "Available":
finalStatus = "available"
case "In Use":
finalStatus = "in_use"
case "Offline":
if outofserviceflag == "1" {
finalStatus = "out_of_service"
} else {
finalStatus = "unknown"
}
default:
finalStatus = "out_of_service"
finalStatus = "unknown"
}

if finalStatus == "available" || finalStatus == "out_of_service" {
if finalStatus == "available" || finalStatus == "out_of_service" || finalStatus == "unknown" {
appl := model.Appliance{ID: id, ApplianceType: appliancetype, AverageCycleTime: cycletime, Status: finalStatus, Label: label}
return &appl
}
Expand Down
2 changes: 1 addition & 1 deletion driven/uiucadapters/laundryadapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (lv *CSCLaundryView) GetLaundryRoom(roomid string, conf *model.EnvConfigDat

for i, appl := range lr.Appliances {
avgCycle, _ := strconv.Atoi(appl.AvgCycleTime)
rd.Appliances[i] = uiuc.NewAppliance(appl.ApplianceKey, appl.ApplianceType, avgCycle, appl.Status, appl.TimeRemaining, appl.Label)
rd.Appliances[i] = uiuc.NewAppliance(appl.ApplianceKey, appl.ApplianceType, avgCycle, appl.Status, appl.TimeRemaining, appl.Label, appl.OutOfService)
}

if len(lv.laundryAssets) > 0 {
Expand Down

0 comments on commit dffd53f

Please sign in to comment.