Socket connection now works
- Pairing a new device works (I did a lot since the last commit)
This commit is contained in:
@@ -5,12 +5,16 @@ import { Beat } from "../models/beat/beat.model.";
|
||||
import { Phone } from "../models/phone/phone.model";
|
||||
|
||||
export async function GetBeatStats(req: LivebeatRequest, res: Response) {
|
||||
const phones = await Phone.find({ user: req.user?._id });
|
||||
const phones = await Phone.find({ user: req.user?._id }).exec();
|
||||
const perPhone: any = {};
|
||||
let totalBeats = 0;
|
||||
|
||||
if (phones[0] == undefined) return;
|
||||
|
||||
const phone = phones[0];
|
||||
|
||||
for (let i = 0; i < phones.length; i++) {
|
||||
const beatCount = await Beat.countDocuments({ phone: phones[i] });
|
||||
const beatCount = await Beat.countDocuments({ [phone.id]: phone.id });
|
||||
perPhone[phones[i]._id] = {};
|
||||
perPhone[phones[i]._id] = beatCount;
|
||||
totalBeats += beatCount;
|
||||
|
||||
Reference in New Issue
Block a user