[chronojump] processMultiDatabases finds personCode
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] processMultiDatabases finds personCode
- Date: Wed, 15 Jan 2020 12:45:43 +0000 (UTC)
commit b3ab37fc71598fd7ab4cd70870c9569a323fd21e
Author: Xavier de Blas <xaviblas gmail com>
Date: Wed Jan 15 13:45:35 2020 +0100
processMultiDatabases finds personCode
processMultiDatabases/computerDB.cs | 7 ++++---
processMultiDatabases/person.cs | 12 ++++++++++++
processMultiDatabases/processMultiDatabases.cs | 8 +++++---
3 files changed, 21 insertions(+), 6 deletions(-)
---
diff --git a/processMultiDatabases/computerDB.cs b/processMultiDatabases/computerDB.cs
index 0965069b..c0d3c96b 100644
--- a/processMultiDatabases/computerDB.cs
+++ b/processMultiDatabases/computerDB.cs
@@ -47,7 +47,7 @@ using System.Text.RegularExpressions; //Regex
class ComputerDB
{
public string city;
- public string name;
+ public string computer;
public string path;
public string pathToFindMoments; //at barcelona we can find datetimes on 4 folders to know which
moment
//exercises, if one is not done on that computer: -1
@@ -63,7 +63,7 @@ class ComputerDB
public enum ExerciseString { BICEPSCURL, JUMP, SITTOSTAND };
public ComputerDB(
string city,
- string name,
+ string computer,
string path,
string pathToFindMoments,
int exBicepsCurlID, int exJumpID, int exSitToStandID,
@@ -72,7 +72,7 @@ class ComputerDB
)
{
this.city = city;
- this.name = name;
+ this.computer = computer;
this.path = path;
this.pathToFindMoments = pathToFindMoments;
this.exBicepsCurlID = exBicepsCurlID;
@@ -126,6 +126,7 @@ class ComputerDB
}
}
+
class ComputerDBManage
{
/*
diff --git a/processMultiDatabases/person.cs b/processMultiDatabases/person.cs
index 7ae85529..dde378c6 100644
--- a/processMultiDatabases/person.cs
+++ b/processMultiDatabases/person.cs
@@ -22,6 +22,7 @@ using System;
using System.Data;
using System.Text; //StringBuilder
using System.Collections; //ArrayList
+using System.Text.RegularExpressions; //Regex
public class Person {
@@ -73,6 +74,17 @@ public class Person {
return "[uniqueID: " + uniqueID + "]" + name + ", " + ", " + sex + ", " +
dateBorn.ToShortDateString() + ", " + description;
}
+ public string FindPersonCode (string city)
+ {
+ if(city == "denmark")
+ {
+ Match match = Regex.Match(name, @"^(\d+)");
+ if(match.Groups.Count == 2)
+ return match.Value;
+ }
+
+ return "";
+ }
//some "set"s are needed. If not data of personSession does not arrive to the server
diff --git a/processMultiDatabases/processMultiDatabases.cs b/processMultiDatabases/processMultiDatabases.cs
index 4f7ee393..50333d5a 100644
--- a/processMultiDatabases/processMultiDatabases.cs
+++ b/processMultiDatabases/processMultiDatabases.cs
@@ -96,7 +96,7 @@ using System.Collections.Generic; //List<T>
class ProcessMultiDatabases
{
private bool debug = false; //on debug just 5 sets of each compDB-exercise are used
- private int distMin = 20; //distMinSitToStand = 20;
+ private int distMin = 20; //distMinSitToStand = 20; TODO: do this by exercise, before study what
range of reps we have at each exercise starting with distMin = 5
private Sqlite sqlite;
TextWriter writer;
@@ -118,7 +118,7 @@ class ProcessMultiDatabases
ComputerDBManage compDBManage = new ComputerDBManage();
writer = File.CreateText("/tmp/chronojump-processMultiEncoder.csv");
-
writer.WriteLine("city,computer,exercise,person,sex,moment,rep,series,exercise,massBody,massExtra,start,width,height,meanSpeed,maxSpeed,maxSpeedT,meanPower,peakPower,peakPowerT,RPD,meanForce,maxForce,maxForceT,RFD,workJ,impulse,laterality,inertiaM");
+
writer.WriteLine("city,computer,person,personCode,sex,exercise,moment,rep,series,exercise,massBody,massExtra,start,width,height,meanSpeed,maxSpeed,maxSpeedT,meanPower,peakPower,peakPowerT,RPD,meanForce,maxForce,maxForceT,RFD,workJ,impulse,laterality,inertiaM");
foreach(ComputerDB compDB in compDBManage.list)
{
@@ -212,9 +212,11 @@ class ProcessMultiDatabases
if(firstRep)
firstRep = false;
else {
- string repToWriter = string.Format("{0},{1},{2},{3},{4},{5},",
compDB.city, compDB.name, exerciseString, person.Name, person.Sex, moment) + rep;
+ string repToWriter = string.Format("{0},{1},{2},{3},{4},{5},{6},",
+ compDB.city, compDB.computer, person.Name,
person.FindPersonCode(compDB.city), person.Sex, exerciseString, moment) + rep;
//note personID is not correct because persons sometimes where
evaluated on different chronojump machines
//for this reason has been changed to personName, we suppose is the
same on different machines
+ //person.FindPersonCode() should be the code of that person on all
the computers of a given city
writer.WriteLine(repToWriter);
writer.Flush();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]