Type the answers of a few puzzles. The puzzles are case sensitive.
";
content+="
";
- //TODO if we are already inserting a solution for an identity - we shouldn't select any puzzles that are older than the one we are inserting
date.SetToGMTime();
date.Add(0,0,0,-1);
- SQLite3DB::Statement st=m_db->Prepare("SELECT UUID,Day,IdentityID FROM tblIntroductionPuzzleRequests WHERE UUID NOT IN (SELECT UUID FROM tblIdentityIntroductionInserts) AND UUID NOT IN (SELECT UUID FROM tblIntroductionPuzzleInserts) AND Day>='"+date.Format("%Y-%m-%d")+"' AND Found='true' ORDER BY IdentityID, Day DESC, RequestIndex DESC;");
+ SQLite3DB::Statement st=m_db->Prepare("SELECT UUID,Day,IdentityID,RequestIndex FROM tblIntroductionPuzzleRequests WHERE UUID NOT IN (SELECT UUID FROM tblIdentityIntroductionInserts) AND UUID NOT IN (SELECT UUID FROM tblIntroductionPuzzleInserts) AND Day>='"+date.Format("%Y-%m-%d")+"' AND Found='true' ORDER BY IdentityID, Day DESC, RequestIndex DESC;");
st.Step();
if(st.RowReturned()==false)
@@ -107,8 +108,25 @@ const std::string AnnounceIdentityPage::GeneratePage(const std::string &method,
st.ResultText(0,uuid);
st.ResultText(1,day);
st.ResultText(2,thisid);
+ st.ResultInt(3,requestindex);
+
+ // if we are already inserting a solution for an identity - we shouldn't show any puzzles that are older than the one we are inserting
+ // get the last index # we are inserting this day from this identity
+ // if the index here is greater than the index in the st statement, we will skip this puzzle because we are already inserting a puzzle with a greater index
+ willshow=true;
+ SQLite3DB::Statement st2=m_db->Prepare("SELECT MAX(RequestIndex) FROM tblIdentityIntroductionInserts INNER JOIN tblIntroductionPuzzleRequests ON tblIdentityIntroductionInserts.UUID=tblIntroductionPuzzleRequests.UUID WHERE tblIdentityIntroductionInserts.Day=? AND tblIdentityIntroductionInserts.UUID IN (SELECT UUID FROM tblIntroductionPuzzleRequests WHERE IdentityID=? AND Day=?) GROUP BY tblIdentityIntroductionInserts.Day;");
+ st2.Step();
+ if(st2.RowReturned()==true)
+ {
+ int index=0;
+ st2.ResultInt(0,index);
+ if(index>=requestindex)
+ {
+ willshow=false;
+ }
+ }
- if(thisid!=lastid)
+ if(willshow && thisid!=lastid)
{
StringFunctions::Convert(shown,countstr);
if(shown>0 && shown%4==0)
@@ -121,7 +139,7 @@ const std::string AnnounceIdentityPage::GeneratePage(const std::string &method,
content+="";
content+="";
content+="\r\n";
- thisid=lastid;
+ lastid=thisid;
shown++;
}