Added a case for the Zero 2 W.

This commit is contained in:
MarkBryanMilligan 2021-12-03 21:48:13 -06:00
parent f5066c541f
commit 9f00c2fb8a
11 changed files with 13 additions and 3 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
case/Z2/LPM_Case_Z2_Lid.stl Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
case/Z2/Z2_GPIO_Lid.blend Normal file

Binary file not shown.

BIN
case/Z2/Z2_GPIO_Lid.stl Normal file

Binary file not shown.

View File

@ -302,6 +302,8 @@ public class MongoCurrentMonitorDao implements CurrentMonitorDao {
@Override
public void rebuildSummaries(int _accountId, Date _start, Date _end) {
BreakerConfig config = getConfig(_accountId);
if (config == null)
return;
TimeZone tz = getTimeZoneForAccount(_accountId);
Date start = DateUtils.getMidnightBefore(_start, tz);
BreakerGroup root = CollectionUtils.getFirst(config.getBreakerGroups());
@ -397,8 +399,14 @@ public class MongoCurrentMonitorDao implements CurrentMonitorDao {
public BreakerConfig getMergedConfig(AuthCode _authCode) {
if (_authCode == null)
return null;
if (CollectionUtils.size(_authCode.getAllAccountIds()) == 1)
return getConfig(_authCode.getAccountId());
if (CollectionUtils.size(_authCode.getAllAccountIds()) == 1) {
BreakerConfig config = getConfig(_authCode.getAccountId());
if (config == null) {
config = new BreakerConfig();
config.setAccountId(_authCode.getAccountId());
return config;
}
}
List<BreakerConfig> configs = CollectionUtils.transform(_authCode.getAllAccountIds(), this::getConfig, true);
BreakerConfig config = new BreakerConfig();
config.setAccountId(_authCode.getAccountId());
@ -438,7 +446,9 @@ public class MongoCurrentMonitorDao implements CurrentMonitorDao {
@Override
public String authenticateAccount(String _username, String _password) {
Account acct = proxy.queryOne(Account.class, new DaoQuery("username", _username));
if (NullUtils.isEmpty(_username) || NullUtils.isEmpty(_password))
return null;
Account acct = proxy.queryOne(Account.class, new DaoQuery("username", _username.toLowerCase().trim()));
if ((acct == null) || !BCrypt.checkpw(_password, acct.getPassword()))
return null;
return toAuthCode(acct.getId(), acct.getAuxiliaryAccountIds());