Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pyfa does not calculate multiple projections of the same fit #174

Closed
blitzmann opened this issue Sep 29, 2014 · 3 comments
Closed

Pyfa does not calculate multiple projections of the same fit #174

blitzmann opened this issue Sep 29, 2014 · 3 comments

Comments

@blitzmann
Copy link
Collaborator

Seems to be due to the way fits are calculated.

elif targetFit not in self.__calculatedTargets:
    return

When there is multiple projections of the same fit, the first one is not marked as calculated and goes through the process. The other one, however, satisfies the above condition and is just returned...

We can perhaps separate the calculations from the application of stats and projections... That was a fit that is calcuated can be cached and we can apply it multiple times instead of stopping.

Another reason is simply the way projected fits are expressed in the database, in which the sourceID and victimID are coupled into the Primary key, so we can only have 1 unique pair. There is, however, and amount attribute that doesn't seem to be used that we may be able to tap into.

@blitzmann
Copy link
Collaborator Author

So, to access the amount attribute, we pretty much have to implement the same thing as #83.

In the meantime, will look into the calculated cache to see what we can do...

@blitzmann
Copy link
Collaborator Author

Was able to get multiple projections from the same fit working by replacing this block of code:

    # Else, we're checking all target projectee fits
    elif targetFit not in self.__calculatedTargets:
        self.__calculatedTargets.append(targetFit)
        targetFit.calculateModifiedAttributes(dirtyStorage=dirtyStorage)
        forceProjected = True

    # Or simply apply projected drones and modules and return
    else:
        for runTime in ("early", "normal", "late"):
            c = chain(self.drones, self.modules)
            for item in c:
                targetFit.register(item)
                item.calculateModifiedAttributes(targetFit, runTime, True)
        return

However, it's really hackish. And it only works for the session - since the database table cannot have more than 1 source-victim, it won't be saved...

Speaking of which, I can't decide what to do with the database table. There are a few options:

Association Object: Will require us to write an association object to let us access the amount attribute (as well as planned state attribute). In addition, this would require us to implement an amount-loop in calculateModifiedAttributes(), and GUI logic to handle fit "stacking".

Redesign Table: Leaning more towards this. Instead of the traditional two-column model, have primary key on traditional ID column, and have each projection association get it's own ID. This will allow us easy access to any additional attributes.

@blitzmann
Copy link
Collaborator Author

Decided to go with association object. See #83 for development on this and other improvements

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant