clean up calorie table
This commit is contained in:
@@ -139,7 +139,7 @@ CString Profile::GetDisplayTotalCaloriesBurned() const
|
|||||||
if( m_fWeightPounds == 0 ) // weight not entered
|
if( m_fWeightPounds == 0 ) // weight not entered
|
||||||
return "N/A";
|
return "N/A";
|
||||||
else
|
else
|
||||||
return ssprintf("%0.3f Cal",m_fTotalCaloriesBurned);
|
return Commify(m_fTotalCaloriesBurned) + " Cal";
|
||||||
}
|
}
|
||||||
|
|
||||||
int Profile::GetTotalNumSongsPlayed() const
|
int Profile::GetTotalNumSongsPlayed() const
|
||||||
@@ -742,9 +742,8 @@ void Profile::AddStepTotals( int iTotalTapsAndHolds, int iTotalJumps, int iTotal
|
|||||||
SCALE( m_fWeightPounds, 100.f, 200.f, 0.222f, 0.386f ) * iTotalHands;
|
SCALE( m_fWeightPounds, 100.f, 200.f, 0.222f, 0.386f ) * iTotalHands;
|
||||||
m_fTotalCaloriesBurned += fCals;
|
m_fTotalCaloriesBurned += fCals;
|
||||||
|
|
||||||
time_t cur_time = time(NULL);
|
tm cur_tm = GetLocalTime();
|
||||||
tm *cur_tm = localtime( &cur_time );
|
Day day = { cur_tm.tm_yday, cur_tm.tm_year+1900 };
|
||||||
Day day = { cur_tm->tm_yday, cur_tm->tm_year+1900 };
|
|
||||||
m_mapDayToCaloriesBurned[day] += fCals;
|
m_mapDayToCaloriesBurned[day] += fCals;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -654,6 +654,8 @@ bool PrintHighScoresForSong( RageFile &f, const Profile *pProfile, Song* pSong )
|
|||||||
|
|
||||||
bool PrintHighScoresForCourse( RageFile &f, const Profile *pProfile, Course* pCourse )
|
bool PrintHighScoresForCourse( RageFile &f, const Profile *pProfile, Course* pCourse )
|
||||||
{
|
{
|
||||||
|
bool bPrintedAny = false;
|
||||||
|
|
||||||
for( StepsType st=(StepsType)0; st<NUM_STEPS_TYPES; st=(StepsType)(st+1) )
|
for( StepsType st=(StepsType)0; st<NUM_STEPS_TYPES; st=(StepsType)(st+1) )
|
||||||
{
|
{
|
||||||
FOREACH_CourseDifficulty( cd )
|
FOREACH_CourseDifficulty( cd )
|
||||||
@@ -662,6 +664,8 @@ bool PrintHighScoresForCourse( RageFile &f, const Profile *pProfile, Course* pCo
|
|||||||
if( hsl.vHighScores.empty() )
|
if( hsl.vHighScores.empty() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
bPrintedAny = true;
|
||||||
|
|
||||||
PRINT_OPEN(f, GAMEMAN->NotesTypeToString(st)+" - "+CourseDifficultyToString(cd) );
|
PRINT_OPEN(f, GAMEMAN->NotesTypeToString(st)+" - "+CourseDifficultyToString(cd) );
|
||||||
{
|
{
|
||||||
PrintHighScoreListTable( f, hsl );
|
PrintHighScoreListTable( f, hsl );
|
||||||
@@ -670,7 +674,7 @@ bool PrintHighScoresForCourse( RageFile &f, const Profile *pProfile, Course* pCo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return bPrintedAny;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PrintHighScoresForGroup(RageFile &f, const Profile *pProfile, CString sGroup )
|
bool PrintHighScoresForGroup(RageFile &f, const Profile *pProfile, CString sGroup )
|
||||||
@@ -936,9 +940,10 @@ void PrintScreenshots( RageFile &f, const Profile *pProfile, CString sTitle, CSt
|
|||||||
for( int i = (int)pProfile->m_vScreenshots.size()-1; i >= 0; i-- )
|
for( int i = (int)pProfile->m_vScreenshots.size()-1; i >= 0; i-- )
|
||||||
{
|
{
|
||||||
Profile::Screenshot ss = pProfile->m_vScreenshots[i];
|
Profile::Screenshot ss = pProfile->m_vScreenshots[i];
|
||||||
tm* new_time = localtime( &ss.time );
|
tm new_time;
|
||||||
int iYear = new_time->tm_year+1900;
|
localtime_r( &ss.time, &new_time );
|
||||||
int iMonth = new_time->tm_mon+1;
|
int iYear = new_time.tm_year+1900;
|
||||||
|
int iMonth = new_time.tm_mon+1;
|
||||||
CString sNewMonth = ssprintf("%02d/%d", iMonth, iYear );
|
CString sNewMonth = ssprintf("%02d/%d", iMonth, iYear );
|
||||||
|
|
||||||
if( sNewMonth != sCurrentMonth )
|
if( sNewMonth != sCurrentMonth )
|
||||||
@@ -971,21 +976,20 @@ void PrintCaloriesBurned( RageFile &f, const Profile *pProfile, CString sTitle,
|
|||||||
{
|
{
|
||||||
PRINT_OPEN(f, sTitle );
|
PRINT_OPEN(f, sTitle );
|
||||||
{
|
{
|
||||||
f.Write("<table>\n");
|
f.Write("<table class='calories'>\n");
|
||||||
|
|
||||||
// header row
|
// header row
|
||||||
f.Write("<tr>");
|
f.Write("<tr>");
|
||||||
f.Write("<td></td>");
|
f.Write("<td></td>");
|
||||||
{
|
{
|
||||||
for( int i=0; i<DAYS_IN_WEEK; i++ )
|
for( int i=0; i<DAYS_IN_WEEK; i++ )
|
||||||
f.Write("<td>"+DayOfWeekToString(i)+"</td>");
|
f.Write("<td>"+DayOfWeekToShortString(i)+"</td>");
|
||||||
}
|
}
|
||||||
f.Write("<td>Total</td>");
|
f.Write("<td>Total</td>");
|
||||||
f.Write("</tr>");
|
f.Write("</tr>");
|
||||||
|
|
||||||
// row for each week
|
// row for each week
|
||||||
time_t now = time( NULL );
|
tm when = GetLocalTime();
|
||||||
tm when = *localtime( &now );
|
|
||||||
when = GetNextSunday( when );
|
when = GetNextSunday( when );
|
||||||
when = AddDays( when, -DAYS_IN_WEEK );
|
when = AddDays( when, -DAYS_IN_WEEK );
|
||||||
{
|
{
|
||||||
@@ -999,10 +1003,10 @@ void PrintCaloriesBurned( RageFile &f, const Profile *pProfile, CString sTitle,
|
|||||||
Profile::Day day = { when.tm_yday, when.tm_year+1900 };
|
Profile::Day day = { when.tm_yday, when.tm_year+1900 };
|
||||||
float fDayCals = pProfile->GetCaloriesBurnedForDay( day );
|
float fDayCals = pProfile->GetCaloriesBurnedForDay( day );
|
||||||
fWeekCals += fDayCals;
|
fWeekCals += fDayCals;
|
||||||
f.Write("<td>"+ssprintf("%0.3f",fDayCals)+"</td>");
|
f.Write("<td class='daycalories'><font class='daycalories'>"+((fDayCals==0)?"":Commify(fDayCals))+"</font></td>");
|
||||||
when = AddDays( when, +1 );
|
when = AddDays( when, +1 );
|
||||||
}
|
}
|
||||||
f.Write("<td>"+ssprintf("%0.3f",fWeekCals)+"</td>");
|
f.Write("<td class='weekcalories'><font class='weekcalories'>"+Commify(fWeekCals)+"</font></td>");
|
||||||
f.Write("</tr>");
|
f.Write("</tr>");
|
||||||
when = AddDays( when, -DAYS_IN_WEEK*2 );
|
when = AddDays( when, -DAYS_IN_WEEK*2 );
|
||||||
}
|
}
|
||||||
@@ -1167,7 +1171,8 @@ TITLE.c_str(), STYLE_CSS.c_str() ) );
|
|||||||
PrintCaloriesBurned( f, pProfile, "My Calories Burned", sDir );
|
PrintCaloriesBurned( f, pProfile, "My Calories Burned", sDir );
|
||||||
PrintGradeTable( f, pProfile, "My Grade Table", vpSongs, vpAllSteps, vStepsTypesToShow, mapStepsToSong, vpCourses );
|
PrintGradeTable( f, pProfile, "My Grade Table", vpSongs, vpAllSteps, vStepsTypesToShow, mapStepsToSong, vpCourses );
|
||||||
PrintPopularity( f, pProfile, "Last Machine Popularity", vpSongs, vpAllSteps, vStepsTypesToShow, mapStepsToSong, vpCourses );
|
PrintPopularity( f, pProfile, "Last Machine Popularity", vpSongs, vpAllSteps, vStepsTypesToShow, mapStepsToSong, vpCourses );
|
||||||
PrintSongHighScores( f, pProfile, "Last Machine High Scores", vpSongs, vpAllSteps, vStepsTypesToShow, mapStepsToSong, vpCourses );
|
PrintSongHighScores( f, pProfile, "Last Machine Song High Scores", vpSongs, vpAllSteps, vStepsTypesToShow, mapStepsToSong, vpCourses );
|
||||||
|
PrintCourseHighScores( f, pProfile, "Last Machine Course High Scores", vpSongs, vpAllSteps, vStepsTypesToShow, mapStepsToSong, vpCourses );
|
||||||
break;
|
break;
|
||||||
case HTML_TYPE_MACHINE:
|
case HTML_TYPE_MACHINE:
|
||||||
PrintStatistics( f, pProfile, "Statistics", vpSongs, vpAllSteps, vStepsTypesToShow, mapStepsToSong, vpCourses );
|
PrintStatistics( f, pProfile, "Statistics", vpSongs, vpAllSteps, vStepsTypesToShow, mapStepsToSong, vpCourses );
|
||||||
|
|||||||
@@ -58,6 +58,11 @@ CString DayOfWeekToString( int iDayOfWeekIndex )
|
|||||||
return DAY_OF_WEEK_TO_NAME[iDayOfWeekIndex];
|
return DAY_OF_WEEK_TO_NAME[iDayOfWeekIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CString DayOfWeekToShortString( int iDayOfWeekIndex )
|
||||||
|
{
|
||||||
|
return DayOfWeekToString(iDayOfWeekIndex).Left(3);
|
||||||
|
}
|
||||||
|
|
||||||
CString HourInDayToString( int iHourInDayIndex )
|
CString HourInDayToString( int iHourInDayIndex )
|
||||||
{
|
{
|
||||||
return ssprintf("%02d:00", iHourInDayIndex);
|
return ssprintf("%02d:00", iHourInDayIndex);
|
||||||
@@ -124,8 +129,7 @@ tm GetNextSunday( tm start )
|
|||||||
|
|
||||||
tm GetDayInYearAndYear( int iDayInYearIndex, int iYear )
|
tm GetDayInYearAndYear( int iDayInYearIndex, int iYear )
|
||||||
{
|
{
|
||||||
time_t now = time( NULL );
|
tm when = GetLocalTime();
|
||||||
tm when = *localtime( &now );
|
|
||||||
|
|
||||||
when.tm_mday = iDayInYearIndex;
|
when.tm_mday = iDayInYearIndex;
|
||||||
when.tm_year = iYear - 1900;
|
when.tm_year = iYear - 1900;
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ const int MONTHS_IN_YEAR = 12;
|
|||||||
CString DayInYearToString( int iDayInYearIndex );
|
CString DayInYearToString( int iDayInYearIndex );
|
||||||
CString LastDayToString( int iLastDayIndex );
|
CString LastDayToString( int iLastDayIndex );
|
||||||
CString DayOfWeekToString( int iDayOfWeekIndex );
|
CString DayOfWeekToString( int iDayOfWeekIndex );
|
||||||
|
CString DayOfWeekToShortString( int iDayOfWeekIndex );
|
||||||
CString HourInDayToString( int iHourIndex );
|
CString HourInDayToString( int iHourIndex );
|
||||||
CString MonthToString( int iMonthIndex );
|
CString MonthToString( int iMonthIndex );
|
||||||
CString LastWeekToString( int iLastWeekIndex );
|
CString LastWeekToString( int iLastWeekIndex );
|
||||||
|
|||||||
Reference in New Issue
Block a user