CS2212-2012-G2 / SurvivorPool

CS2212 Project
Other
1 stars 0 forks source link

History for Contestant Choices #53

Closed Nava2 closed 12 years ago

Nava2 commented 12 years ago

So this is only Admin related, we don't need to worry about this for the client.

We need to maintain a historical account of who picked who at what week.

Here is what I'm thinking:

package history;

//..
public class ChoiceEntry implements Comparable<ChoiceEntry> {
// ... fields:
  String userID; // user ID
  String ultID, weekID; // weekly pick and ult pick

}

// ...
class WeekEntry extends ArrayList<ChoiceEntry> implements Comparable<WeekEntry> {
//fields:
  private int week;

//...
  public WeekEntry(int numUsers, int week) {
    super(numUsers);
    this.week = week;
  }

//...
  public int compareTo(WeekEntry we) {
    return week-we.getWeek();
  }
}

public class HistoryList implements List<WeekEntry> { // gives us nice method outline.

//...
// fields:
ArrayList<WeekEntry> history = new ArrayList<WeekEntry>();

//...

weekEntry = new WeekEntry(numUsers);
for (User u: allUsers)
  weekEntry.add(new ChoiceEntry(u.id, u.ultpick.id, u.weekpick.id);
//...
}

How's that look for structure? That way we can get a specific week, modify it, then reset the game data to original state, iterate up to the point we need to change, then move through doing the same. I emailed laura about the breaking history thing, so hopefully she will get back to us soon.

Nava2 commented 12 years ago

Obviously that's all java-like pseudo code, so please no bitching it doesn't compile :P

slyos commented 12 years ago

I tried running this in eclipse and it gave me warnings. :D

On a serious note, this seems like the only way to do it.

Nava2 commented 12 years ago

Check your emails, Laura replied! On Mar 22, 2012 12:34 PM, "Ramesh Raj" < reply@reply.github.com> wrote:

I tried running this in eclipse and it gave me warnings. :D

On a serious note, this seems like the only way to do it.


Reply to this email directly or view it on GitHub:

https://github.com/CS2212-2012-G2/SurvivorPool/issues/53#issuecomment-4642312

slyos commented 12 years ago

Invalidating will be much easier than what you have outlined before.

Compare the contestant that has the state change with every users weekly,ultimate, final pick. If contestant was switched to become a cast off, don't allow the admin from continuing.

Bringing a contestant back into the game will only be an issue during final week.

slyos commented 12 years ago

Could we just have a history.day file that is updated each time next week is clicked and all it does is store users picks.

Sent via Hubroid

Nava2 commented 12 years ago

Why have many writes? Isn't it easier and less work to just update on open and close On Mar 22, 2012 5:06 PM, "Ramesh Raj" < reply@reply.github.com> wrote:

Could we just have a history.day file that is updated each time next week is clicked and all it does is store users picks.

Sent via Hubroid


Reply to this email directly or view it on GitHub:

https://github.com/CS2212-2012-G2/SurvivorPool/issues/53#issuecomment-4648373

slyos commented 12 years ago

Wording was off. Store in our container(an array most likely) and write when we always write.

Nava2 commented 12 years ago

Sounds good to me.

slyos commented 12 years ago

cc834a19c5dcf6a58d74f3a385156bdfb8c3ab8f something like this? Not fully implemented, but it has a check to see if a week can be modified.

Nava2 commented 12 years ago

That looks good to me :)

slyos commented 12 years ago

How are going to implement this on the frontend?

Nava2 commented 12 years ago

Do we need to display this?

I think this is all in the back end.

slyos commented 12 years ago

I meant changing the cast off.

Nava2 commented 12 years ago

Yes. But I think this can be closed, since the back end is there.