clean up calorie table
This commit is contained in:
@@ -139,7 +139,7 @@ CString Profile::GetDisplayTotalCaloriesBurned() const
|
||||
if( m_fWeightPounds == 0 ) // weight not entered
|
||||
return "N/A";
|
||||
else
|
||||
return ssprintf("%0.3f Cal",m_fTotalCaloriesBurned);
|
||||
return Commify(m_fTotalCaloriesBurned) + " Cal";
|
||||
}
|
||||
|
||||
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;
|
||||
m_fTotalCaloriesBurned += fCals;
|
||||
|
||||
time_t cur_time = time(NULL);
|
||||
tm *cur_tm = localtime( &cur_time );
|
||||
Day day = { cur_tm->tm_yday, cur_tm->tm_year+1900 };
|
||||
tm cur_tm = GetLocalTime();
|
||||
Day day = { cur_tm.tm_yday, cur_tm.tm_year+1900 };
|
||||
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 bPrintedAny = false;
|
||||
|
||||
for( StepsType st=(StepsType)0; st<NUM_STEPS_TYPES; st=(StepsType)(st+1) )
|
||||
{
|
||||
FOREACH_CourseDifficulty( cd )
|
||||
@@ -662,6 +664,8 @@ bool PrintHighScoresForCourse( RageFile &f, const Profile *pProfile, Course* pCo
|
||||
if( hsl.vHighScores.empty() )
|
||||
continue;
|
||||
|
||||
bPrintedAny = true;
|
||||
|
||||
PRINT_OPEN(f, GAMEMAN->NotesTypeToString(st)+" - "+CourseDifficultyToString(cd) );
|
||||
{
|
||||
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 )
|
||||
@@ -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-- )
|
||||
{
|
||||
Profile::Screenshot ss = pProfile->m_vScreenshots[i];
|
||||
tm* new_time = localtime( &ss.time );
|
||||
int iYear = new_time->tm_year+1900;
|
||||
int iMonth = new_time->tm_mon+1;
|
||||
tm new_time;
|
||||
localtime_r( &ss.time, &new_time );
|
||||
int iYear = new_time.tm_year+1900;
|
||||
int iMonth = new_time.tm_mon+1;
|
||||
CString sNewMonth = ssprintf("%02d/%d", iMonth, iYear );
|
||||
|
||||
if( sNewMonth != sCurrentMonth )
|
||||
@@ -971,21 +976,20 @@ void PrintCaloriesBurned( RageFile &f, const Profile *pProfile, CString sTitle,
|
||||
{
|
||||
PRINT_OPEN(f, sTitle );
|
||||
{
|
||||
f.Write("<table>\n");
|
||||
f.Write("<table class='calories'>\n");
|
||||
|
||||
// header row
|
||||
f.Write("<tr>");
|
||||
f.Write("<td></td>");
|
||||
{
|
||||
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("</tr>");
|
||||
|
||||
// row for each week
|
||||
time_t now = time( NULL );
|
||||
tm when = *localtime( &now );
|
||||
tm when = GetLocalTime();
|
||||
when = GetNextSunday( when );
|
||||
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 };
|
||||
float fDayCals = pProfile->GetCaloriesBurnedForDay( day );
|
||||
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 );
|
||||
}
|
||||
f.Write("<td>"+ssprintf("%0.3f",fWeekCals)+"</td>");
|
||||
f.Write("<td class='weekcalories'><font class='weekcalories'>"+Commify(fWeekCals)+"</font></td>");
|
||||
f.Write("</tr>");
|
||||
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 );
|
||||
PrintGradeTable( f, pProfile, "My Grade Table", 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;
|
||||
case HTML_TYPE_MACHINE:
|
||||
PrintStatistics( f, pProfile, "Statistics", vpSongs, vpAllSteps, vStepsTypesToShow, mapStepsToSong, vpCourses );
|
||||
|
||||
@@ -58,6 +58,11 @@ CString DayOfWeekToString( int iDayOfWeekIndex )
|
||||
return DAY_OF_WEEK_TO_NAME[iDayOfWeekIndex];
|
||||
}
|
||||
|
||||
CString DayOfWeekToShortString( int iDayOfWeekIndex )
|
||||
{
|
||||
return DayOfWeekToString(iDayOfWeekIndex).Left(3);
|
||||
}
|
||||
|
||||
CString HourInDayToString( int iHourInDayIndex )
|
||||
{
|
||||
return ssprintf("%02d:00", iHourInDayIndex);
|
||||
@@ -124,8 +129,7 @@ tm GetNextSunday( tm start )
|
||||
|
||||
tm GetDayInYearAndYear( int iDayInYearIndex, int iYear )
|
||||
{
|
||||
time_t now = time( NULL );
|
||||
tm when = *localtime( &now );
|
||||
tm when = GetLocalTime();
|
||||
|
||||
when.tm_mday = iDayInYearIndex;
|
||||
when.tm_year = iYear - 1900;
|
||||
|
||||
@@ -24,6 +24,7 @@ const int MONTHS_IN_YEAR = 12;
|
||||
CString DayInYearToString( int iDayInYearIndex );
|
||||
CString LastDayToString( int iLastDayIndex );
|
||||
CString DayOfWeekToString( int iDayOfWeekIndex );
|
||||
CString DayOfWeekToShortString( int iDayOfWeekIndex );
|
||||
CString HourInDayToString( int iHourIndex );
|
||||
CString MonthToString( int iMonthIndex );
|
||||
CString LastWeekToString( int iLastWeekIndex );
|
||||
|
||||
Reference in New Issue
Block a user