My favorites | Sign in
Project Home
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions

Issue 3 attachment: eve-db.rb.20100310.diff (5.8 KB)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
Index: admin.py
===================================================================
--- admin.py (revision 30)
+++ admin.py (working copy)
@@ -164,3 +164,13 @@
'orbit_id', 'x', 'y', 'z', 'radius', 'name',
'security', 'celestial_index', 'orbit_index')
admin.site.register(EVEMapDenormalize, EVEMapDenormalizeAdmin)
+
+class EVEStationAdmin(admin.ModelAdmin):
+ list_display = ('id', 'security', 'docking_cost_per_volume',
+ 'max_ship_volume_dockable', 'office_rental_cost',
+ 'operation', 'station_type', 'corporation',
+ 'solar_system', 'constellation', 'region',
+ 'station_name', 'x', 'y', 'z', 'reprocessing_efficiency',
+ 'reprocessing_stations_take', 'reprocessing_hangar_flag')
+admin.site.register(EVEStation, EVEStationAdmin)
+
Index: ccp_importer/importers/station.py
===================================================================
--- ccp_importer/importers/station.py (revision 30)
+++ ccp_importer/importers/station.py (working copy)
@@ -112,4 +112,47 @@

operation.save()
db.reset_queries()
- c.close()
\ No newline at end of file
+ c.close()
+
+class Importer_staStations(SQLImporter):
+ DEPENDENCIES = ['mapDenormalize', 'staOperations', 'staStationTypes',
+ 'chrNPCCorporations', 'mapSolarSystems', 'mapConstellations']
+
+ def run_importer(self, conn):
+ c = conn.cursor()
+
+ for row in c.execute('select * from staStations'):
+ station, created = EVEStation.objects.get_or_create(id=row['stationID'])
+ station.security = row['security']
+ station.docking_cost_per_volume = row['dockingCostPerVolume']
+ station.max_ship_volume_dockable = row['maxShipVolumeDockable']
+ station.office_rental_cost = row['officeRentalCost']
+ station.station_name = row['stationName']
+ station.x = row['x']
+ station.y = row['y']
+ station.z = row['z']
+ station.reprocessing_efficiency = row['reprocessingEfficiency']
+ station.reprocessing_stations_take = row['reprocessingStationsTake']
+ station.reprocessing_hangar_flag = row['reprocessingHangarFlag']
+
+ if row['operationID']:
+ station.operation, created = EVEStationOperation.objects.get_or_create(id=row['operationID'])
+
+ if row['stationTypeID']:
+ invtype, created = EVEInventoryType.objects.get_or_create(id=row['stationTypeID'])
+ station.station_type, created = EVEStationType.objects.get_or_create(type=invtype)
+
+ if row['corporationID']:
+ station.corporation, created = EVENPCCorporation.objects.get_or_create(id=row['corporationID'])
+
+ if row['solarSystemID']:
+ station.solar_system = EVESolarSystem.objects.get(id=row['solarSystemID'])
+
+ if row['constellationID']:
+ station.constellation = EVEConstellation.objects.get(id=row['constellationID'])
+
+ if row['regionID']:
+ station.region = EVERegion.objects.get(id=row['regionID'])
+
+ station.save()
+ c.close()
\ No newline at end of file
Index: ccp_importer/util.py
===================================================================
--- ccp_importer/util.py (revision 30)
+++ ccp_importer/util.py (working copy)
@@ -61,7 +61,7 @@
#Importer_crpNPCCorporationResearchFields,
Importer_staStationTypes,
Importer_staOperations,
- #Importer_staStations,
+ Importer_staStations,
#Importer_ramAssemblyLines,
#Importer_staOperationServices,
#Importer_ramAssemblyLineStations,
Index: models/station.py
===================================================================
--- models/station.py (revision 30)
+++ models/station.py (working copy)
@@ -114,4 +114,38 @@
return self.name

def __str__(self):
+ return self.__unicode__()
+
+class EVEStation(models.Model):
+ """
+ staStations
+ """
+ security = models.IntegerField(blank=True, null=True)
+ docking_cost_per_volume = models.FloatField(blank=True, null=True)
+ max_ship_volume_dockable = models.FloatField(blank=True, null=True)
+ office_rental_cost = models.IntegerField(blank=True, null=True)
+ operation = models.ForeignKey(EVEStationOperation, blank=True, null=True)
+ station_type = models.ForeignKey(EVEStationType, blank=True, null=True)
+ corporation = models.ForeignKey('EVENPCCorporation', blank=True, null=True)
+ solar_system = models.ForeignKey('EVESolarSystem', blank=True, null=True)
+ constellation = models.ForeignKey('EVEConstellation', blank=True, null=True)
+ region = models.ForeignKey('EVERegion', blank=True, null=True)
+ station_name = models.CharField(max_length=100, blank=True)
+ x = models.FloatField(blank=True, null=True)
+ y = models.FloatField(blank=True, null=True)
+ z = models.FloatField(blank=True, null=True)
+ reprocessing_efficiency = models.FloatField(blank=True, null=True)
+ reprocessing_stations_take = models.FloatField(blank=True, null=True)
+ reprocessing_hangar_flag = models.IntegerField(blank=True, null=True)
+
+ class Meta:
+ app_label = 'eve_db'
+ ordering = ['id']
+ verbose_name = 'Station'
+ verbose_name_plural = 'Stations'
+
+ def __unicode__(self):
+ return self.name
+
+ def __str__(self):
return self.__unicode__()
\ No newline at end of file
Powered by Google Project Hosting